diff options
Diffstat (limited to 'lib/Transforms/Scalar')
27 files changed, 135 insertions, 105 deletions
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index d909d0227c0..c633f930581 100644 --- a/lib/Transforms/Scalar/ADCE.cpp +++ b/lib/Transforms/Scalar/ADCE.cpp @@ -106,11 +106,11 @@ private: markInstructionLive(const_cast<TerminatorInst*>(BB->getTerminator())); } }; - - char ADCE::ID = 0; - RegisterPass<ADCE> X("adce", "Aggressive Dead Code Elimination"); } // End of anonymous namespace +char ADCE::ID = 0; +static RegisterPass<ADCE> X("adce", "Aggressive Dead Code Elimination"); + FunctionPass *llvm::createAggressiveDCEPass() { return new ADCE(); } void ADCE::markBlockAlive(BasicBlock *BB) { diff --git a/lib/Transforms/Scalar/BasicBlockPlacement.cpp b/lib/Transforms/Scalar/BasicBlockPlacement.cpp index 9bde7490357..041bed234b6 100644 --- a/lib/Transforms/Scalar/BasicBlockPlacement.cpp +++ b/lib/Transforms/Scalar/BasicBlockPlacement.cpp @@ -72,12 +72,12 @@ namespace { /// successors. void PlaceBlocks(BasicBlock *BB); }; - - char BlockPlacement::ID = 0; - RegisterPass<BlockPlacement> X("block-placement", - "Profile Guided Basic Block Placement"); } +char BlockPlacement::ID = 0; +static RegisterPass<BlockPlacement> +X("block-placement", "Profile Guided Basic Block Placement"); + FunctionPass *llvm::createBlockPlacementPass() { return new BlockPlacement(); } bool BlockPlacement::runOnFunction(Function &F) { diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp index bc19114fa2d..2dfd4d7a3d3 100644 --- a/lib/Transforms/Scalar/CodeGenPrepare.cpp +++ b/lib/Transforms/Scalar/CodeGenPrepare.cpp @@ -483,6 +483,7 @@ static void EraseDeadInstructions(Value *V) { } } +namespace { /// ExtAddrMode - This is an extended version of TargetLowering::AddrMode which /// holds actual Value*'s for register values. @@ -517,6 +518,8 @@ void ExtAddrMode::dump() const { cerr << *this << "\n"; } +} + static bool TryMatchingScaledValue(Value *ScaleReg, int64_t Scale, const Type *AccessTy, ExtAddrMode &AddrMode, SmallVector<Instruction*, 16> &AddrModeInsts, diff --git a/lib/Transforms/Scalar/CondPropagate.cpp b/lib/Transforms/Scalar/CondPropagate.cpp index bed2b359a0e..c1e419569f4 100644 --- a/lib/Transforms/Scalar/CondPropagate.cpp +++ b/lib/Transforms/Scalar/CondPropagate.cpp @@ -48,10 +48,10 @@ namespace { void SimplifyPredecessors(SwitchInst *SI); void RevectorBlockTo(BasicBlock *FromBB, BasicBlock *ToBB); }; - - char CondProp::ID = 0; - RegisterPass<CondProp> X("condprop", "Conditional Propagation"); } + +char CondProp::ID = 0; +static RegisterPass<CondProp> X("condprop", "Conditional Propagation"); FunctionPass *llvm::createCondPropagationPass() { return new CondProp(); diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp index 60b915a1b5e..90e8dad4f8a 100644 --- a/lib/Transforms/Scalar/ConstantProp.cpp +++ b/lib/Transforms/Scalar/ConstantProp.cpp @@ -43,12 +43,12 @@ namespace { AU.setPreservesCFG(); } }; - - char ConstantPropagation::ID = 0; - RegisterPass<ConstantPropagation> X("constprop", - "Simple constant propagation"); } +char ConstantPropagation::ID = 0; +static RegisterPass<ConstantPropagation> +X("constprop", "Simple constant propagation"); + FunctionPass *llvm::createConstantPropagationPass() { return new ConstantPropagation(); } diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp index 539dd22d47d..a63fcb6589f 100644 --- a/lib/Transforms/Scalar/DCE.cpp +++ b/lib/Transforms/Scalar/DCE.cpp @@ -52,11 +52,12 @@ namespace { AU.setPreservesCFG(); } }; - - char DeadInstElimination::ID = 0; - RegisterPass<DeadInstElimination> X("die", "Dead Instruction Elimination"); } +char DeadInstElimination::ID = 0; +static RegisterPass<DeadInstElimination> +X("die", "Dead Instruction Elimination"); + Pass *llvm::createDeadInstEliminationPass() { return new DeadInstElimination(); } @@ -76,11 +77,11 @@ namespace { AU.setPreservesCFG(); } }; - - char DCE::ID = 0; - RegisterPass<DCE> Y("dce", "Dead Code Elimination"); } +char DCE::ID = 0; +static RegisterPass<DCE> Y("dce", "Dead Code Elimination"); + bool DCE::runOnFunction(Function &F) { // Start out with all of the instructions in the worklist... std::vector<Instruction*> WorkList; diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp index 89afa911e75..bbb3a8a3447 100644 --- a/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -92,10 +92,11 @@ namespace { AU.addPreserved<MemoryDependenceAnalysis>(); } }; - char DSE::ID = 0; - RegisterPass<DSE> X("dse", "Dead Store Elimination"); } +char DSE::ID = 0; +static RegisterPass<DSE> X("dse", "Dead Store Elimination"); + FunctionPass *llvm::createDeadStoreEliminationPass() { return new DSE(); } bool DSE::runOnBasicBlock(BasicBlock &BB) { diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp index 39a1b257258..35752bb6796 100644 --- a/lib/Transforms/Scalar/GCSE.cpp +++ b/lib/Transforms/Scalar/GCSE.cpp @@ -52,11 +52,12 @@ namespace { AU.addRequired<ValueNumbering>(); } }; - - char GCSE::ID = 0; - RegisterPass<GCSE> X("gcse", "Global Common Subexpression Elimination"); } +char GCSE::ID = 0; +static RegisterPass<GCSE> +X("gcse", "Global Common Subexpression Elimination"); + // createGCSEPass - The public interface to this file... FunctionPass *llvm::createGCSEPass() { return new GCSE(); } diff --git a/lib/Transforms/Scalar/GVNPRE.cpp b/lib/Transforms/Scalar/GVNPRE.cpp index 3bd6bff5d60..80d74e6004b 100644 --- a/lib/Transforms/Scalar/GVNPRE.cpp +++ b/lib/Transforms/Scalar/GVNPRE.cpp @@ -45,6 +45,8 @@ using namespace llvm; // ValueTable Class //===----------------------------------------------------------------------===// +namespace { + /// This class holds the mapping between values and value numbers. It is used /// as an efficient mechanism to determine the expression-wise equivalence of /// two values. @@ -123,6 +125,7 @@ struct Expression { } }; +} namespace { class VISIBILITY_HIDDEN ValueTable { @@ -596,6 +599,8 @@ unsigned ValueTable::size() { return nextValueNumber; } +namespace { + //===----------------------------------------------------------------------===// // ValueNumberedSet Class //===----------------------------------------------------------------------===// @@ -652,6 +657,8 @@ class ValueNumberedSet { } }; +} + //===----------------------------------------------------------------------===// // GVNPRE Pass //===----------------------------------------------------------------------===// diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index 43054227aea..4de19a94fb4 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -94,11 +94,12 @@ namespace { void DeleteTriviallyDeadInstructions(std::set<Instruction*> &Insts); }; - - char IndVarSimplify::ID = 0; - RegisterPass<IndVarSimplify> X("indvars", "Canonicalize Induction Variables"); } +char IndVarSimplify::ID = 0; +static RegisterPass<IndVarSimplify> +X("indvars", "Canonicalize Induction Variables"); + LoopPass *llvm::createIndVarSimplifyPass() { return new IndVarSimplify(); } diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index f3591879f7b..06620557daa 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -8,8 +8,8 @@ //===----------------------------------------------------------------------===// // // InstructionCombining - Combine instructions to form fewer, simple -// instructions. This pass does not modify the CFG This pass is where algebraic -// simplification happens. +// instructions. This pass does not modify the CFG. This pass is where +// algebraic simplification happens. // // This pass combines things like: // %Y = add i32 %X, 1 @@ -384,11 +384,12 @@ namespace { unsigned GetOrEnforceKnownAlignment(Value *V, unsigned PrefAlign = 0); }; - - char InstCombiner::ID = 0; - RegisterPass<InstCombiner> X("instcombine", "Combine redundant instructions"); } +char InstCombiner::ID = 0; +static RegisterPass<InstCombiner> +X("instcombine", "Combine redundant instructions"); + // getComplexity: Assign a complexity or rank value to LLVM Values... // 0 -> undef, 1 -> Const, 2 -> Other, 3 -> Arg, 3 -> Unary, 4 -> OtherInst static unsigned getComplexity(Value *V) { @@ -2151,6 +2152,7 @@ Instruction *AssociativeOpt(BinaryOperator &Root, const Functor &F) { return 0; } +namespace { // AddRHS - Implements: X + X --> X << 1 struct AddRHS { @@ -2178,6 +2180,8 @@ struct AddMaskingAnd { } }; +} + static Value *FoldOperationIntoSelectOperand(Instruction &I, Value *SO, InstCombiner *IC) { if (CastInst *CI = dyn_cast<CastInst>(&I)) { @@ -4635,6 +4639,8 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { return Changed ? &I : 0; } +namespace { + // XorSelf - Implements: X ^ X --> 0 struct XorSelf { Value *RHS; @@ -4645,6 +4651,7 @@ struct XorSelf { } }; +} Instruction *InstCombiner::visitXor(BinaryOperator &I) { bool Changed = SimplifyCommutative(I); diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp index 991b11110b4..d79a6cea3b1 100644 --- a/lib/Transforms/Scalar/JumpThreading.cpp +++ b/lib/Transforms/Scalar/JumpThreading.cpp @@ -63,10 +63,12 @@ namespace { bool ProcessBranchOnLogical(Value *V, BasicBlock *BB, bool isAnd); bool ProcessBranchOnCompare(CmpInst *Cmp, BasicBlock *BB); }; - char JumpThreading::ID = 0; - RegisterPass<JumpThreading> X("jump-threading", "Jump Threading"); } +char JumpThreading::ID = 0; +static RegisterPass<JumpThreading> +X("jump-threading", "Jump Threading"); + // Public interface to the Jump Threading pass FunctionPass *llvm::createJumpThreadingPass() { return new JumpThreading(); } diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index 2d535326d2a..695a4fb0159 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/lib/Transforms/Scalar/LICM.cpp @@ -58,11 +58,11 @@ STATISTIC(NumMovedLoads, "Number of load insts hoisted or sunk"); STATISTIC(NumMovedCalls, "Number of call insts hoisted or sunk"); STATISTIC(NumPromoted , "Number of memory locations promoted to registers"); -namespace { - static cl::opt<bool> - DisablePromotion("disable-licm-promotion", cl::Hidden, - cl::desc("Disable memory promotion in LICM pass")); +static cl::opt<bool> +DisablePromotion("disable-licm-promotion", cl::Hidden, + cl::desc("Disable memory promotion in LICM pass")); +namespace { struct VISIBILITY_HIDDEN LICM : public LoopPass { static char ID; // Pass identification, replacement for typeid LICM() : LoopPass((intptr_t)&ID) {} @@ -216,11 +216,11 @@ namespace { std::vector<std::pair<AllocaInst*, Value*> > &PromotedValues, std::map<Value*, AllocaInst*> &Val2AlMap); }; - - char LICM::ID = 0; - RegisterPass<LICM> X("licm", "Loop Invariant Code Motion"); } +char LICM::ID = 0; +static RegisterPass<LICM> X("licm", "Loop Invariant Code Motion"); + LoopPass *llvm::createLICMPass() { return new LICM(); } /// Hoist expressions out of the specified loop. Note, alias info for inner diff --git a/lib/Transforms/Scalar/LoopDeletion.cpp b/lib/Transforms/Scalar/LoopDeletion.cpp index 02a5ca98d97..c26a66c721e 100644 --- a/lib/Transforms/Scalar/LoopDeletion.cpp +++ b/lib/Transforms/Scalar/LoopDeletion.cpp @@ -52,10 +52,10 @@ namespace { AU.addPreservedID(LCSSAID); } }; - - char LoopDeletion::ID = 0; - RegisterPass<LoopDeletion> X ("loop-deletion", "Delete dead loops"); } + +char LoopDeletion::ID = 0; +static RegisterPass<LoopDeletion> X("loop-deletion", "Delete dead loops"); LoopPass* llvm::createLoopDeletionPass() { return new LoopDeletion(); diff --git a/lib/Transforms/Scalar/LoopIndexSplit.cpp b/lib/Transforms/Scalar/LoopIndexSplit.cpp index a6bd9ff20a9..6113b24a298 100644 --- a/lib/Transforms/Scalar/LoopIndexSplit.cpp +++ b/lib/Transforms/Scalar/LoopIndexSplit.cpp @@ -195,11 +195,12 @@ namespace { // Induction variable's final loop exit value operand number in exit condition.. unsigned ExitValueNum; }; - - char LoopIndexSplit::ID = 0; - RegisterPass<LoopIndexSplit> X ("loop-index-split", "Index Split Loops"); } +char LoopIndexSplit::ID = 0; +static RegisterPass<LoopIndexSplit> +X("loop-index-split", "Index Split Loops"); + LoopPass *llvm::createLoopIndexSplitPass() { return new LoopIndexSplit(); } diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp index 91a96bcedac..d8362a55006 100644 --- a/lib/Transforms/Scalar/LoopRotation.cpp +++ b/lib/Transforms/Scalar/LoopRotation.cpp @@ -102,10 +102,10 @@ namespace { LPPassManager *LPM_Ptr; SmallVector<RenameData, MAX_HEADER_SIZE> LoopHeaderInfo; }; - - char LoopRotate::ID = 0; - RegisterPass<LoopRotate> X ("loop-rotate", "Rotate Loops"); } + +char LoopRotate::ID = 0; +static RegisterPass<LoopRotate> X("loop-rotate", "Rotate Loops"); LoopPass *llvm::createLoopRotatePass() { return new LoopRotate(); } diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 4dc7d60b0cb..6d66d14ec9a 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -194,10 +194,12 @@ private: Loop *L, bool isOnlyStride); void DeleteTriviallyDeadInstructions(SmallPtrSet<Instruction*,16> &Insts); }; - char LoopStrengthReduce::ID = 0; - RegisterPass<LoopStrengthReduce> X("loop-reduce", "Loop Strength Reduction"); } +char LoopStrengthReduce::ID = 0; +static RegisterPass<LoopStrengthReduce> +X("loop-reduce", "Loop Strength Reduction"); + LoopPass *llvm::createLoopStrengthReducePass(const TargetLowering *TLI) { return new LoopStrengthReduce(TLI); } diff --git a/lib/Transforms/Scalar/LoopUnroll.cpp b/lib/Transforms/Scalar/LoopUnroll.cpp index 0db964125ad..d3299702043 100644 --- a/lib/Transforms/Scalar/LoopUnroll.cpp +++ b/lib/Transforms/Scalar/LoopUnroll.cpp @@ -44,17 +44,15 @@ using namespace llvm; STATISTIC(NumCompletelyUnrolled, "Number of loops completely unrolled"); STATISTIC(NumUnrolled, "Number of loops unrolled (completely or otherwise)"); -namespace { - static cl::opt<unsigned> - UnrollThreshold - ("unroll-threshold", cl::init(100), cl::Hidden, - cl::desc("The cut-off point for automatic loop unrolling")); +static cl::opt<unsigned> +UnrollThreshold("unroll-threshold", cl::init(100), cl::Hidden, + cl::desc("The cut-off point for automatic loop unrolling")); - static cl::opt<unsigned> - UnrollCount - ("unroll-count", cl::init(0), cl::Hidden, - cl::desc("Use this unroll count for all loops, for testing purposes")); +static cl::opt<unsigned> +UnrollCount("unroll-count", cl::init(0), cl::Hidden, + cl::desc("Use this unroll count for all loops, for testing purposes")); +namespace { class VISIBILITY_HIDDEN LoopUnroll : public LoopPass { LoopInfo *LI; // The current loop information public: @@ -81,10 +79,11 @@ namespace { AU.addPreserved<LoopInfo>(); } }; - char LoopUnroll::ID = 0; - RegisterPass<LoopUnroll> X("loop-unroll", "Unroll loops"); } +char LoopUnroll::ID = 0; +static RegisterPass<LoopUnroll> X("loop-unroll", "Unroll loops"); + LoopPass *llvm::createLoopUnrollPass() { return new LoopUnroll(); } /// ApproximateLoopSize - Approximate the size of the loop. diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index 5af0a57a80f..78069870507 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -54,11 +54,11 @@ STATISTIC(NumSelects , "Number of selects unswitched"); STATISTIC(NumTrivial , "Number of unswitches that are trivial"); STATISTIC(NumSimplify, "Number of simplifications of unswitched code"); -namespace { - static cl::opt<unsigned> - Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"), - cl::init(10), cl::Hidden); +static cl::opt<unsigned> +Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"), + cl::init(10), cl::Hidden); +namespace { class VISIBILITY_HIDDEN LoopUnswitch : public LoopPass { LoopInfo *LI; // Loop information LPPassManager *LPM; @@ -144,9 +144,9 @@ namespace { std::vector<Instruction*> &Worklist, Loop *l); void RemoveLoopFromHierarchy(Loop *L); }; - char LoopUnswitch::ID = 0; - RegisterPass<LoopUnswitch> X("loop-unswitch", "Unswitch loops"); } +char LoopUnswitch::ID = 0; +static RegisterPass<LoopUnswitch> X("loop-unswitch", "Unswitch loops"); LoopPass *llvm::createLoopUnswitchPass(bool Os) { return new LoopUnswitch(Os); @@ -459,11 +459,11 @@ static inline void RemapInstruction(Instruction *I, // OrigPreheader is loop pre-header before this pass started // updating CFG. NewPrehader is loops new pre-header. However, after CFG // manipulation, loop L may not exist. So rely on input parameter NewPreheader. -void CloneDomInfo(BasicBlock *NewBB, BasicBlock *Orig, - BasicBlock *NewPreheader, BasicBlock *OrigPreheader, - BasicBlock *OrigHeader, - DominatorTree *DT, DominanceFrontier *DF, - DenseMap<const Value*, Value*> &VM) { +static void CloneDomInfo(BasicBlock *NewBB, BasicBlock *Orig, + BasicBlock *NewPreheader, BasicBlock *OrigPreheader, + BasicBlock *OrigHeader, + DominatorTree *DT, DominanceFrontier *DF, + DenseMap<const Value*, Value*> &VM) { // If NewBB alreay has found its place in domiantor tree then no need to do // anything. diff --git a/lib/Transforms/Scalar/PredicateSimplifier.cpp b/lib/Transforms/Scalar/PredicateSimplifier.cpp index 1b36d84a7bd..5c79444dc51 100644 --- a/lib/Transforms/Scalar/PredicateSimplifier.cpp +++ b/lib/Transforms/Scalar/PredicateSimplifier.cpp @@ -2646,12 +2646,12 @@ namespace { } } } - - char PredicateSimplifier::ID = 0; - RegisterPass<PredicateSimplifier> X("predsimplify", - "Predicate Simplifier"); } +char PredicateSimplifier::ID = 0; +static RegisterPass<PredicateSimplifier> +X("predsimplify", "Predicate Simplifier"); + FunctionPass *llvm::createPredicateSimplifierPass() { return new PredicateSimplifier(); } diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp index 0a118cd338b..e2d133ce351 100644 --- a/lib/Transforms/Scalar/Reassociate.cpp +++ b/lib/Transforms/Scalar/Reassociate.cpp @@ -64,7 +64,7 @@ static void PrintOps(Instruction *I, const std::vector<ValueEntry> &Ops) { << "," << Ops[i].Rank; } -namespace { +namespace { class VISIBILITY_HIDDEN Reassociate : public FunctionPass { std::map<BasicBlock*, unsigned> RankMap; std::map<Value*, unsigned> ValueRankMap; @@ -92,11 +92,11 @@ namespace { void RemoveDeadBinaryOp(Value *V); }; - - char Reassociate::ID = 0; - RegisterPass<Reassociate> X("reassociate", "Reassociate expressions"); } +char Reassociate::ID = 0; +static RegisterPass<Reassociate> X("reassociate", "Reassociate expressions"); + // Public interface to the Reassociate pass FunctionPass *llvm::createReassociatePass() { return new Reassociate(); } diff --git a/lib/Transforms/Scalar/Reg2Mem.cpp b/lib/Transforms/Scalar/Reg2Mem.cpp index eda0c0e93a1..b31b1d1fa6e 100644 --- a/lib/Transforms/Scalar/Reg2Mem.cpp +++ b/lib/Transforms/Scalar/Reg2Mem.cpp @@ -111,10 +111,11 @@ namespace { return false; } }; - - char RegToMem::ID = 0; - RegisterPass<RegToMem> X("reg2mem", "Demote all values to stack slots"); } + +char RegToMem::ID = 0; +static RegisterPass<RegToMem> +X("reg2mem", "Demote all values to stack slots"); // createDemoteRegisterToMemory - Provide an entry point to create this pass. // diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 168e54484da..9c17b77954e 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -1435,11 +1435,11 @@ namespace { AU.setPreservesCFG(); } }; - - char SCCP::ID = 0; - RegisterPass<SCCP> X("sccp", "Sparse Conditional Constant Propagation"); } // end anonymous namespace +char SCCP::ID = 0; +static RegisterPass<SCCP> +X("sccp", "Sparse Conditional Constant Propagation"); // createSCCPPass - This is the public interface to this file... FunctionPass *llvm::createSCCPPass() { @@ -1543,12 +1543,12 @@ namespace { IPSCCP() : ModulePass((intptr_t)&ID) {} bool runOnModule(Module &M); }; - - char IPSCCP::ID = 0; - RegisterPass<IPSCCP> - Y("ipsccp", "Interprocedural Sparse Conditional Constant Propagation"); } // end anonymous namespace +char IPSCCP::ID = 0; +static RegisterPass<IPSCCP> +Y("ipsccp", "Interprocedural Sparse Conditional Constant Propagation"); + // createIPSCCPPass - This is the public interface to this file... ModulePass *llvm::createIPSCCPPass() { return new IPSCCP(); diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 51aad84c072..0cd10ef0c16 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -124,11 +124,11 @@ namespace { unsigned Offset); static Instruction *isOnlyCopiedFromConstantGlobal(AllocationInst *AI); }; - - char SROA::ID = 0; - RegisterPass<SROA> X("scalarrepl", "Scalar Replacement of Aggregates"); } +char SROA::ID = 0; +static RegisterPass<SROA> X("scalarrepl", "Scalar Replacement of Aggregates"); + // Public interface to the ScalarReplAggregates pass FunctionPass *llvm::createScalarReplAggregatesPass(signed int Threshold) { return new SROA(Threshold); diff --git a/lib/Transforms/Scalar/SimplifyCFG.cpp b/lib/Transforms/Scalar/SimplifyCFG.cpp index 48342bdc11f..a42bc34040e 100644 --- a/lib/Transforms/Scalar/SimplifyCFG.cpp +++ b/lib/Transforms/Scalar/SimplifyCFG.cpp @@ -45,10 +45,11 @@ namespace { virtual bool runOnFunction(Function &F); }; - char CFGSimplifyPass::ID = 0; - RegisterPass<CFGSimplifyPass> X("simplifycfg", "Simplify the CFG"); } +char CFGSimplifyPass::ID = 0; +static RegisterPass<CFGSimplifyPass> X("simplifycfg", "Simplify the CFG"); + // Public interface to the CFGSimplification pass FunctionPass *llvm::createCFGSimplificationPass() { return new CFGSimplifyPass(); diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp index f9b8ace11f3..40da808f671 100644 --- a/lib/Transforms/Scalar/TailDuplication.cpp +++ b/lib/Transforms/Scalar/TailDuplication.cpp @@ -37,10 +37,11 @@ using namespace llvm; STATISTIC(NumEliminated, "Number of unconditional branches eliminated"); +static cl::opt<unsigned> +Threshold("taildup-threshold", cl::desc("Max block size to tail duplicate"), + cl::init(6), cl::Hidden); + namespace { - cl::opt<unsigned> - Threshold("taildup-threshold", cl::desc("Max block size to tail duplicate"), - cl::init(6), cl::Hidden); class VISIBILITY_HIDDEN TailDup : public FunctionPass { bool runOnFunction(Function &F); public: @@ -51,10 +52,11 @@ namespace { inline bool shouldEliminateUnconditionalBranch(TerminatorInst *TI); inline void eliminateUnconditionalBranch(BranchInst *BI); }; - char TailDup::ID = 0; - RegisterPass<TailDup> X("tailduplicate", "Tail Duplication"); } +char TailDup::ID = 0; +static RegisterPass<TailDup> X("tailduplicate", "Tail Duplication"); + // Public interface to the Tail Duplication pass FunctionPass *llvm::createTailDuplicationPass() { return new TailDup(); } diff --git a/lib/Transforms/Scalar/TailRecursionElimination.cpp b/lib/Transforms/Scalar/TailRecursionElimination.cpp index 78b088a6444..b9de782b270 100644 --- a/lib/Transforms/Scalar/TailRecursionElimination.cpp +++ b/lib/Transforms/Scalar/TailRecursionElimination.cpp @@ -80,10 +80,11 @@ namespace { bool CanMoveAboveCall(Instruction *I, CallInst *CI); Value *CanTransformAccumulatorRecursion(Instruction *I, CallInst *CI); }; - char TailCallElim::ID = 0; - RegisterPass<TailCallElim> X("tailcallelim", "Tail Call Elimination"); } +char TailCallElim::ID = 0; +static RegisterPass<TailCallElim> X("tailcallelim", "Tail Call Elimination"); + // Public interface to the TailCallElimination pass FunctionPass *llvm::createTailCallEliminationPass() { return new TailCallElim(); |