diff options
author | Devang Patel <dpatel@apple.com> | 2007-05-01 21:15:47 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-05-01 21:15:47 +0000 |
commit | 794fd75c67a2cdc128d67342c6d88a504d186896 (patch) | |
tree | 6b805aa4a576e9de6cbf096d2fb85063b3fb8fca /lib/Transforms/Scalar | |
parent | e50fb9ac174b791047ffa8648443ab94b2097cd9 (diff) | |
download | external_llvm-794fd75c67a2cdc128d67342c6d88a504d186896.zip external_llvm-794fd75c67a2cdc128d67342c6d88a504d186896.tar.gz external_llvm-794fd75c67a2cdc128d67342c6d88a504d186896.tar.bz2 |
Do not use typeinfo to identify pass in pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
26 files changed, 114 insertions, 5 deletions
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index 3946f57..75e9d2f 100644 --- a/lib/Transforms/Scalar/ADCE.cpp +++ b/lib/Transforms/Scalar/ADCE.cpp @@ -52,6 +52,9 @@ class VISIBILITY_HIDDEN ADCE : public FunctionPass { // The public interface for this class // public: + static const int ID; // Pass identifcation, replacement for typeid + ADCE() : FunctionPass((intptr_t)&ID) {} + // Execute the Aggressive Dead Code Elimination Algorithm // virtual bool runOnFunction(Function &F) { @@ -104,6 +107,7 @@ private: } }; + const int ADCE::ID = 0; RegisterPass<ADCE> X("adce", "Aggressive Dead Code Elimination"); } // End of anonymous namespace diff --git a/lib/Transforms/Scalar/BasicBlockPlacement.cpp b/lib/Transforms/Scalar/BasicBlockPlacement.cpp index 14de1f1..a560d55 100644 --- a/lib/Transforms/Scalar/BasicBlockPlacement.cpp +++ b/lib/Transforms/Scalar/BasicBlockPlacement.cpp @@ -41,6 +41,9 @@ STATISTIC(NumMoved, "Number of basic blocks moved"); namespace { struct VISIBILITY_HIDDEN BlockPlacement : public FunctionPass { + static const int ID; // Pass identifcation, replacement for typeid + BlockPlacement() : FunctionPass((intptr_t)&ID) {} + virtual bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { @@ -70,6 +73,7 @@ namespace { void PlaceBlocks(BasicBlock *BB); }; + const int BlockPlacement::ID = 0; RegisterPass<BlockPlacement> X("block-placement", "Profile Guided Basic Block Placement"); } diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp index 7a3eac78..738db80 100644 --- a/lib/Transforms/Scalar/CodeGenPrepare.cpp +++ b/lib/Transforms/Scalar/CodeGenPrepare.cpp @@ -39,7 +39,9 @@ namespace { /// transformation profitability. const TargetLowering *TLI; public: - CodeGenPrepare(const TargetLowering *tli = 0) : TLI(tli) {} + static const int ID; // Pass identifcation, replacement for typeid + CodeGenPrepare(const TargetLowering *tli = 0) : FunctionPass((intptr_t)&ID), + TLI(tli) {} bool runOnFunction(Function &F); private: @@ -52,6 +54,8 @@ namespace { DenseMap<Value*,Value*> &SunkAddrs); }; } + +const int CodeGenPrepare::ID = 0; static RegisterPass<CodeGenPrepare> X("codegenprepare", "Optimize for code generation"); diff --git a/lib/Transforms/Scalar/CondPropagate.cpp b/lib/Transforms/Scalar/CondPropagate.cpp index 90a4f30..4f41b1b 100644 --- a/lib/Transforms/Scalar/CondPropagate.cpp +++ b/lib/Transforms/Scalar/CondPropagate.cpp @@ -31,6 +31,9 @@ STATISTIC(NumSwThread, "Number of CFG edges threaded through switches"); namespace { struct VISIBILITY_HIDDEN CondProp : public FunctionPass { + static const int ID; // Pass identifcation, replacement for typeid + CondProp() : FunctionPass((intptr_t)&ID) {} + virtual bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { @@ -45,6 +48,8 @@ namespace { void SimplifyPredecessors(SwitchInst *SI); void RevectorBlockTo(BasicBlock *FromBB, BasicBlock *ToBB); }; + + const int CondProp::ID = 0; RegisterPass<CondProp> X("condprop", "Conditional Propagation"); } diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp index 226d1de..32f5879 100644 --- a/lib/Transforms/Scalar/ConstantProp.cpp +++ b/lib/Transforms/Scalar/ConstantProp.cpp @@ -34,6 +34,9 @@ STATISTIC(NumInstKilled, "Number of instructions killed"); namespace { struct VISIBILITY_HIDDEN ConstantPropagation : public FunctionPass { + static const int ID; // Pass identifcation, replacement for typeid + ConstantPropagation() : FunctionPass((intptr_t)&ID) {} + bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { @@ -41,6 +44,7 @@ namespace { } }; + const int ConstantPropagation::ID = 0; RegisterPass<ConstantPropagation> X("constprop", "Simple constant propagation"); } diff --git a/lib/Transforms/Scalar/CorrelatedExprs.cpp b/lib/Transforms/Scalar/CorrelatedExprs.cpp index d42dd9a..540f62c 100644 --- a/lib/Transforms/Scalar/CorrelatedExprs.cpp +++ b/lib/Transforms/Scalar/CorrelatedExprs.cpp @@ -225,6 +225,9 @@ namespace { std::map<BasicBlock*, RegionInfo> RegionInfoMap; ETForest *EF; public: + static const int ID; // Pass identifcation, replacement for typeid + CEE() : FunctionPass((intptr_t)&ID) {} + virtual bool runOnFunction(Function &F); // We don't modify the program, so we preserve all analyses @@ -284,6 +287,8 @@ namespace { bool SimplifyBasicBlock(BasicBlock &BB, const RegionInfo &RI); bool SimplifyInstruction(Instruction *Inst, const RegionInfo &RI); }; + + const int CEE::ID = 0; RegisterPass<CEE> X("cee", "Correlated Expression Elimination"); } diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp index 998d87c..1bfa73d 100644 --- a/lib/Transforms/Scalar/DCE.cpp +++ b/lib/Transforms/Scalar/DCE.cpp @@ -35,6 +35,8 @@ namespace { // DeadInstElimination pass implementation // struct VISIBILITY_HIDDEN DeadInstElimination : public BasicBlockPass { + static const int ID; // Pass identifcation, replacement for typeid + DeadInstElimination() : BasicBlockPass(intptr_t(&ID)) {} virtual bool runOnBasicBlock(BasicBlock &BB) { bool Changed = false; for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); ) @@ -51,6 +53,7 @@ namespace { } }; + const int DeadInstElimination::ID = 0; RegisterPass<DeadInstElimination> X("die", "Dead Instruction Elimination"); } @@ -64,6 +67,9 @@ namespace { // DeadCodeElimination pass implementation // struct DCE : public FunctionPass { + static const int ID; // Pass identifcation, replacement for typeid + DCE() : FunctionPass((intptr_t)&ID) {} + virtual bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { @@ -71,6 +77,7 @@ namespace { } }; + const int DCE::ID = 0; RegisterPass<DCE> Y("dce", "Dead Code Elimination"); } diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp index 9ebb9b4..709d168 100644 --- a/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -34,6 +34,8 @@ STATISTIC(NumOther , "Number of other instrs removed"); namespace { struct VISIBILITY_HIDDEN DSE : public FunctionPass { + static const int ID; // Pass identifcation, replacement for typeid + DSE() : FunctionPass((intptr_t)&ID) {} virtual bool runOnFunction(Function &F) { bool Changed = false; @@ -56,6 +58,7 @@ namespace { AU.addPreserved<AliasAnalysis>(); } }; + const int DSE::ID = 0; RegisterPass<DSE> X("dse", "Dead Store Elimination"); } diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp index f4727d4..bf84c93 100644 --- a/lib/Transforms/Scalar/GCSE.cpp +++ b/lib/Transforms/Scalar/GCSE.cpp @@ -37,6 +37,9 @@ STATISTIC(NumArgsRepl , "Number of function arguments replaced " "with constant values"); namespace { struct VISIBILITY_HIDDEN GCSE : public FunctionPass { + static const int ID; // Pass identifcation, replacement for typeid + GCSE() : FunctionPass((intptr_t)&ID) {} + virtual bool runOnFunction(Function &F); private: @@ -51,6 +54,7 @@ namespace { } }; + const int GCSE::ID = 0; RegisterPass<GCSE> X("gcse", "Global Common Subexpression Elimination"); } diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index aad6cc9..313f811 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -68,7 +68,10 @@ namespace { ScalarEvolution *SE; bool Changed; public: - + + static const int ID; // Pass identifcation, replacement for typeid + IndVarSimplify() : LoopPass((intptr_t)&ID) {} + bool runOnLoop(Loop *L, LPPassManager &LPM); bool doInitialization(Loop *L, LPPassManager &LPM); virtual void getAnalysisUsage(AnalysisUsage &AU) const { @@ -91,6 +94,8 @@ namespace { void DeleteTriviallyDeadInstructions(std::set<Instruction*> &Insts); }; + + const int IndVarSimplify::ID = 0; RegisterPass<IndVarSimplify> X("indvars", "Canonicalize Induction Variables"); } diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index b3496c3..c1bc47d 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -76,6 +76,9 @@ namespace { TargetData *TD; bool MustPreserveLCSSA; public: + static const int ID; // Pass identifcation, replacement for typeid + InstCombiner() : FunctionPass((intptr_t)&ID) {} + /// AddToWorkList - Add the specified instruction to the worklist if it /// isn't already in it. void AddToWorkList(Instruction *I) { @@ -358,6 +361,7 @@ namespace { Value *EvaluateInDifferentType(Value *V, const Type *Ty, bool isSigned); }; + const int InstCombiner::ID = 0; RegisterPass<InstCombiner> X("instcombine", "Combine redundant instructions"); } diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index f367973..6a16243 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/lib/Transforms/Scalar/LICM.cpp @@ -63,6 +63,9 @@ namespace { cl::desc("Disable memory promotion in LICM pass")); struct VISIBILITY_HIDDEN LICM : public LoopPass { + static const int ID; // Pass identifcation, replacement for typeid + LICM() : LoopPass((intptr_t)&ID) {} + virtual bool runOnLoop(Loop *L, LPPassManager &LPM); /// This transformation requires natural loop information & requires that @@ -201,6 +204,7 @@ namespace { std::map<Value*, AllocaInst*> &Val2AlMap); }; + const int LICM::ID = 0; RegisterPass<LICM> X("licm", "Loop Invariant Code Motion"); } diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp index b9db3f6..8abd96e 100644 --- a/lib/Transforms/Scalar/LoopRotation.cpp +++ b/lib/Transforms/Scalar/LoopRotation.cpp @@ -44,7 +44,9 @@ namespace { class VISIBILITY_HIDDEN LoopRotate : public LoopPass { public: - + static const int ID; // Pass ID, replacement for typeid + LoopRotate() : LoopPass((intptr_t)&ID) {} + // Rotate Loop L as many times as possible. Return true if // loop is rotated at least once. bool runOnLoop(Loop *L, LPPassManager &LPM); @@ -92,6 +94,7 @@ namespace { SmallVector<RenameData, MAX_HEADER_SIZE> LoopHeaderInfo; }; + const int LoopRotate::ID = 0; RegisterPass<LoopRotate> X ("loop-rotate", "Rotate Loops"); } diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 6bece9c..5f9562b 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -143,7 +143,9 @@ namespace { const TargetLowering *TLI; public: - LoopStrengthReduce(const TargetLowering *tli = NULL) : TLI(tli) { + static const int ID; // Pass ID, replacement for typeid + LoopStrengthReduce(const TargetLowering *tli = NULL) : + LoopPass((intptr_t)&ID), TLI(tli) { } bool runOnLoop(Loop *L, LPPassManager &LPM); @@ -186,6 +188,7 @@ private: Loop *L, bool isOnlyStride); void DeleteTriviallyDeadInstructions(std::set<Instruction*> &Insts); }; + const int LoopStrengthReduce::ID = 0; RegisterPass<LoopStrengthReduce> X("loop-reduce", "Loop Strength Reduction"); } diff --git a/lib/Transforms/Scalar/LoopUnroll.cpp b/lib/Transforms/Scalar/LoopUnroll.cpp index 63696025..0cdef0f 100644 --- a/lib/Transforms/Scalar/LoopUnroll.cpp +++ b/lib/Transforms/Scalar/LoopUnroll.cpp @@ -49,6 +49,9 @@ namespace { class VISIBILITY_HIDDEN LoopUnroll : public LoopPass { LoopInfo *LI; // The current loop information public: + static const int ID; // Pass ID, replacement for typeid + LoopUnroll() : LoopPass((intptr_t)&ID) {} + bool runOnLoop(Loop *L, LPPassManager &LPM); BasicBlock* FoldBlockIntoPredecessor(BasicBlock* BB); @@ -63,6 +66,7 @@ namespace { AU.addPreserved<LoopInfo>(); } }; + const int LoopUnroll::ID = 0; RegisterPass<LoopUnroll> X("loop-unroll", "Unroll loops"); } diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index 77dfb90..ce459e7 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -69,6 +69,9 @@ namespace { SmallPtrSet<Value *,8> UnswitchedVals; public: + static const int ID; // Pass ID, replacement for typeid + LoopUnswitch() : LoopPass((intptr_t)&ID) {} + bool runOnLoop(Loop *L, LPPassManager &LPM); /// This transformation requires natural loop information & requires that @@ -109,6 +112,7 @@ namespace { std::vector<Instruction*> &Worklist); void RemoveLoopFromHierarchy(Loop *L); }; + const int LoopUnswitch::ID = 0; RegisterPass<LoopUnswitch> X("loop-unswitch", "Unswitch loops"); } diff --git a/lib/Transforms/Scalar/LowerGC.cpp b/lib/Transforms/Scalar/LowerGC.cpp index c10849e..93e7e85 100644 --- a/lib/Transforms/Scalar/LowerGC.cpp +++ b/lib/Transforms/Scalar/LowerGC.cpp @@ -47,7 +47,9 @@ namespace { /// had zero roots. const Type *MainRootRecordType; public: - LowerGC() : GCRootInt(0), GCReadInt(0), GCWriteInt(0), + static const int ID; // Pass identifcation, replacement for typeid + LowerGC() : FunctionPass((intptr_t)&ID), + GCRootInt(0), GCReadInt(0), GCWriteInt(0), GCRead(0), GCWrite(0), RootChain(0), MainRootRecordType(0) {} virtual bool doInitialization(Module &M); virtual bool runOnFunction(Function &F); @@ -56,6 +58,7 @@ namespace { const StructType *getRootRecordType(unsigned NumRoots); }; + const int LowerGC::ID = 0; RegisterPass<LowerGC> X("lowergc", "Lower GC intrinsics, for GCless code generators"); } diff --git a/lib/Transforms/Scalar/LowerPacked.cpp b/lib/Transforms/Scalar/LowerPacked.cpp index 10a5e60..11949db 100644 --- a/lib/Transforms/Scalar/LowerPacked.cpp +++ b/lib/Transforms/Scalar/LowerPacked.cpp @@ -40,6 +40,9 @@ namespace { class VISIBILITY_HIDDEN LowerPacked : public FunctionPass, public InstVisitor<LowerPacked> { public: + static const int ID; // Pass identifcation, replacement for typeid + LowerPacked() : FunctionPass((intptr_t)&ID) {} + /// @brief Lowers packed operations to scalar operations. /// @param F The fuction to process virtual bool runOnFunction(Function &F); @@ -104,6 +107,7 @@ private: std::vector<Instruction*> instrsToRemove; }; +const int LowerPacked::ID = 0; RegisterPass<LowerPacked> X("lower-packed", "lowers packed operations to operations on smaller packed datatypes"); diff --git a/lib/Transforms/Scalar/PredicateSimplifier.cpp b/lib/Transforms/Scalar/PredicateSimplifier.cpp index 289f9c9..ce2741b 100644 --- a/lib/Transforms/Scalar/PredicateSimplifier.cpp +++ b/lib/Transforms/Scalar/PredicateSimplifier.cpp @@ -1989,6 +1989,9 @@ namespace { std::vector<DominatorTree::Node *> WorkList; public: + static const int ID; // Pass identifcation, replacement for typeid + PredicateSimplifier() : FunctionPass((intptr_t)&ID) {} + bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { @@ -2374,6 +2377,7 @@ namespace { } } + const int PredicateSimplifier::ID = 0; RegisterPass<PredicateSimplifier> X("predsimplify", "Predicate Simplifier"); } diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp index 8030a76..a07b0fe 100644 --- a/lib/Transforms/Scalar/Reassociate.cpp +++ b/lib/Transforms/Scalar/Reassociate.cpp @@ -69,6 +69,9 @@ namespace { std::map<Value*, unsigned> ValueRankMap; bool MadeChange; public: + static const int ID; // Pass identifcation, replacement for typeid + Reassociate() : FunctionPass((intptr_t)&ID) {} + bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { @@ -89,6 +92,7 @@ namespace { void RemoveDeadBinaryOp(Value *V); }; + const int Reassociate::ID = 0; RegisterPass<Reassociate> X("reassociate", "Reassociate expressions"); } diff --git a/lib/Transforms/Scalar/Reg2Mem.cpp b/lib/Transforms/Scalar/Reg2Mem.cpp index e013ced..6abe4dc 100644 --- a/lib/Transforms/Scalar/Reg2Mem.cpp +++ b/lib/Transforms/Scalar/Reg2Mem.cpp @@ -33,6 +33,8 @@ STATISTIC(NumDemoted, "Number of registers demoted"); namespace { struct VISIBILITY_HIDDEN RegToMem : public FunctionPass { + static const int ID; // Pass identifcation, replacement for typeid + RegToMem() : FunctionPass((intptr_t)&ID) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequiredID(BreakCriticalEdgesID); @@ -76,6 +78,7 @@ namespace { } }; + const int RegToMem::ID = 0; RegisterPass<RegToMem> X("reg2mem", "Demote all values to stack slots"); } diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 16e7a8e..4ead275 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -1334,6 +1334,9 @@ namespace { /// Sparse Conditional Constant Propagator. /// struct VISIBILITY_HIDDEN SCCP : public FunctionPass { + static const int ID; // Pass identifcation, replacement for typeid + SCCP() : FunctionPass((intptr_t)&ID) {} + // runOnFunction - Run the Sparse Conditional Constant Propagation // algorithm, and return true if the function was modified. // @@ -1344,6 +1347,7 @@ namespace { } }; + const int SCCP::ID = 0; RegisterPass<SCCP> X("sccp", "Sparse Conditional Constant Propagation"); } // end anonymous namespace @@ -1443,9 +1447,12 @@ namespace { /// Constant Propagation. /// struct VISIBILITY_HIDDEN IPSCCP : public ModulePass { + static const int ID; + IPSCCP() : ModulePass((intptr_t)&ID) {} bool runOnModule(Module &M); }; + const int IPSCCP::ID = 0; RegisterPass<IPSCCP> Y("ipsccp", "Interprocedural Sparse Conditional Constant Propagation"); } // end anonymous namespace diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 71007d2..da5488b 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -47,6 +47,9 @@ STATISTIC(NumGlobals, "Number of allocas copied from constant global"); namespace { struct VISIBILITY_HIDDEN SROA : public FunctionPass { + static const int ID; // Pass identifcation, replacement for typeid + SROA() : FunctionPass((intptr_t)&ID) {} + bool runOnFunction(Function &F); bool performScalarRepl(Function &F); @@ -81,6 +84,7 @@ namespace { static Instruction *isOnlyCopiedFromConstantGlobal(AllocationInst *AI); }; + const int SROA::ID = 0; RegisterPass<SROA> X("scalarrepl", "Scalar Replacement of Aggregates"); } diff --git a/lib/Transforms/Scalar/SimplifyCFG.cpp b/lib/Transforms/Scalar/SimplifyCFG.cpp index 872232f..4a4bcb6 100644 --- a/lib/Transforms/Scalar/SimplifyCFG.cpp +++ b/lib/Transforms/Scalar/SimplifyCFG.cpp @@ -35,8 +35,12 @@ STATISTIC(NumSimpl, "Number of blocks simplified"); namespace { struct VISIBILITY_HIDDEN CFGSimplifyPass : public FunctionPass { + static const int ID; // Pass identifcation, replacement for typeid + CFGSimplifyPass() : FunctionPass((intptr_t)&ID) {} + virtual bool runOnFunction(Function &F); }; + const int CFGSimplifyPass::ID = 0; RegisterPass<CFGSimplifyPass> X("simplifycfg", "Simplify the CFG"); } diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp index 398da0a..dcd57ce 100644 --- a/lib/Transforms/Scalar/TailDuplication.cpp +++ b/lib/Transforms/Scalar/TailDuplication.cpp @@ -42,10 +42,15 @@ namespace { cl::init(6), cl::Hidden); class VISIBILITY_HIDDEN TailDup : public FunctionPass { bool runOnFunction(Function &F); + public: + static const int ID; // Pass identifcation, replacement for typeid + TailDup() : FunctionPass((intptr_t)&ID) {} + private: inline bool shouldEliminateUnconditionalBranch(TerminatorInst *TI); inline void eliminateUnconditionalBranch(BranchInst *BI); }; + const int TailDup::ID = 0; RegisterPass<TailDup> X("tailduplicate", "Tail Duplication"); } diff --git a/lib/Transforms/Scalar/TailRecursionElimination.cpp b/lib/Transforms/Scalar/TailRecursionElimination.cpp index cd3b79a..c75b930 100644 --- a/lib/Transforms/Scalar/TailRecursionElimination.cpp +++ b/lib/Transforms/Scalar/TailRecursionElimination.cpp @@ -67,6 +67,9 @@ STATISTIC(NumAccumAdded, "Number of accumulators introduced"); namespace { struct VISIBILITY_HIDDEN TailCallElim : public FunctionPass { + static const int ID; // Pass identifcation, replacement for typeid + TailCallElim() : FunctionPass((intptr_t)&ID) {} + virtual bool runOnFunction(Function &F); private: @@ -77,6 +80,7 @@ namespace { bool CanMoveAboveCall(Instruction *I, CallInst *CI); Value *CanTransformAccumulatorRecursion(Instruction *I, CallInst *CI); }; + const int TailCallElim::ID = 0; RegisterPass<TailCallElim> X("tailcallelim", "Tail Call Elimination"); } |