diff --git a/include/llvm/Analysis/LoopPass.h b/include/llvm/Analysis/LoopPass.h index dd9480f0aa8..4163a09d333 100644 --- a/include/llvm/Analysis/LoopPass.h +++ b/include/llvm/Analysis/LoopPass.h @@ -57,6 +57,10 @@ class LoopPass : public Pass { virtual void assignPassManager(PMStack &PMS, PassManagerType PMT = PMT_LoopPassManager); + /// Return what kind of Pass Manager can manage this pass. + virtual PassManagerType getPotentialPassManagerType() const { + return PMT_LoopPassManager; + } }; class LPPassManager : public FunctionPass, public PMDataManager { diff --git a/include/llvm/CallGraphSCCPass.h b/include/llvm/CallGraphSCCPass.h index f68e44774bc..af5cb849a38 100644 --- a/include/llvm/CallGraphSCCPass.h +++ b/include/llvm/CallGraphSCCPass.h @@ -54,6 +54,11 @@ struct CallGraphSCCPass : public Pass { virtual void assignPassManager(PMStack &PMS, PassManagerType PMT = PMT_CallGraphPassManager); + /// Return what kind of Pass Manager can manage this pass. + virtual PassManagerType getPotentialPassManagerType() const { + return PMT_CallGraphPassManager; + } + /// getAnalysisUsage - For this class, we declare that we require and preserve /// the call graph. If the derived class implements this method, it should /// always explicitly call the implementation here. diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index 30ddede85fb..cef45011cec 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -126,6 +126,11 @@ public: PassManagerType T = PMT_Unknown) {} /// Check if available pass managers are suitable for this pass or not. virtual void preparePassManager(PMStack &PMS) {} + + /// Return what kind of Pass Manager can manage this pass. + virtual PassManagerType getPotentialPassManagerType() const { + return PMT_Unknown; + } // Access AnalysisResolver inline void setResolver(AnalysisResolver *AR) { Resolver = AR; } @@ -193,7 +198,7 @@ public: template AnalysisType &getAnalysisID(const PassInfo *PI) const; - + }; inline std::ostream &operator<<(std::ostream &OS, const Pass &P) { @@ -216,6 +221,12 @@ public: virtual void assignPassManager(PMStack &PMS, PassManagerType T = PMT_ModulePassManager); + + /// Return what kind of Pass Manager can manage this pass. + virtual PassManagerType getPotentialPassManagerType() const { + return PMT_ModulePassManager; + } + // Force out-of-line virtual method. virtual ~ModulePass(); }; @@ -283,6 +294,11 @@ public: virtual void assignPassManager(PMStack &PMS, PassManagerType T = PMT_FunctionPassManager); + + /// Return what kind of Pass Manager can manage this pass. + virtual PassManagerType getPotentialPassManagerType() const { + return PMT_FunctionPassManager; + } }; @@ -338,6 +354,11 @@ public: virtual void assignPassManager(PMStack &PMS, PassManagerType T = PMT_BasicBlockPassManager); + + /// Return what kind of Pass Manager can manage this pass. + virtual PassManagerType getPotentialPassManagerType() const { + return PMT_BasicBlockPassManager; + } }; /// PMStack