diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Pass.h | 39 | ||||
-rw-r--r-- | include/llvm/PassAnalysisSupport.h | 36 | ||||
-rw-r--r-- | include/llvm/PassManager.h | 68 |
3 files changed, 4 insertions, 139 deletions
diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index e70dfc1c9a..6ecaf06057 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -36,9 +36,6 @@ #include <typeinfo> #include <cassert> -//Use new Pass Manager. Disable old Pass Manager. -//#define USE_OLD_PASSMANAGER 1 - namespace llvm { class Value; @@ -52,7 +49,6 @@ template<class Trait> class PassManagerT; class BasicBlockPassManager; class FunctionPassManagerT; class ModulePassManager; -struct AnalysisResolver; class AnalysisResolver_New; // AnalysisID - Use the PassInfo to identify a pass... @@ -64,8 +60,6 @@ typedef const PassInfo* AnalysisID; /// constrained passes described below. /// class Pass { - friend struct AnalysisResolver; - AnalysisResolver *Resolver; // AnalysisResolver this pass is owned by... AnalysisResolver_New *Resolver_New; // Used to resolve analysis const PassInfo *PassInfoCache; @@ -77,7 +71,7 @@ class Pass { void operator=(const Pass&); // DO NOT IMPLEMENT Pass(const Pass &); // DO NOT IMPLEMENT public: - Pass() : Resolver(0), Resolver_New(0), PassInfoCache(0) {} + Pass() : Resolver_New(0), PassInfoCache(0) {} virtual ~Pass() {} // Destructor is virtual so we can be subclassed /// getPassName - Return a nice clean name for a pass. This usually @@ -204,12 +198,8 @@ public: virtual bool runPass(Module &M) { return runOnModule(M); } virtual bool runPass(BasicBlock&) { return false; } -#ifdef USE_OLD_PASSMANAGER - virtual void addToPassManager(ModulePassManager *PM, AnalysisUsage &AU); -#else // Force out-of-line virtual method. virtual ~ModulePass(); -#endif }; @@ -232,15 +222,8 @@ public: /// virtual bool runOnModule(Module &M) { return false; } -#ifdef USE_OLD_PASSMANAGER -private: - template<typename Trait> friend class PassManagerT; - friend class ModulePassManager; - virtual void addToPassManager(ModulePassManager *PM, AnalysisUsage &AU); -#else // Force out-of-line virtual method. virtual ~ImmutablePass(); -#endif }; //===----------------------------------------------------------------------===// @@ -280,15 +263,6 @@ public: /// bool run(Function &F); -#ifdef USE_OLD_PASSMANAGER -protected: - template<typename Trait> friend class PassManagerT; - friend class ModulePassManager; - friend class FunctionPassManagerT; - friend class BasicBlockPassManager; - virtual void addToPassManager(ModulePassManager *PM, AnalysisUsage &AU); - virtual void addToPassManager(FunctionPassManagerT *PM, AnalysisUsage &AU); -#endif }; @@ -342,17 +316,6 @@ public: virtual bool runPass(Module &M) { return false; } virtual bool runPass(BasicBlock &BB); -#ifdef USE_OLD_PASSMANAGER -private: - template<typename Trait> friend class PassManagerT; - friend class FunctionPassManagerT; - friend class BasicBlockPassManager; - virtual void addToPassManager(ModulePassManager *PM, AnalysisUsage &AU) { - FunctionPass::addToPassManager(PM, AU); - } - virtual void addToPassManager(FunctionPassManagerT *PM, AnalysisUsage &AU); - virtual void addToPassManager(BasicBlockPassManager *PM,AnalysisUsage &AU); -#endif }; /// If the user specifies the -time-passes argument on an LLVM tool command line diff --git a/include/llvm/PassAnalysisSupport.h b/include/llvm/PassAnalysisSupport.h index 7dbaa89369..f591400d27 100644 --- a/include/llvm/PassAnalysisSupport.h +++ b/include/llvm/PassAnalysisSupport.h @@ -175,8 +175,6 @@ struct AnalysisResolver { void startPass(Pass *P) {} void endPass(Pass *P) {} -protected: - void setAnalysisResolver(Pass *P, AnalysisResolver *AR); }; /// getAnalysisToUpdate<AnalysisType>() - This function is used by subclasses @@ -189,19 +187,12 @@ protected: /// template<typename AnalysisType> AnalysisType *Pass::getAnalysisToUpdate() const { -#ifdef USE_OLD_PASSMANAGER - assert(Resolver && "Pass not resident in a PassManager object!"); -#else assert(Resolver_New && "Pass not resident in a PassManager object!"); -#endif + const PassInfo *PI = getClassPassInfo<AnalysisType>(); if (PI == 0) return 0; -#ifdef USE_OLD_PASSMANAGER - return dynamic_cast<AnalysisType*>(Resolver->getAnalysisToUpdate(PI)); -#else return dynamic_cast<AnalysisType*> (Resolver_New->getAnalysisToUpdate(PI, true)); -#endif } /// getAnalysis<AnalysisType>() - This function is used by subclasses to get @@ -210,34 +201,14 @@ AnalysisType *Pass::getAnalysisToUpdate() const { /// template<typename AnalysisType> AnalysisType &Pass::getAnalysis() const { -#ifdef USE_OLD_PASSMANAGER - assert(Resolver && "Pass has not been inserted into a PassManager object!"); -#else - assert(Resolver_New&&"Pass has not been inserted into a PassManager object!"); -#endif + assert(Resolver_New &&"Pass has not been inserted into a PassManager object!"); + return getAnalysisID<AnalysisType>(getClassPassInfo<AnalysisType>()); } template<typename AnalysisType> AnalysisType &Pass::getAnalysisID(const PassInfo *PI) const { assert(PI && "getAnalysis for unregistered pass!"); -#ifdef USE_OLD_PASSMANAGER - assert(Resolver && "Pass has not been inserted into a PassManager object!"); - - // PI *must* appear in AnalysisImpls. Because the number of passes used - // should be a small number, we just do a linear search over a (dense) - // vector. - Pass *ResultPass = 0; - for (unsigned i = 0; ; ++i) { - assert(i != AnalysisImpls.size() && - "getAnalysis*() called on an analysis that was not " - "'required' by pass!"); - if (AnalysisImpls[i].first == PI) { - ResultPass = AnalysisImpls[i].second; - break; - } - } -#else assert(Resolver_New&&"Pass has not been inserted into a PassManager object!"); // PI *must* appear in AnalysisImpls. Because the number of passes used // should be a small number, we just do a linear search over a (dense) @@ -247,7 +218,6 @@ AnalysisType &Pass::getAnalysisID(const PassInfo *PI) const { "getAnalysis*() called on an analysis that was not " "'required' by pass!"); -#endif // Because the AnalysisType may not be a subclass of pass (for // AnalysisGroups), we must use dynamic_cast here to potentially adjust the // return pointer (because the class may multiply inherit, once from pass, diff --git a/include/llvm/PassManager.h b/include/llvm/PassManager.h index 21ef01698f..f1178e07d3 100644 --- a/include/llvm/PassManager.h +++ b/include/llvm/PassManager.h @@ -26,72 +26,6 @@ class ModulePass; class Module; class ModuleProvider; -#ifdef USE_OLD_PASSMANAGER - -class ModulePassManager; -class FunctionPassManagerT; -class BasicBlockPassManager; - -class PassManager { - ModulePassManager *PM; // This is a straightforward Pimpl class -public: - PassManager(); - ~PassManager(); - - /// add - Add a pass to the queue of passes to run. This passes ownership of - /// the Pass to the PassManager. When the PassManager is destroyed, the pass - /// will be destroyed as well, so there is no need to delete the pass. This - /// implies that all passes MUST be allocated with 'new'. - /// - void add(Pass *P); - - /// 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. - /// - bool run(Module &M); -}; - -class FunctionPass; -class ImmutablePass; -class Function; - -class FunctionPassManager { - FunctionPassManagerT *PM; // This is a straightforward Pimpl class - ModuleProvider *MP; -public: - FunctionPassManager(ModuleProvider *P); - ~FunctionPassManager(); - - /// add - Add a pass to the queue of passes to run. This passes - /// ownership of the FunctionPass to the PassManager. When the - /// PassManager is destroyed, the pass will be destroyed as well, so - /// there is no need to delete the pass. This implies that all - /// passes MUST be allocated with 'new'. - /// - void add(FunctionPass *P); - - /// add - ImmutablePasses are not FunctionPasses, so we have a - /// special hack to get them into a FunctionPassManager. - /// - void add(ImmutablePass *IP); - - /// doInitialization - Run all of the initializers for the function passes. - /// - bool doInitialization(); - - /// run - Execute all of the passes scheduled for execution. Keep - /// track of whether any of the passes modifies the function, and if - /// so, return true. - /// - bool run(Function &F); - - /// doFinalization - Run all of the initializers for the function passes. - /// - bool doFinalization(); -}; - -#else - class ModulePassManager; class PassManagerImpl; class FunctionPassManagerImpl; @@ -155,8 +89,6 @@ private: ModuleProvider *MP; }; -#endif - } // End llvm namespace #endif |