diff options
author | Owen Anderson <resistor@mac.com> | 2010-08-06 18:33:48 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2010-08-06 18:33:48 +0000 |
commit | 90c579de5a383cee278acc3f7e7b9d0a656e6a35 (patch) | |
tree | 3a2949af3670eddb92860ca641fab8a0e27e0e7b /include | |
parent | e26a7b5e21a49543a727b1b2524a934e73c89772 (diff) | |
download | external_llvm-90c579de5a383cee278acc3f7e7b9d0a656e6a35.zip external_llvm-90c579de5a383cee278acc3f7e7b9d0a656e6a35.tar.gz external_llvm-90c579de5a383cee278acc3f7e7b9d0a656e6a35.tar.bz2 |
Reapply r110396, with fixes to appease the Linux buildbot gods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110460 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
31 files changed, 104 insertions, 120 deletions
diff --git a/include/llvm/Analysis/DOTGraphTraitsPass.h b/include/llvm/Analysis/DOTGraphTraitsPass.h index 4828eba..d8daf51 100644 --- a/include/llvm/Analysis/DOTGraphTraitsPass.h +++ b/include/llvm/Analysis/DOTGraphTraitsPass.h @@ -22,7 +22,7 @@ template <class Analysis, bool Simple> struct DOTGraphTraitsViewer : public FunctionPass { std::string Name; - DOTGraphTraitsViewer(std::string GraphName, const void *ID) : FunctionPass(ID) { + DOTGraphTraitsViewer(std::string GraphName, char &ID) : FunctionPass(ID) { Name = GraphName; } @@ -48,7 +48,7 @@ struct DOTGraphTraitsPrinter : public FunctionPass { std::string Name; - DOTGraphTraitsPrinter(std::string GraphName, const void *ID) + DOTGraphTraitsPrinter(std::string GraphName, char &ID) : FunctionPass(ID) { Name = GraphName; } diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index f79afdd..73c6e62 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -702,7 +702,7 @@ public: static char ID; // Pass ID, replacement for typeid DominatorTreeBase<BasicBlock>* DT; - DominatorTree() : FunctionPass(&ID) { + DominatorTree() : FunctionPass(ID) { DT = new DominatorTreeBase<BasicBlock>(false); } @@ -890,7 +890,7 @@ protected: const bool IsPostDominators; public: - DominanceFrontierBase(void *ID, bool isPostDom) + DominanceFrontierBase(char &ID, bool isPostDom) : FunctionPass(ID), IsPostDominators(isPostDom) {} /// getRoots - Return the root blocks of the current CFG. This may include @@ -1009,7 +1009,7 @@ class DominanceFrontier : public DominanceFrontierBase { public: static char ID; // Pass ID, replacement for typeid DominanceFrontier() : - DominanceFrontierBase(&ID, false) {} + DominanceFrontierBase(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 1337385..8a78eb6 100644 --- a/include/llvm/Analysis/FindUsedTypes.h +++ b/include/llvm/Analysis/FindUsedTypes.h @@ -26,7 +26,7 @@ class FindUsedTypes : public ModulePass { std::set<const Type *> UsedTypes; public: static char ID; // Pass identification, replacement for typeid - FindUsedTypes() : ModulePass(&ID) {} + FindUsedTypes() : ModulePass(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 c1214e7..75a5cdf 100644 --- a/include/llvm/Analysis/IntervalPartition.h +++ b/include/llvm/Analysis/IntervalPartition.h @@ -48,7 +48,7 @@ class IntervalPartition : public FunctionPass { public: static char ID; // Pass identification, replacement for typeid - IntervalPartition() : FunctionPass(&ID), RootInterval(0) {} + IntervalPartition() : FunctionPass(ID), RootInterval(0) {} // run - Calculate the interval partition for this function virtual bool runOnFunction(Function &F); diff --git a/include/llvm/Analysis/LazyValueInfo.h b/include/llvm/Analysis/LazyValueInfo.h index f59b2e3..ac164c1 100644 --- a/include/llvm/Analysis/LazyValueInfo.h +++ b/include/llvm/Analysis/LazyValueInfo.h @@ -31,7 +31,7 @@ class LazyValueInfo : public FunctionPass { void operator=(const LazyValueInfo&); // DO NOT IMPLEMENT. public: static char ID; - LazyValueInfo() : FunctionPass(&ID), PImpl(0) {} + LazyValueInfo() : FunctionPass(ID), PImpl(0) {} ~LazyValueInfo() { assert(PImpl == 0 && "releaseMemory not called"); } /// Tristate - This is used to return true/false/dunno results. diff --git a/include/llvm/Analysis/LibCallAliasAnalysis.h b/include/llvm/Analysis/LibCallAliasAnalysis.h index 37abb77..c9adf3f 100644 --- a/include/llvm/Analysis/LibCallAliasAnalysis.h +++ b/include/llvm/Analysis/LibCallAliasAnalysis.h @@ -28,9 +28,9 @@ namespace llvm { LibCallInfo *LCI; explicit LibCallAliasAnalysis(LibCallInfo *LC = 0) - : FunctionPass(&ID), LCI(LC) { + : FunctionPass(ID), LCI(LC) { } - explicit LibCallAliasAnalysis(const void *ID, LibCallInfo *LC) + explicit LibCallAliasAnalysis(char &ID, LibCallInfo *LC) : FunctionPass(ID), LCI(LC) { } ~LibCallAliasAnalysis(); @@ -55,8 +55,8 @@ namespace llvm { /// an analysis interface through multiple inheritance. If needed, it /// should override this to adjust the this pointer as needed for the /// specified pass info. - virtual void *getAdjustedAnalysisPointer(const PassInfo *PI) { - if (PI->isPassID(&AliasAnalysis::ID)) + virtual void *getAdjustedAnalysisPointer(const void *PI) { + if (PI == &AliasAnalysis::ID) return (AliasAnalysis*)this; return this; } diff --git a/include/llvm/Analysis/LoopDependenceAnalysis.h b/include/llvm/Analysis/LoopDependenceAnalysis.h index a1a5637..94fd990 100644 --- a/include/llvm/Analysis/LoopDependenceAnalysis.h +++ b/include/llvm/Analysis/LoopDependenceAnalysis.h @@ -91,7 +91,7 @@ class LoopDependenceAnalysis : public LoopPass { public: static char ID; // Class identification, replacement for typeinfo - LoopDependenceAnalysis() : LoopPass(&ID) {} + LoopDependenceAnalysis() : LoopPass(ID) {} /// isDependencePair - Check whether two values can possibly give rise to /// a data dependence: that is the case if both are instructions accessing diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index 2e90a96..462620f 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -940,7 +940,7 @@ class LoopInfo : public FunctionPass { public: static char ID; // Pass identification, replacement for typeid - LoopInfo() : FunctionPass(&ID) {} + LoopInfo() : FunctionPass(ID) {} LoopInfoBase<BasicBlock, Loop>& getBase() { return LI; } diff --git a/include/llvm/Analysis/LoopPass.h b/include/llvm/Analysis/LoopPass.h index 6f77d01..3e1c2a9 100644 --- a/include/llvm/Analysis/LoopPass.h +++ b/include/llvm/Analysis/LoopPass.h @@ -28,8 +28,7 @@ class PMStack; class LoopPass : public Pass { public: - explicit LoopPass(intptr_t pid) : Pass(PT_Loop, pid) {} - explicit LoopPass(void *pid) : Pass(PT_Loop, pid) {} + explicit LoopPass(char &pid) : Pass(PT_Loop, pid) {} /// getPrinterPass - Get a pass to print the function corresponding /// to a Loop. diff --git a/include/llvm/Analysis/Passes.h b/include/llvm/Analysis/Passes.h index e8e7796..37425eb 100644 --- a/include/llvm/Analysis/Passes.h +++ b/include/llvm/Analysis/Passes.h @@ -92,7 +92,7 @@ namespace llvm { // file. // ModulePass *createProfileLoaderPass(); - extern const PassInfo *ProfileLoaderPassID; + extern char &ProfileLoaderPassID; //===--------------------------------------------------------------------===// // @@ -106,7 +106,7 @@ namespace llvm { // instead of loading it from a previous run. // FunctionPass *createProfileEstimatorPass(); - extern const PassInfo *ProfileEstimatorPassID; + extern char &ProfileEstimatorPassID; //===--------------------------------------------------------------------===// // diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h index 5552017..46ce820 100644 --- a/include/llvm/Analysis/PostDominators.h +++ b/include/llvm/Analysis/PostDominators.h @@ -25,7 +25,7 @@ struct PostDominatorTree : public FunctionPass { static char ID; // Pass identification, replacement for typeid DominatorTreeBase<BasicBlock>* DT; - PostDominatorTree() : FunctionPass(&ID) { + PostDominatorTree() : FunctionPass(ID) { DT = new DominatorTreeBase<BasicBlock>(true); } @@ -106,7 +106,7 @@ template <> struct GraphTraits<PostDominatorTree*> struct PostDominanceFrontier : public DominanceFrontierBase { static char ID; PostDominanceFrontier() - : DominanceFrontierBase(&ID, true) {} + : DominanceFrontierBase(ID, true) {} virtual bool runOnFunction(Function &) { Frontiers.clear(); diff --git a/include/llvm/CallGraphSCCPass.h b/include/llvm/CallGraphSCCPass.h index e11b967..5fa8b0e 100644 --- a/include/llvm/CallGraphSCCPass.h +++ b/include/llvm/CallGraphSCCPass.h @@ -33,8 +33,7 @@ class CallGraphSCC; class CallGraphSCCPass : public Pass { public: - explicit CallGraphSCCPass(intptr_t pid) : Pass(PT_CallGraphSCC, pid) {} - explicit CallGraphSCCPass(void *pid) : Pass(PT_CallGraphSCC, pid) {} + explicit CallGraphSCCPass(char &pid) : Pass(PT_CallGraphSCC, pid) {} /// createPrinterPass - Get a pass that prints the Module /// corresponding to a CallGraph. diff --git a/include/llvm/CodeGen/CalcSpillWeights.h b/include/llvm/CodeGen/CalcSpillWeights.h index 2fc03bd..e5273c5 100644 --- a/include/llvm/CodeGen/CalcSpillWeights.h +++ b/include/llvm/CodeGen/CalcSpillWeights.h @@ -23,7 +23,7 @@ namespace llvm { public: static char ID; - CalculateSpillWeights() : MachineFunctionPass(&ID) {} + CalculateSpillWeights() : MachineFunctionPass(ID) {} virtual void getAnalysisUsage(AnalysisUsage &au) const; diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h index 8a59bf1..b154bf1 100644 --- a/include/llvm/CodeGen/LiveIntervalAnalysis.h +++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h @@ -68,7 +68,7 @@ namespace llvm { public: static char ID; // Pass identification, replacement for typeid - LiveIntervals() : MachineFunctionPass(&ID) {} + LiveIntervals() : MachineFunctionPass(ID) {} // Calculate the spill weight to assign to a single instruction. static float getSpillWeight(bool isDef, bool isUse, unsigned loopDepth); diff --git a/include/llvm/CodeGen/LiveStackAnalysis.h b/include/llvm/CodeGen/LiveStackAnalysis.h index c6af6a1..ad984db 100644 --- a/include/llvm/CodeGen/LiveStackAnalysis.h +++ b/include/llvm/CodeGen/LiveStackAnalysis.h @@ -39,7 +39,7 @@ namespace llvm { public: static char ID; // Pass identification, replacement for typeid - LiveStacks() : MachineFunctionPass(&ID) {} + LiveStacks() : MachineFunctionPass(ID) {} typedef SS2IntervalMap::iterator iterator; typedef SS2IntervalMap::const_iterator const_iterator; diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h index fc5ea6f..c8182e0 100644 --- a/include/llvm/CodeGen/LiveVariables.h +++ b/include/llvm/CodeGen/LiveVariables.h @@ -46,7 +46,7 @@ class TargetRegisterInfo; class LiveVariables : public MachineFunctionPass { public: static char ID; // Pass identification, replacement for typeid - LiveVariables() : MachineFunctionPass(&ID) {} + LiveVariables() : MachineFunctionPass(ID) {} /// VarInfo - This represents the regions where a virtual register is live in /// the program. We represent this with three different pieces of diff --git a/include/llvm/CodeGen/MachineFunctionPass.h b/include/llvm/CodeGen/MachineFunctionPass.h index 685e868..b7bf0a3 100644 --- a/include/llvm/CodeGen/MachineFunctionPass.h +++ b/include/llvm/CodeGen/MachineFunctionPass.h @@ -31,8 +31,7 @@ class MachineFunction; /// override runOnMachineFunction. class MachineFunctionPass : public FunctionPass { protected: - explicit MachineFunctionPass(intptr_t ID) : FunctionPass(ID) {} - explicit MachineFunctionPass(void *ID) : FunctionPass(ID) {} + explicit MachineFunctionPass(char &ID) : FunctionPass(ID) {} /// runOnMachineFunction - This method must be overloaded to perform the /// desired machine code transformation or analysis. diff --git a/include/llvm/CodeGen/MachineLoopInfo.h b/include/llvm/CodeGen/MachineLoopInfo.h index 3b3e31e..9760eba 100644 --- a/include/llvm/CodeGen/MachineLoopInfo.h +++ b/include/llvm/CodeGen/MachineLoopInfo.h @@ -67,7 +67,7 @@ class MachineLoopInfo : public MachineFunctionPass { public: static char ID; // Pass identification, replacement for typeid - MachineLoopInfo() : MachineFunctionPass(&ID) {} + MachineLoopInfo() : MachineFunctionPass(ID) {} LoopInfoBase<MachineBasicBlock, MachineLoop>& getBase() { return LI; } diff --git a/include/llvm/CodeGen/Passes.h b/include/llvm/CodeGen/Passes.h index 0fcdf7a..8e107cc 100644 --- a/include/llvm/CodeGen/Passes.h +++ b/include/llvm/CodeGen/Passes.h @@ -43,18 +43,18 @@ namespace llvm { /// MachineLoopInfo pass - This pass is a loop analysis pass. /// - extern const PassInfo *const MachineLoopInfoID; + extern char &MachineLoopInfoID; /// MachineDominators pass - This pass is a machine dominators analysis pass. /// - extern const PassInfo *const MachineDominatorsID; + extern char &MachineDominatorsID; /// PHIElimination pass - This pass eliminates machine instruction PHI nodes /// by inserting copy instructions. This destroys SSA information, but is the /// desired input for some register allocators. This pass is "required" by /// these register allocator like this: AU.addRequiredID(PHIEliminationID); /// - extern const PassInfo *const PHIEliminationID; + extern char &PHIEliminationID; /// StrongPHIElimination pass - This pass eliminates machine instruction PHI /// nodes by inserting copy instructions. This destroys SSA information, but @@ -62,23 +62,23 @@ namespace llvm { /// "required" by these register allocator like this: /// AU.addRequiredID(PHIEliminationID); /// This pass is still in development - extern const PassInfo *const StrongPHIEliminationID; + extern char &StrongPHIEliminationID; - extern const PassInfo *const PreAllocSplittingID; + extern char &PreAllocSplittingID; /// SimpleRegisterCoalescing pass. Aggressively coalesces every register /// copy it can. /// - extern const PassInfo *const SimpleRegisterCoalescingID; + extern char &SimpleRegisterCoalescingID; /// TwoAddressInstruction pass - This pass reduces two-address instructions to /// use two operands. This destroys SSA information but it is desired by /// register allocators. - extern const PassInfo *const TwoAddressInstructionPassID; + extern char &TwoAddressInstructionPassID; /// UnreachableMachineBlockElimination pass - This pass removes unreachable /// machine basic blocks. - extern const PassInfo *const UnreachableMachineBlockElimID; + extern char &UnreachableMachineBlockElimID; /// DeadMachineInstructionElim pass - This pass removes dead machine /// instructions. diff --git a/include/llvm/CodeGen/ProcessImplicitDefs.h b/include/llvm/CodeGen/ProcessImplicitDefs.h index 30477b9..1d743c1 100644 --- a/include/llvm/CodeGen/ProcessImplicitDefs.h +++ b/include/llvm/CodeGen/ProcessImplicitDefs.h @@ -31,7 +31,7 @@ namespace llvm { public: static char ID; - ProcessImplicitDefs() : MachineFunctionPass(&ID) {} + ProcessImplicitDefs() : MachineFunctionPass(ID) {} virtual void getAnalysisUsage(AnalysisUsage &au) const; diff --git a/include/llvm/CodeGen/SlotIndexes.h b/include/llvm/CodeGen/SlotIndexes.h index f150d85..fe3b0e2 100644 --- a/include/llvm/CodeGen/SlotIndexes.h +++ b/include/llvm/CodeGen/SlotIndexes.h @@ -475,7 +475,7 @@ namespace llvm { public: static char ID; - SlotIndexes() : MachineFunctionPass(&ID), indexListHead(0) {} + SlotIndexes() : MachineFunctionPass(ID), indexListHead(0) {} virtual void getAnalysisUsage(AnalysisUsage &au) const; virtual void releaseMemory(); diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index 5a58931..e5c073c 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -50,7 +50,7 @@ class raw_ostream; class StringRef; // AnalysisID - Use the PassInfo to identify a pass... -typedef const PassInfo* AnalysisID; +typedef const void* AnalysisID; /// Different types of internal pass managers. External pass managers /// (PassManager and FunctionPassManager) are not represented here. @@ -82,14 +82,13 @@ enum PassKind { /// class Pass { AnalysisResolver *Resolver; // Used to resolve analysis - intptr_t PassID; + const void *PassID; PassKind Kind; void operator=(const Pass&); // DO NOT IMPLEMENT Pass(const Pass &); // DO NOT IMPLEMENT public: - explicit Pass(PassKind K, intptr_t pid); - explicit Pass(PassKind K, const void *pid); + explicit Pass(PassKind K, char &pid); virtual ~Pass(); @@ -101,10 +100,10 @@ public: /// virtual const char *getPassName() const; - /// getPassInfo - Return the PassInfo data structure that corresponds to this - /// pass... If the pass has not been registered, this will return null. - /// - const PassInfo *getPassInfo() const; + /// getPassID - Return the PassID number that corresponds to this pass. + virtual AnalysisID getPassID() const { + return PassID; + } /// print - Print out the internal state of the pass. This is called by /// Analyze to print out the contents of an analysis. Otherwise it is not @@ -159,7 +158,7 @@ public: /// an analysis interface through multiple inheritance. If needed, it should /// override this to adjust the this pointer as needed for the specified pass /// info. - virtual void *getAdjustedAnalysisPointer(const PassInfo *); + virtual void *getAdjustedAnalysisPointer(AnalysisID ID); virtual ImmutablePass *getAsImmutablePass(); virtual PMDataManager *getAsPMDataManager(); @@ -170,14 +169,9 @@ public: // dumpPassStructure - Implement the -debug-passes=PassStructure option virtual void dumpPassStructure(unsigned Offset = 0); - template<typename AnalysisClass> - static const PassInfo *getClassPassInfo() { - 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(intptr_t TI); + static const PassInfo *lookupPassInfo(const void *TI); // lookupPassInfo - Return the pass info object for the pass with the given // argument string, or null if it is not known. @@ -200,7 +194,7 @@ public: /// don't have the class name available (use getAnalysisIfAvailable if you /// do), but it can tell you if you need to preserve the pass at least. /// - bool mustPreserveAnalysisID(const PassInfo *AnalysisID) const; + bool mustPreserveAnalysisID(char &AID) const; /// getAnalysis<AnalysisType>() - This function is used by subclasses to get /// to the analysis information that they claim to use by overriding the @@ -213,10 +207,10 @@ public: AnalysisType &getAnalysis(Function &F); // Defined in PassAnalysisSupport.h template<typename AnalysisType> - AnalysisType &getAnalysisID(const PassInfo *PI) const; + AnalysisType &getAnalysisID(AnalysisID PI) const; template<typename AnalysisType> - AnalysisType &getAnalysisID(const PassInfo *PI, Function &F); + AnalysisType &getAnalysisID(AnalysisID PI, Function &F); }; @@ -240,8 +234,7 @@ public: /// Return what kind of Pass Manager can manage this pass. virtual PassManagerType getPotentialPassManagerType() const; - explicit ModulePass(intptr_t pid) : Pass(PT_Module, pid) {} - explicit ModulePass(const void *pid) : Pass(PT_Module, pid) {} + explicit ModulePass(char &pid) : Pass(PT_Module, pid) {} // Force out-of-line virtual method. virtual ~ModulePass(); }; @@ -268,8 +261,7 @@ public: /// bool runOnModule(Module &) { return false; } - explicit ImmutablePass(intptr_t pid) : ModulePass(pid) {} - explicit ImmutablePass(const void *pid) + explicit ImmutablePass(char &pid) : ModulePass(pid) {} // Force out-of-line virtual method. @@ -287,8 +279,7 @@ public: /// class FunctionPass : public Pass { public: - explicit FunctionPass(intptr_t pid) : Pass(PT_Function, pid) {} - explicit FunctionPass(const void *pid) : Pass(PT_Function, pid) {} + explicit FunctionPass(char &pid) : Pass(PT_Function, pid) {} /// createPrinterPass - Get a function printer pass. Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const; @@ -340,8 +331,7 @@ public: /// class BasicBlockPass : public Pass { public: - explicit BasicBlockPass(intptr_t pid) : Pass(PT_BasicBlock, pid) {} - explicit BasicBlockPass(const void *pid) : Pass(PT_BasicBlock, pid) {} + explicit BasicBlockPass(char &pid) : Pass(PT_BasicBlock, pid) {} /// createPrinterPass - Get a function printer pass. Pass *createPrinterPass(raw_ostream &O, const std::string &Banner) const; diff --git a/include/llvm/PassAnalysisSupport.h b/include/llvm/PassAnalysisSupport.h index 977d4f4..a99a1ae 100644 --- a/include/llvm/PassAnalysisSupport.h +++ b/include/llvm/PassAnalysisSupport.h @@ -49,34 +49,37 @@ public: // addRequired - Add the specified ID to the required set of the usage info // for a pass. // - AnalysisUsage &addRequiredID(AnalysisID ID); + AnalysisUsage &addRequiredID(const void *ID); + AnalysisUsage &addRequiredID(char &ID); template<class PassClass> AnalysisUsage &addRequired() { - return addRequiredID(Pass::getClassPassInfo<PassClass>()); + return addRequiredID(PassClass::ID); } - AnalysisUsage &addRequiredTransitiveID(AnalysisID ID); + AnalysisUsage &addRequiredTransitiveID(char &ID); template<class PassClass> AnalysisUsage &addRequiredTransitive() { - AnalysisID ID = Pass::getClassPassInfo<PassClass>(); - return addRequiredTransitiveID(ID); + return addRequiredTransitiveID(PassClass::ID); } // addPreserved - Add the specified ID to the set of analyses preserved by // this pass // - AnalysisUsage &addPreservedID(AnalysisID ID) { + AnalysisUsage &addPreservedID(const void *ID) { Preserved.push_back(ID); return *this; } + AnalysisUsage &addPreservedID(char &ID) { + Preserved.push_back(&ID); + return *this; + } // addPreserved - Add the specified Pass class to the set of analyses // preserved by this pass. // template<class PassClass> AnalysisUsage &addPreserved() { - assert(Pass::getClassPassInfo<PassClass>() && "Pass class not registered!"); - Preserved.push_back(Pass::getClassPassInfo<PassClass>()); + Preserved.push_back(&PassClass::ID); return *this; } @@ -85,12 +88,7 @@ public: // This can be useful when a pass is trivially preserved, but may not be // linked in. Be careful about spelling! // - AnalysisUsage &addPreserved(StringRef Arg) { - const PassInfo *PI = Pass::lookupPassInfo(Arg); - // If the pass exists, preserve it. Otherwise silently do nothing. - if (PI) Preserved.push_back(PI); - return *this; - } + AnalysisUsage &addPreserved(StringRef Arg); // setPreservesAll - Set by analyses that do not transform their input at all void setPreservesAll() { PreservesAll = true; } @@ -130,7 +128,7 @@ public: inline PMDataManager &getPMDataManager() { return PM; } // Find pass that is implementing PI. - Pass *findImplPass(const PassInfo *PI) { + Pass *findImplPass(AnalysisID PI) { Pass *ResultPass = 0; for (unsigned i = 0; i < AnalysisImpls.size() ; ++i) { if (AnalysisImpls[i].first == PI) { @@ -142,10 +140,10 @@ public: } // Find pass that is implementing PI. Initialize pass for Function F. - Pass *findImplPass(Pass *P, const PassInfo *PI, Function &F); + Pass *findImplPass(Pass *P, AnalysisID PI, Function &F); - void addAnalysisImplsPair(const PassInfo *PI, Pass *P) { - std::pair<const PassInfo*, Pass*> pir = std::make_pair(PI,P); + void addAnalysisImplsPair(AnalysisID PI, Pass *P) { + std::pair<AnalysisID, Pass*> pir = std::make_pair(PI,P); AnalysisImpls.push_back(pir); } @@ -160,7 +158,7 @@ public: // AnalysisImpls - This keeps track of which passes implements the interfaces // that are required by the current pass (to implement getAnalysis()). - std::vector<std::pair<const PassInfo*, Pass*> > AnalysisImpls; + std::vector<std::pair<AnalysisID, Pass*> > AnalysisImpls; private: // PassManager that is used to resolve analysis info @@ -179,8 +177,7 @@ template<typename AnalysisType> AnalysisType *Pass::getAnalysisIfAvailable() const { assert(Resolver && "Pass not resident in a PassManager object!"); - const PassInfo *PI = getClassPassInfo<AnalysisType>(); - if (PI == 0) return 0; + const void *PI = &AnalysisType::ID; Pass *ResultPass = Resolver->getAnalysisIfAvailable(PI, true); if (ResultPass == 0) return 0; @@ -199,11 +196,11 @@ AnalysisType *Pass::getAnalysisIfAvailable() const { template<typename AnalysisType> AnalysisType &Pass::getAnalysis() const { assert(Resolver && "Pass has not been inserted into a PassManager object!"); - return getAnalysisID<AnalysisType>(getClassPassInfo<AnalysisType>()); + return getAnalysisID<AnalysisType>(&AnalysisType::ID); } template<typename AnalysisType> -AnalysisType &Pass::getAnalysisID(const PassInfo *PI) const { +AnalysisType &Pass::getAnalysisID(AnalysisID PI) const { assert(PI && "getAnalysis for unregistered pass!"); assert(Resolver&&"Pass has not been inserted into a PassManager object!"); // PI *must* appear in AnalysisImpls. Because the number of passes used @@ -229,11 +226,11 @@ template<typename AnalysisType> AnalysisType &Pass::getAnalysis(Function &F) { assert(Resolver &&"Pass has not been inserted into a PassManager object!"); - return getAnalysisID<AnalysisType>(getClassPassInfo<AnalysisType>(), F); + return getAnalysisID<AnalysisType>(&AnalysisType::ID, F); } template<typename AnalysisType> -AnalysisType &Pass::getAnalysisID(const PassInfo *PI, Function &F) { +AnalysisType &Pass::getAnalysisID(AnalysisID PI, Function &F) { assert(PI && "getAnalysis for unregistered pass!"); assert(Resolver && "Pass has not been inserted into a PassManager object!"); // PI *must* appear in AnalysisImpls. Because the number of passes used diff --git a/include/llvm/PassManagers.h b/include/llvm/PassManagers.h index 81b7e7a..1f9b982 100644 --- a/include/llvm/PassManagers.h +++ b/include/llvm/PassManagers.h @@ -302,7 +302,7 @@ public: /// through getAnalysis interface. virtual void addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass); - virtual Pass *getOnTheFlyPass(Pass *P, const PassInfo *PI, Function &F); + virtual Pass *getOnTheFlyPass(Pass *P, AnalysisID PI, Function &F); /// Initialize available analysis information. void initializeAnalysisInfo() { @@ -414,7 +414,7 @@ class FPPassManager : public ModulePass, public PMDataManager { public: static char ID; explicit FPPassManager(int Depth) - : ModulePass(&ID), PMDataManager(Depth) { } + : ModulePass(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/PassRegistry.h b/include/llvm/PassRegistry.h index 193ecfd..5907139 100644 --- a/include/llvm/PassRegistry.h +++ b/include/llvm/PassRegistry.h @@ -34,7 +34,7 @@ class PassRegistry { mutable sys::SmartMutex<true> Lock; /// PassInfoMap - Keep track of the PassInfo object for each registered pass. - typedef std::map<intptr_t, const PassInfo*> MapType; + typedef std::map<const void*, const PassInfo*> MapType; MapType PassInfoMap; typedef StringMap<const PassInfo*> StringMapType; @@ -51,14 +51,14 @@ class PassRegistry { public: static PassRegistry *getPassRegistry(); - const PassInfo *getPassInfo(intptr_t TI) const; + const PassInfo *getPassInfo(const void *TI) const; const PassInfo *getPassInfo(StringRef Arg) const; void registerPass(const PassInfo &PI); void unregisterPass(const PassInfo &PI); /// Analysis Group Mechanisms. - void registerAnalysisGroup(intptr_t InterfaceID, intptr_t PassID, + void registerAnalysisGroup(const void *InterfaceID, const void *PassID, PassInfo& Registeree, bool isDefault); void enumerateWith(PassRegistrationListener *L); diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h index 07dc7f1..ee98713 100644 --- a/include/llvm/PassSupport.h +++ b/include/llvm/PassSupport.h @@ -41,7 +41,7 @@ public: private: const char *const PassName; // Nice name for Pass const char *const PassArgument; // Command Line argument to run this pass - const intptr_t PassID; + const void *PassID; const bool IsCFGOnlyPass; // Pass only looks at the CFG. const bool IsAnalysis; // True if an analysis pass. const bool IsAnalysisGroup; // True if an analysis group. @@ -52,7 +52,7 @@ private: public: /// PassInfo ctor - Do not call this directly, this should only be invoked /// through RegisterPass. - PassInfo(const char *name, const char *arg, intptr_t pi, + PassInfo(const char *name, const char *arg, const void *pi, NormalCtor_t normal = 0, bool isCFGOnly = false, bool is_analysis = false) : PassName(name), PassArgument(arg), PassID(pi), @@ -63,7 +63,7 @@ public: /// PassInfo ctor - Do not call this directly, this should only be invoked /// through RegisterPass. This version is for use by analysis groups; it /// does not auto-register the pass. - PassInfo(const char *name, intptr_t pi) + PassInfo(const char *name, const void *pi) : PassName(name), PassArgument(""), PassID(pi), IsCFGOnlyPass(false), IsAnalysis(false), IsAnalysisGroup(true), NormalCtor(0) { @@ -81,11 +81,11 @@ public: /// getTypeInfo - Return the id object for the pass... /// TODO : Rename - intptr_t getTypeInfo() const { return PassID; } + const void *getTypeInfo() const { return PassID; } /// Return true if this PassID implements the specified ID pointer. - bool isPassID(void *IDPtr) const { - return PassID == (intptr_t)IDPtr; + bool isPassID(const void *IDPtr) const { + return PassID == IDPtr; } /// isAnalysisGroup - Return true if this is an analysis group, not a normal @@ -161,7 +161,7 @@ struct RegisterPass : public PassInfo { // Register Pass using default constructor... RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false, bool is_analysis = false) - : PassInfo(Name, PassArg, intptr_t(&passName::ID), + : PassInfo(Name, PassArg, &passName::ID, PassInfo::NormalCtor_t(callDefaultCtor<passName>), CFGOnly, is_analysis) { @@ -191,8 +191,8 @@ struct RegisterPass : public PassInfo { class RegisterAGBase : public PassInfo { protected: RegisterAGBase(const char *Name, - intptr_t InterfaceID, - intptr_t PassID = 0, + const void *InterfaceID, + const void *PassID = 0, bool isDefault = false); }; @@ -200,12 +200,12 @@ template<typename Interface, bool Default = false> struct RegisterAnalysisGroup : public RegisterAGBase { explicit RegisterAnalysisGroup(PassInfo &RPB) : RegisterAGBase(RPB.getPassName(), - intptr_t(&Interface::ID), RPB.getTypeInfo(), + &Interface::ID, RPB.getTypeInfo(), Default) { } explicit RegisterAnalysisGroup(const char *Name) - : RegisterAGBase(Name, intptr_t(&Interface::ID)) { + : RegisterAGBase(Name, &Interface::ID) { } }; diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h index cc88dae..f72461f 100644 --- a/include/llvm/Target/TargetData.h +++ b/include/llvm/Target/TargetData.h @@ -110,7 +110,7 @@ public: /// Constructs a TargetData from a specification string. See init(). explicit TargetData(StringRef TargetDescription) - : ImmutablePass(&ID) { + : ImmutablePass(ID) { init(TargetDescription); } @@ -118,7 +118,7 @@ public: explicit TargetData(const Module *M); TargetData(const TargetData &TD) : - ImmutablePass(&ID), + ImmutablePass(ID), LittleEndian(TD.isLittleEndian()), PointerMemSize(TD.PointerMemSize), PointerABIAlign(TD.PointerABIAlign), diff --git a/include/llvm/Transforms/IPO/InlinerPass.h b/include/llvm/Transforms/IPO/InlinerPass.h index 6af7ed7..3ac4c59 100644 --- a/include/llvm/Transforms/IPO/InlinerPass.h +++ b/include/llvm/Transforms/IPO/InlinerPass.h @@ -30,8 +30,8 @@ namespace llvm { /// perform the inlining operations that do not depend on the policy. /// struct Inliner : public CallGraphSCCPass { - explicit Inliner(void *ID); - explicit Inliner(void *ID, int Threshold); + explicit Inliner(char &ID); + explicit Inliner(char &ID, int Threshold); /// getAnalysisUsage - For this class, we declare that we require and preserve /// the call graph. If the derived class implements this method, it should diff --git a/include/llvm/Transforms/Scalar.h b/include/llvm/Transforms/Scalar.h index 4d1d863..bd5b169 100644 --- a/include/llvm/Transforms/Scalar.h +++ b/include/llvm/Transforms/Scalar.h @@ -149,7 +149,7 @@ Pass *createLoopIndexSplitPass(); // ret i32 %Y // FunctionPass *createPromoteMemoryToRegisterPass(); -extern const PassInfo *const PromoteMemoryToRegisterID; +extern char &PromoteMemoryToRegisterID; //===----------------------------------------------------------------------===// // @@ -158,7 +158,7 @@ extern const PassInfo *const PromoteMemoryToRegisterID; // hacking easier. // FunctionPass *createDemoteRegisterToMemoryPass(); -extern const PassInfo *const DemoteRegisterToMemoryID; +extern char &DemoteRegisterToMemoryID; //===----------------------------------------------------------------------===// // @@ -202,7 +202,7 @@ FunctionPass *createCFGSimplificationPass(); // (set, immediate dominators, tree, and frontier) information. // FunctionPass *createBreakCriticalEdgesPass(); -extern const PassInfo *const BreakCriticalEdgesID; +extern char &BreakCriticalEdgesID; //===----------------------------------------------------------------------===// // @@ -213,7 +213,7 @@ extern const PassInfo *const BreakCriticalEdgesID; // AU.addRequiredID(LoopSimplifyID); // Pass *createLoopSimplifyPass(); -extern const PassInfo *const LoopSimplifyID; +extern char &LoopSimplifyID; //===----------------------------------------------------------------------===// // @@ -228,7 +228,7 @@ FunctionPass *createTailCallEliminationPass(); // chained binary branch instructions. // FunctionPass *createLowerSwitchPass(); -extern const PassInfo *const LowerSwitchID; +extern char &LowerSwitchID; //===----------------------------------------------------------------------===// // @@ -243,7 +243,7 @@ extern const PassInfo *const LowerSwitchID; FunctionPass *createLowerInvokePass(const TargetLowering *TLI = 0); FunctionPass *createLowerInvokePass(const TargetLowering *TLI, bool useExpensiveEHSupport); -extern const PassInfo *const LowerInvokePassID; +extern char &LowerInvokePassID; //===----------------------------------------------------------------------===// // @@ -258,7 +258,7 @@ FunctionPass *createBlockPlacementPass(); // optimizations. // Pass *createLCSSAPass(); -extern const PassInfo *const LCSSAID; +extern char &LCSSAID; //===----------------------------------------------------------------------===// // @@ -304,7 +304,7 @@ FunctionPass *createCodeGenPreparePass(const TargetLowering *TLI = 0); // InstructionNamer - Give any unnamed non-void instructions "tmp" names. // FunctionPass *createInstructionNamerPass(); -extern const PassInfo *const InstructionNamerID; +extern char &InstructionNamerID; //===----------------------------------------------------------------------===// // diff --git a/include/llvm/Transforms/Utils/SSI.h b/include/llvm/Transforms/Utils/SSI.h index 198fc82..864e119 100644 --- a/include/llvm/Transforms/Utils/SSI.h +++ b/include/llvm/Transforms/Utils/SSI.h @@ -39,7 +39,7 @@ namespace llvm { public: static char ID; // Pass identification, replacement for typeid. SSI() : - FunctionPass(&ID) { + FunctionPass(ID) { } void getAnalysisUsage(AnalysisUsage &AU) const; diff --git a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h index c2d0993..a5060e6 100644 --- a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h +++ b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h @@ -26,7 +26,7 @@ struct UnifyFunctionExitNodes : public FunctionPass { BasicBlock *ReturnBlock, *UnwindBlock, *UnreachableBlock; public: static char ID; // Pass identification, replacement for typeid - UnifyFunctionExitNodes() : FunctionPass(&ID), + UnifyFunctionExitNodes() : FunctionPass(ID), ReturnBlock(0), UnwindBlock(0) {} // We can preserve non-critical-edgeness when we unify function exit nodes |