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 /include | |
parent | e50fb9ac174b791047ffa8648443ab94b2097cd9 (diff) |
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 'include')
26 files changed, 112 insertions, 44 deletions
diff --git a/include/llvm/Analysis/AliasAnalysis.h b/include/llvm/Analysis/AliasAnalysis.h index f91403acb9..d61c886e7c 100644 --- a/include/llvm/Analysis/AliasAnalysis.h +++ b/include/llvm/Analysis/AliasAnalysis.h @@ -61,6 +61,7 @@ protected: virtual void getAnalysisUsage(AnalysisUsage &AU) const; public: + static const int ID; // Class identification, replacement for typeinfo AliasAnalysis() : TD(0), AA(0) {} virtual ~AliasAnalysis(); // We want to be subclassed diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h index 24effd8d49..cd27e318cd 100644 --- a/include/llvm/Analysis/CallGraph.h +++ b/include/llvm/Analysis/CallGraph.h @@ -73,6 +73,7 @@ protected: FunctionMapTy FunctionMap; // Map from a function to its node public: + static const int ID; // Class identification, replacement for typeinfo //===--------------------------------------------------------------------- // Accessors... // diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 45eed7fcda..b172b792fc 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -42,9 +42,10 @@ class DominatorBase : public FunctionPass { protected: std::vector<BasicBlock*> Roots; const bool IsPostDominators; - - inline DominatorBase(bool isPostDom) : Roots(), IsPostDominators(isPostDom) {} + inline DominatorBase(intptr_t ID, bool isPostDom) : + FunctionPass(ID), Roots(), IsPostDominators(isPostDom) {} public: + /// getRoots - Return the root blocks of the current CFG. This may include /// multiple blocks if we are computing post dominators. For forward /// dominators, this will always be a single block (the entry node). @@ -135,7 +136,8 @@ public: }; public: - DominatorTreeBase(bool isPostDom) : DominatorBase(isPostDom) {} + DominatorTreeBase(intptr_t ID, bool isPostDom) + : DominatorBase(ID, isPostDom) {} ~DominatorTreeBase() { reset(); } virtual void releaseMemory() { reset(); } @@ -206,7 +208,8 @@ public: /// class DominatorTree : public DominatorTreeBase { public: - DominatorTree() : DominatorTreeBase(false) {} + static const int ID; // Pass ID, replacement for typeid + DominatorTree() : DominatorTreeBase((intptr_t)&ID, false) {} BasicBlock *getRoot() const { assert(Roots.size() == 1 && "Should always have entry node!"); @@ -264,8 +267,9 @@ template <> struct GraphTraits<DominatorTree*> /// class ETForestBase : public DominatorBase { public: - ETForestBase(bool isPostDom) : DominatorBase(isPostDom), Nodes(), - DFSInfoValid(false), SlowQueries(0) {} + ETForestBase(intptr_t ID, bool isPostDom) + : DominatorBase(ID, isPostDom), Nodes(), + DFSInfoValid(false), SlowQueries(0) {} virtual void releaseMemory() { reset(); } @@ -395,7 +399,9 @@ protected: class ETForest : public ETForestBase { public: - ETForest() : ETForestBase(false) {} + static const int ID; // Pass identifcation, replacement for typeid + + ETForest() : ETForestBase((intptr_t)&ID, false) {} BasicBlock *getRoot() const { assert(Roots.size() == 1 && "Should always have entry node!"); @@ -425,7 +431,8 @@ public: protected: DomSetMapType Frontiers; public: - DominanceFrontierBase(bool isPostDom) : DominatorBase(isPostDom) {} + DominanceFrontierBase(intptr_t ID, bool isPostDom) + : DominatorBase(ID, isPostDom) {} virtual void releaseMemory() { Frontiers.clear(); } @@ -470,7 +477,9 @@ public: /// class DominanceFrontier : public DominanceFrontierBase { public: - DominanceFrontier() : DominanceFrontierBase(false) {} + static const int ID; // Pass ID, replacement for typeid + DominanceFrontier() : + DominanceFrontierBase((intptr_t)& ID, false) {} BasicBlock *getRoot() const { assert(Roots.size() == 1 && "Should always have entry node!"); diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h index 008e30c93e..de892f1b9c 100644 --- a/include/llvm/Analysis/FindUsedTypes.h +++ b/include/llvm/Analysis/FindUsedTypes.h @@ -24,6 +24,9 @@ class Type; class FindUsedTypes : public ModulePass { std::set<const Type *> UsedTypes; public: + static const int ID; // Pass identifcation, replacement for typeid + FindUsedTypes() : ModulePass((intptr_t)&ID) {} + /// getTypes - After the pass has been run, return the set containing all of /// the types used in the module. /// diff --git a/include/llvm/Analysis/IntervalPartition.h b/include/llvm/Analysis/IntervalPartition.h index bd998e81de..07f054b131 100644 --- a/include/llvm/Analysis/IntervalPartition.h +++ b/include/llvm/Analysis/IntervalPartition.h @@ -45,7 +45,9 @@ class IntervalPartition : public FunctionPass { std::vector<Interval*> Intervals; public: - IntervalPartition() : RootInterval(0) {} + static const int ID; // Pass identifcation, replacement for typeid + + IntervalPartition() : FunctionPass((intptr_t)&ID), RootInterval(0) {} // run - Calculate the interval partition for this function virtual bool runOnFunction(Function &F); diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index 62f19e3c29..8e38c07a47 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -241,6 +241,9 @@ class LoopInfo : public FunctionPass { std::vector<Loop*> TopLevelLoops; friend class Loop; public: + static const int ID; // Pass identifcation, replacement for typeid + + LoopInfo() : FunctionPass((intptr_t)&ID) {} ~LoopInfo() { releaseMemory(); } /// iterator/begin/end - The interface to the top-level loops in the current diff --git a/include/llvm/Analysis/LoopPass.h b/include/llvm/Analysis/LoopPass.h index 4163a09d33..24e61435ff 100644 --- a/include/llvm/Analysis/LoopPass.h +++ b/include/llvm/Analysis/LoopPass.h @@ -29,6 +29,8 @@ class Function; class LoopPass : public Pass { public: + LoopPass(intptr_t pid) : Pass(pid) {} + // runOnLoop - THis method should be implemented by the subclass to perform // whatever action is necessary for the specfied Loop. virtual bool runOnLoop (Loop *L, LPPassManager &LPM) = 0; @@ -66,6 +68,7 @@ class LoopPass : public Pass { class LPPassManager : public FunctionPass, public PMDataManager { public: + static const int ID; LPPassManager(int Depth); /// run - Execute all of the passes scheduled for execution. Keep track of diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h index 359f19daf8..793c7f4889 100644 --- a/include/llvm/Analysis/PostDominators.h +++ b/include/llvm/Analysis/PostDominators.h @@ -22,7 +22,10 @@ namespace llvm { /// compute the a post-dominator tree. /// struct PostDominatorTree : public DominatorTreeBase { - PostDominatorTree() : DominatorTreeBase(true) {} + static const int ID; // Pass identifcation, replacement for typeid + + PostDominatorTree() : + DominatorTreeBase((intptr_t)&ID, true) {} virtual bool runOnFunction(Function &F) { reset(); // Reset from the last time we were run... @@ -51,7 +54,8 @@ private: /// PostETForest Class - Concrete subclass of ETForestBase that is used to /// compute a forwards post-dominator ET-Forest. struct PostETForest : public ETForestBase { - PostETForest() : ETForestBase(true) {} + static const int ID; + PostETForest() : ETForestBase((intptr_t)&ID, true) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); @@ -75,7 +79,9 @@ struct PostETForest : public ETForestBase { /// used to compute the a post-dominance frontier. /// struct PostDominanceFrontier : public DominanceFrontierBase { - PostDominanceFrontier() : DominanceFrontierBase(true) {} + static const int ID; + PostDominanceFrontier() + : DominanceFrontierBase((intptr_t) &ID, true) {} virtual bool runOnFunction(Function &) { Frontiers.clear(); diff --git a/include/llvm/Analysis/ProfileInfo.h b/include/llvm/Analysis/ProfileInfo.h index 88b2ea1c8c..dc17ac1664 100644 --- a/include/llvm/Analysis/ProfileInfo.h +++ b/include/llvm/Analysis/ProfileInfo.h @@ -38,6 +38,7 @@ namespace llvm { // entered. std::map<std::pair<BasicBlock*, BasicBlock*>, unsigned> EdgeCounts; public: + static const int ID; // Class identification, replacement for typeinfo virtual ~ProfileInfo(); // We want to be subclassed //===------------------------------------------------------------------===// diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index 27d7e04a3e..6b05714358 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -197,7 +197,8 @@ namespace llvm { class ScalarEvolution : public FunctionPass { void *Impl; // ScalarEvolution uses the pimpl pattern public: - ScalarEvolution() : Impl(0) {} + static const int ID; // Pass identifcation, replacement for typeid + ScalarEvolution() : FunctionPass((intptr_t)&ID), Impl(0) {} /// getSCEV - Return a SCEV expression handle for the full generality of the /// specified expression. diff --git a/include/llvm/Analysis/ValueNumbering.h b/include/llvm/Analysis/ValueNumbering.h index f708f48382..9d1aeb564d 100644 --- a/include/llvm/Analysis/ValueNumbering.h +++ b/include/llvm/Analysis/ValueNumbering.h @@ -29,6 +29,7 @@ class Value; class Instruction; struct ValueNumbering { + static const int ID; // Class identification, replacement for typeinfo virtual ~ValueNumbering(); // We want to be subclassed /// getEqualNumberNodes - Return nodes with the same value number as the diff --git a/include/llvm/Assembly/PrintModulePass.h b/include/llvm/Assembly/PrintModulePass.h index cc9bca9288..4da55484ee 100644 --- a/include/llvm/Assembly/PrintModulePass.h +++ b/include/llvm/Assembly/PrintModulePass.h @@ -28,9 +28,10 @@ class PrintModulePass : public ModulePass { OStream *Out; // ostream to print on bool DeleteStream; // Delete the ostream in our dtor? public: - PrintModulePass() : Out(&cerr), DeleteStream(false) {} + static const int ID; + PrintModulePass() : ModulePass((intptr_t)&ID), Out(&cerr), DeleteStream(false) {} PrintModulePass(OStream *o, bool DS = false) - : Out(o), DeleteStream(DS) {} + : ModulePass((intptr_t)&ID), Out(o), DeleteStream(DS) {} ~PrintModulePass() { if (DeleteStream) delete Out; @@ -51,10 +52,12 @@ class PrintFunctionPass : public FunctionPass { OStream *Out; // ostream to print on bool DeleteStream; // Delete the ostream in our dtor? public: - PrintFunctionPass() : Banner(""), Out(&cerr), DeleteStream(false) {} + static const int ID; + PrintFunctionPass() : FunctionPass((intptr_t)&ID), Banner(""), Out(&cerr), + DeleteStream(false) {} PrintFunctionPass(const std::string &B, OStream *o = &cout, bool DS = false) - : Banner(B), Out(o), DeleteStream(DS) {} + : FunctionPass((intptr_t)&ID), Banner(B), Out(o), DeleteStream(DS) {} inline ~PrintFunctionPass() { if (DeleteStream) delete Out; diff --git a/include/llvm/Bytecode/WriteBytecodePass.h b/include/llvm/Bytecode/WriteBytecodePass.h index b0155e4ddf..5c21ccded5 100644 --- a/include/llvm/Bytecode/WriteBytecodePass.h +++ b/include/llvm/Bytecode/WriteBytecodePass.h @@ -26,10 +26,12 @@ class WriteBytecodePass : public ModulePass { bool DeleteStream; bool CompressFile; public: + static const int ID; // Pass identifcation, replacement for typeid WriteBytecodePass() - : Out(&cout), DeleteStream(false), CompressFile(false) {} + : ModulePass((intptr_t) &ID), Out(&cout), DeleteStream(false), + CompressFile(false) {} WriteBytecodePass(OStream *o, bool DS = false, bool CF = false) - : Out(o), DeleteStream(DS), CompressFile(CF) {} + : ModulePass((intptr_t) &ID), Out(o), DeleteStream(DS), CompressFile(CF) {} inline ~WriteBytecodePass() { if (DeleteStream) delete Out; diff --git a/include/llvm/CallGraphSCCPass.h b/include/llvm/CallGraphSCCPass.h index af5cb849a3..90894c280c 100644 --- a/include/llvm/CallGraphSCCPass.h +++ b/include/llvm/CallGraphSCCPass.h @@ -31,6 +31,8 @@ class PMStack; struct CallGraphSCCPass : public Pass { + CallGraphSCCPass(intptr_t pid) : Pass(pid) {} + /// doInitialization - This method is called before the SCC's of the program /// has been processed, allowing the pass to do initialization as necessary. virtual bool doInitialization(CallGraph &CG) { diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h index 024001e9d6..3a5418d937 100644 --- a/include/llvm/CodeGen/AsmPrinter.h +++ b/include/llvm/CodeGen/AsmPrinter.h @@ -34,6 +34,8 @@ namespace llvm { /// AsmPrinter - This class is intended to be used as a driving class for all /// asm writers. class AsmPrinter : public MachineFunctionPass { + static const int ID; + /// FunctionNumber - This provides a unique ID for each function emitted in /// this translation unit. It is autoincremented by SetupMachineFunction, /// and can be accessed with getFunctionNumber() and diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h index a42471d631..3ea0272425 100644 --- a/include/llvm/CodeGen/LiveIntervalAnalysis.h +++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h @@ -65,6 +65,9 @@ namespace llvm { BitVector JoinedLIs; public: + static const int ID; // Pass identifcation, replacement for typeid + LiveIntervals() : MachineFunctionPass((intptr_t)&ID) {} + struct CopyRec { MachineInstr *MI; unsigned SrcReg, DstReg; diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h index ebbe610ed0..ce377cd2cf 100644 --- a/include/llvm/CodeGen/LiveVariables.h +++ b/include/llvm/CodeGen/LiveVariables.h @@ -40,6 +40,9 @@ class MRegisterInfo; class LiveVariables : public MachineFunctionPass { public: + static const int ID; // Pass identifcation, replacement for typeid + LiveVariables() : MachineFunctionPass((intptr_t)&ID) {} + /// VarInfo - This represents the regions where a virtual register is live in /// the program. We represent this with three different pieces of /// information: the instruction that uniquely defines the value, the set of diff --git a/include/llvm/CodeGen/MachineFunctionPass.h b/include/llvm/CodeGen/MachineFunctionPass.h index 77af52a347..7429e7b96c 100644 --- a/include/llvm/CodeGen/MachineFunctionPass.h +++ b/include/llvm/CodeGen/MachineFunctionPass.h @@ -26,6 +26,8 @@ namespace llvm { struct MachineFunctionPass : public FunctionPass { + MachineFunctionPass(intptr_t ID) : FunctionPass(ID) {} + /// runOnMachineFunction - This method must be overloaded to perform the /// desired machine code transformation or analysis. /// diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h index 28201dcfdc..c23916def9 100644 --- a/include/llvm/CodeGen/MachineModuleInfo.h +++ b/include/llvm/CodeGen/MachineModuleInfo.h @@ -1022,6 +1022,8 @@ private: std::vector<GlobalVariable *> TypeInfos; public: + static const int ID; // Pass identifcation, replacement for typeid + MachineModuleInfo(); ~MachineModuleInfo(); diff --git a/include/llvm/CodeGen/SelectionDAGISel.h b/include/llvm/CodeGen/SelectionDAGISel.h index 9d5b059759..f363daf9e4 100644 --- a/include/llvm/CodeGen/SelectionDAGISel.h +++ b/include/llvm/CodeGen/SelectionDAGISel.h @@ -41,8 +41,10 @@ public: MachineBasicBlock *BB; std::vector<SDNode*> TopOrder; unsigned DAGSize; + static const int ID; - explicit SelectionDAGISel(TargetLowering &tli) : TLI(tli), DAGSize(0) {} + explicit SelectionDAGISel(TargetLowering &tli) : + FunctionPass((intptr_t)&ID), TLI(tli), DAGSize(0) {} TargetLowering &getTargetLowering() { return TLI; } diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index 1ab6ff9a72..d678df6430 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -34,8 +34,8 @@ #include <deque> #include <map> #include <iosfwd> -#include <typeinfo> #include <cassert> +#include <stdint.h> namespace llvm { @@ -77,7 +77,7 @@ typedef enum PassManagerType PassManagerType; /// class Pass { AnalysisResolver *Resolver; // Used to resolve analysis - const PassInfo *PassInfoCache; + intptr_t PassID; // AnalysisImpls - This keeps track of which passes implement the interfaces // that are required by the current pass (to implement getAnalysis()). @@ -87,7 +87,7 @@ class Pass { void operator=(const Pass&); // DO NOT IMPLEMENT Pass(const Pass &); // DO NOT IMPLEMENT public: - Pass() : Resolver(0), PassInfoCache(0) {} + Pass(intptr_t pid) : Resolver(0), PassID(pid) {} virtual ~Pass(); /// getPassName - Return a nice clean name for a pass. This usually @@ -163,12 +163,12 @@ public: template<typename AnalysisClass> static const PassInfo *getClassPassInfo() { - return lookupPassInfo(typeid(AnalysisClass)); + return lookupPassInfo((intptr_t)&AnalysisClass::ID); } // lookupPassInfo - Return the pass info object for the specified pass class, // or null if it is not known. - static const PassInfo *lookupPassInfo(const std::type_info &TI); + static const PassInfo *lookupPassInfo(intptr_t TI); /// getAnalysisToUpdate<AnalysisType>() - This function is used by subclasses /// to get to the analysis information that might be around that needs to be @@ -232,6 +232,7 @@ public: return PMT_ModulePassManager; } + ModulePass(intptr_t pid) : Pass(pid) {} // Force out-of-line virtual method. virtual ~ModulePass(); }; @@ -256,6 +257,7 @@ public: /// virtual bool runOnModule(Module &M) { return false; } + ImmutablePass(intptr_t pid) : ModulePass(pid) {} // Force out-of-line virtual method. virtual ~ImmutablePass(); }; @@ -271,6 +273,8 @@ public: /// class FunctionPass : public Pass { public: + FunctionPass(intptr_t pid) : Pass(pid) {} + /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. /// @@ -320,6 +324,8 @@ public: /// class BasicBlockPass : public Pass { public: + BasicBlockPass(intptr_t pid) : Pass(pid) {} + /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. /// diff --git a/include/llvm/PassManagers.h b/include/llvm/PassManagers.h index 29912b140d..81e89a7ff5 100644 --- a/include/llvm/PassManagers.h +++ b/include/llvm/PassManagers.h @@ -336,7 +336,9 @@ private: class FPPassManager : public ModulePass, public PMDataManager { public: - explicit FPPassManager(int Depth) : PMDataManager(Depth) { } + static const int ID; + explicit FPPassManager(int Depth) + : ModulePass((intptr_t)&ID), PMDataManager(Depth) { } /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h index 7c3c4a9d66..f594d45f15 100644 --- a/include/llvm/PassSupport.h +++ b/include/llvm/PassSupport.h @@ -37,19 +37,19 @@ class TargetMachine; class PassInfo { const char *PassName; // Nice name for Pass const char *PassArgument; // Command Line argument to run this pass - const std::type_info &TypeInfo; // type_info object for this Pass class + intptr_t PassID; bool IsCFGOnlyPass; // Pass only looks at the CFG. bool IsAnalysisGroup; // True if an analysis group. std::vector<const PassInfo*> ItfImpl;// Interfaces implemented by this pass - Pass *(*NormalCtor)(); // No argument ctor + Pass *(*NormalCtor)(); public: /// PassInfo ctor - Do not call this directly, this should only be invoked /// through RegisterPass. - PassInfo(const char *name, const char *arg, const std::type_info &ti, + PassInfo(const char *name, const char *arg, intptr_t pi, Pass *(*normal)() = 0, bool isCFGOnly = false) - : PassName(name), PassArgument(arg), TypeInfo(ti), + : PassName(name), PassArgument(arg), PassID(pi), IsCFGOnlyPass(isCFGOnly), IsAnalysisGroup(false), NormalCtor(normal) { } @@ -65,8 +65,8 @@ public: const char *getPassArgument() const { return PassArgument; } /// getTypeInfo - Return the type_info object for the pass... - /// - const std::type_info &getTypeInfo() const { return TypeInfo; } + /// TODO : Rename + intptr_t getTypeInfo() const { return PassID; } /// isAnalysisGroup - Return true if this is an analysis group, not a normal /// pass. @@ -139,12 +139,12 @@ struct RegisterPassBase { typedef Pass* (*NormalCtor_t)(); - RegisterPassBase(const char *Name, const char *Arg, const std::type_info &TI, + RegisterPassBase(const char *Name, const char *Arg, intptr_t TI, NormalCtor_t NormalCtor = 0, bool CFGOnly = false) : PIObj(Name, Arg, TI, NormalCtor, CFGOnly) { registerPass(); } - RegisterPassBase(const std::type_info &TI) + RegisterPassBase(intptr_t TI) : PIObj("", "", TI) { // This ctor may only be used for analysis groups: it does not auto-register // the pass. @@ -165,7 +165,7 @@ struct RegisterPass : public RegisterPassBase { // Register Pass using default constructor... RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false) - : RegisterPassBase(Name, PassArg, typeid(PassName), + : RegisterPassBase(Name, PassArg, (intptr_t)&PassName::ID, (RegisterPassBase::NormalCtor_t)callDefaultCtor<PassName>, CFGOnly) { } }; @@ -195,8 +195,8 @@ class RegisterAGBase : public RegisterPassBase { const PassInfo *ImplementationInfo; bool isDefaultImplementation; protected: - explicit RegisterAGBase(const std::type_info &Interface, - const std::type_info *Pass = 0, + explicit RegisterAGBase(intptr_t InterfaceID, + intptr_t PassID = 0, bool isDefault = false); void setGroupName(const char *Name); }; @@ -204,12 +204,12 @@ protected: template<typename Interface, bool Default = false> struct RegisterAnalysisGroup : public RegisterAGBase { explicit RegisterAnalysisGroup(RegisterPassBase &RPB) - : RegisterAGBase(typeid(Interface), &RPB.getPassInfo()->getTypeInfo(), + : RegisterAGBase((intptr_t) &Interface::ID, RPB.getPassInfo()->getTypeInfo(), Default) { } explicit RegisterAnalysisGroup(const char *Name) - : RegisterAGBase(typeid(Interface)) { + : RegisterAGBase((intptr_t) &Interface::ID) { setGroupName(Name); } }; diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h index 4e330e862d..bfc41b1640 100644 --- a/include/llvm/Target/TargetData.h +++ b/include/llvm/Target/TargetData.h @@ -108,14 +108,15 @@ public: /// /// @note This has to exist, because this is a pass, but it should never be /// used. - TargetData() { + TargetData() : ImmutablePass((intptr_t)&ID) { assert(0 && "ERROR: Bad TargetData ctor used. " "Tool did not specify a TargetData to use?"); abort(); } /// Constructs a TargetData from a specification string. See init(). - TargetData(const std::string &TargetDescription) { + TargetData(const std::string &TargetDescription) + : ImmutablePass((intptr_t)&ID) { init(TargetDescription); } @@ -123,7 +124,7 @@ public: TargetData(const Module *M); TargetData(const TargetData &TD) : - ImmutablePass(), + ImmutablePass((intptr_t)&ID), LittleEndian(TD.isLittleEndian()), PointerMemSize(TD.PointerMemSize), PointerABIAlign(TD.PointerABIAlign), @@ -200,6 +201,8 @@ public: /// specified global, returned in log form. This includes an explicitly /// requested alignment (if the global has one). unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const; + + static const int ID; // Pass identifcation, replacement for typeid }; /// StructLayout - used to lazily calculate structure layout information for a diff --git a/include/llvm/Transforms/RSProfiling.h b/include/llvm/Transforms/RSProfiling.h index 2df2932f29..900d147f7d 100644 --- a/include/llvm/Transforms/RSProfiling.h +++ b/include/llvm/Transforms/RSProfiling.h @@ -23,6 +23,9 @@ namespace llvm { /// this interface are expected to chain to other implementations, such that /// multiple profilers can be support simultaniously. struct RSProfilers : public ModulePass { + static const int ID; // Pass identification, replacement for typeinfo + RSProfilers() : ModulePass((intptr_t)&ID) {} + /// isProfiling - This method returns true if the value passed it was /// inserted by the profiler. virtual bool isProfiling(Value* v) = 0; diff --git a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h index 526851ba44..c120acce6b 100644 --- a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h +++ b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h @@ -25,7 +25,9 @@ namespace llvm { struct UnifyFunctionExitNodes : public FunctionPass { BasicBlock *ReturnBlock, *UnwindBlock, *UnreachableBlock; public: - UnifyFunctionExitNodes() : ReturnBlock(0), UnwindBlock(0) {} + static const int ID; // Pass identifcation, replacement for typeid + UnifyFunctionExitNodes() : FunctionPass((intptr_t)&ID), + ReturnBlock(0), UnwindBlock(0) {} // We can preserve non-critical-edgeness when we unify function exit nodes virtual void getAnalysisUsage(AnalysisUsage &AU) const; |