From: Benjamin Kramer Date: Sun, 10 Jul 2016 11:28:51 +0000 (+0000) Subject: Give helper classes/functions internal linkage. NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a27e16e47713c610331bdc5a1f7760eacd4ded9f;p=llvm Give helper classes/functions internal linkage. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275014 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 8cce0efb32d..27ee96dfedf 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -2731,7 +2731,7 @@ void SelectionDAGBuilder::visitFCmp(const User &I) { // Check if the condition of the select has one use or two users that are both // selects with the same condition. -bool hasOnlySelectUsers(const Value *Cond) { +static bool hasOnlySelectUsers(const Value *Cond) { return std::all_of(Cond->user_begin(), Cond->user_end(), [](const Value *V) { return isa(V); }); diff --git a/lib/DebugInfo/PDB/Raw/DbiStream.cpp b/lib/DebugInfo/PDB/Raw/DbiStream.cpp index 28250c588ff..ec807a29a03 100644 --- a/lib/DebugInfo/PDB/Raw/DbiStream.cpp +++ b/lib/DebugInfo/PDB/Raw/DbiStream.cpp @@ -80,8 +80,8 @@ struct DbiStream::HeaderInfo { }; template -Error loadSectionContribs(FixedStreamArray &Output, - StreamReader &Reader) { +static Error loadSectionContribs(FixedStreamArray &Output, + StreamReader &Reader) { if (Reader.bytesRemaining() % sizeof(ContribType) != 0) return make_error( raw_error_code::corrupt_file, diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp index 2fbf7475268..b902b6056fc 100644 --- a/lib/Target/ARM/ARMISelLowering.cpp +++ b/lib/Target/ARM/ARMISelLowering.cpp @@ -3720,9 +3720,13 @@ SDValue ARMTargetLowering::getCMOV(const SDLoc &dl, EVT VT, SDValue FalseVal, } } -bool isGTorGE(ISD::CondCode CC) { return CC == ISD::SETGT || CC == ISD::SETGE; } +static bool isGTorGE(ISD::CondCode CC) { + return CC == ISD::SETGT || CC == ISD::SETGE; +} -bool isLTorLE(ISD::CondCode CC) { return CC == ISD::SETLT || CC == ISD::SETLE; } +static bool isLTorLE(ISD::CondCode CC) { + return CC == ISD::SETLT || CC == ISD::SETLE; +} // See if a conditional (LHS CC RHS ? TrueVal : FalseVal) is lower-saturating. // All of these conditions (and their <= and >= counterparts) will do: @@ -3730,9 +3734,9 @@ bool isLTorLE(ISD::CondCode CC) { return CC == ISD::SETLT || CC == ISD::SETLE; } // x > k ? x : k // k < x ? x : k // k > x ? k : x -bool isLowerSaturate(const SDValue LHS, const SDValue RHS, - const SDValue TrueVal, const SDValue FalseVal, - const ISD::CondCode CC, const SDValue K) { +static bool isLowerSaturate(const SDValue LHS, const SDValue RHS, + const SDValue TrueVal, const SDValue FalseVal, + const ISD::CondCode CC, const SDValue K) { return (isGTorGE(CC) && ((K == LHS && K == TrueVal) || (K == RHS && K == FalseVal))) || (isLTorLE(CC) && @@ -3740,9 +3744,9 @@ bool isLowerSaturate(const SDValue LHS, const SDValue RHS, } // Similar to isLowerSaturate(), but checks for upper-saturating conditions. -bool isUpperSaturate(const SDValue LHS, const SDValue RHS, - const SDValue TrueVal, const SDValue FalseVal, - const ISD::CondCode CC, const SDValue K) { +static bool isUpperSaturate(const SDValue LHS, const SDValue RHS, + const SDValue TrueVal, const SDValue FalseVal, + const ISD::CondCode CC, const SDValue K) { return (isGTorGE(CC) && ((K == RHS && K == TrueVal) || (K == LHS && K == FalseVal))) || (isLTorLE(CC) && @@ -3762,7 +3766,8 @@ bool isUpperSaturate(const SDValue LHS, const SDValue RHS, // // It returns true if the conversion can be done, false otherwise. // Additionally, the variable is returned in parameter V and the constant in K. -bool isSaturatingConditional(const SDValue &Op, SDValue &V, uint64_t &K) { +static bool isSaturatingConditional(const SDValue &Op, SDValue &V, + uint64_t &K) { SDValue LHS1 = Op.getOperand(0); SDValue RHS1 = Op.getOperand(1); diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp index 7f82596ae54..ed58a87ae1a 100644 --- a/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -1050,6 +1050,7 @@ PreservedAnalyses DSEPass::run(Function &F, FunctionAnalysisManager &AM) { return PA; } +namespace { /// A legacy pass for the legacy pass manager that wraps \c DSEPass. class DSELegacyPass : public FunctionPass { public: @@ -1084,6 +1085,7 @@ public: static char ID; // Pass identification, replacement for typeid }; +} // end anonymous namespace char DSELegacyPass::ID = 0; INITIALIZE_PASS_BEGIN(DSELegacyPass, "dse", "Dead Store Elimination", false, diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp index 549248fbf73..7a06a25a707 100644 --- a/lib/Transforms/Scalar/LoopRotation.cpp +++ b/lib/Transforms/Scalar/LoopRotation.cpp @@ -49,6 +49,7 @@ static cl::opt DefaultRotationThreshold( STATISTIC(NumRotated, "Number of loops rotated"); +namespace { /// A simple loop rotation transformation. class LoopRotate { const unsigned MaxHeaderSize; @@ -70,6 +71,7 @@ private: bool rotateLoop(Loop *L, bool SimplifiedLatch); bool simplifyLoopLatch(Loop *L); }; +} // end anonymous namespace /// RewriteUsesOfClonedInstructions - We just cloned the instructions from the /// old header into the preheader. If there were uses of the values produced by diff --git a/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp b/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp index 0a86920efba..30261b75500 100644 --- a/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp +++ b/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp @@ -93,6 +93,7 @@ using namespace llvm; #define DEBUG_TYPE "mldst-motion" +namespace { //===----------------------------------------------------------------------===// // MergedLoadStoreMotion Pass //===----------------------------------------------------------------------===// @@ -135,6 +136,7 @@ private: bool sinkStore(BasicBlock *BB, StoreInst *SinkCand, StoreInst *ElseInst); bool mergeStores(BasicBlock *BB); }; +} // end anonymous namespace /// /// \brief Remove instruction from parent and update memory dependence analysis. diff --git a/lib/Transforms/Vectorize/SLPVectorizer.cpp b/lib/Transforms/Vectorize/SLPVectorizer.cpp index 9e531e30fb9..8a3c4d14fec 100644 --- a/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -3426,6 +3426,7 @@ void BoUpSLP::computeMinimumValueSizes() { MinBWs[Scalar] = MaxBitWidth; } +namespace { /// The SLPVectorizer Pass. struct SLPVectorizer : public FunctionPass { SLPVectorizerPass Impl; @@ -3475,6 +3476,7 @@ struct SLPVectorizer : public FunctionPass { AU.setPreservesCFG(); } }; +} // end anonymous namespace PreservedAnalyses SLPVectorizerPass::run(Function &F, FunctionAnalysisManager &AM) { auto *SE = &AM.getResult(F);