diff options
author | Devang Patel <dpatel@apple.com> | 2008-03-19 21:56:59 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2008-03-19 21:56:59 +0000 |
commit | c758209153ca0f6da6737f25ada269c573fba456 (patch) | |
tree | 88b334fb5710b2d63089bdb840135dc1e8f7ebfa /include/llvm | |
parent | 7925ed05d0245aca0b0b2ea8d8a0b35b77c5ebd4 (diff) | |
download | external_llvm-c758209153ca0f6da6737f25ada269c573fba456.zip external_llvm-c758209153ca0f6da6737f25ada269c573fba456.tar.gz external_llvm-c758209153ca0f6da6737f25ada269c573fba456.tar.bz2 |
PassInfo keep tracks whether a pass is an analysis pass or not.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48554 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Analysis/Dominators.h | 4 | ||||
-rw-r--r-- | include/llvm/Analysis/FindUsedTypes.h | 2 | ||||
-rw-r--r-- | include/llvm/Analysis/IntervalPartition.h | 2 | ||||
-rw-r--r-- | include/llvm/Analysis/LoopInfo.h | 5 | ||||
-rw-r--r-- | include/llvm/Analysis/LoopPass.h | 2 | ||||
-rw-r--r-- | include/llvm/Analysis/MemoryDependenceAnalysis.h | 2 | ||||
-rw-r--r-- | include/llvm/Analysis/PostDominators.h | 2 | ||||
-rw-r--r-- | include/llvm/Analysis/ScalarEvolution.h | 2 | ||||
-rw-r--r-- | include/llvm/CallGraphSCCPass.h | 2 | ||||
-rw-r--r-- | include/llvm/Pass.h | 28 | ||||
-rw-r--r-- | include/llvm/PassSupport.h | 18 |
11 files changed, 37 insertions, 32 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 1b7fa75..ce305d5 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -664,7 +664,7 @@ public: static char ID; // Pass ID, replacement for typeid DominatorTreeBase<BasicBlock>* DT; - DominatorTree() : FunctionPass(intptr_t(&ID), true) { + DominatorTree() : FunctionPass(intptr_t(&ID)) { DT = new DominatorTreeBase<BasicBlock>(false); } @@ -837,7 +837,7 @@ protected: public: DominanceFrontierBase(intptr_t ID, bool isPostDom) - : FunctionPass(ID, true), IsPostDominators(isPostDom) {} + : FunctionPass(ID), IsPostDominators(isPostDom) {} /// getRoots - Return the root blocks of the current CFG. This may include /// multiple blocks if we are computing post dominators. For forward diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h index 6a128c8..b0d38c5 100644 --- a/include/llvm/Analysis/FindUsedTypes.h +++ b/include/llvm/Analysis/FindUsedTypes.h @@ -25,7 +25,7 @@ class FindUsedTypes : public ModulePass { std::set<const Type *> UsedTypes; public: static char ID; // Pass identification, replacement for typeid - FindUsedTypes() : ModulePass((intptr_t)&ID, true) {} + 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 42d27fe..8b85e7c 100644 --- a/include/llvm/Analysis/IntervalPartition.h +++ b/include/llvm/Analysis/IntervalPartition.h @@ -47,7 +47,7 @@ class IntervalPartition : public FunctionPass { public: static char ID; // Pass identification, replacement for typeid - IntervalPartition() : FunctionPass((intptr_t)&ID, true), RootInterval(0) {} + 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 cc2b10e..ab7cb7e 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -879,7 +879,7 @@ class LoopInfo : public FunctionPass { public: static char ID; // Pass identification, replacement for typeid - LoopInfo() : FunctionPass(intptr_t(&ID), true) { + LoopInfo() : FunctionPass(intptr_t(&ID)) { LI = new LoopInfoBase<BasicBlock>(); } @@ -919,6 +919,9 @@ public: return LI->isLoopHeader(BB); } + /// isAnalysis - Return true if this pass is implementing an analysis pass. + bool isAnalysis() const { return true; } + /// runOnFunction - Calculate the natural loop information. /// virtual bool runOnFunction(Function &F); diff --git a/include/llvm/Analysis/LoopPass.h b/include/llvm/Analysis/LoopPass.h index 8ebbbaf..c0cdce2 100644 --- a/include/llvm/Analysis/LoopPass.h +++ b/include/llvm/Analysis/LoopPass.h @@ -29,7 +29,7 @@ class PMStack; class LoopPass : public Pass { public: - explicit LoopPass(intptr_t pid, bool AP = false) : Pass(pid, AP) {} + explicit 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. diff --git a/include/llvm/Analysis/MemoryDependenceAnalysis.h b/include/llvm/Analysis/MemoryDependenceAnalysis.h index c683a6b..c6ef41f 100644 --- a/include/llvm/Analysis/MemoryDependenceAnalysis.h +++ b/include/llvm/Analysis/MemoryDependenceAnalysis.h @@ -66,7 +66,7 @@ class MemoryDependenceAnalysis : public FunctionPass { static Instruction* const Dirty; static char ID; // Class identification, replacement for typeinfo - MemoryDependenceAnalysis() : FunctionPass((intptr_t)&ID, true) {} + MemoryDependenceAnalysis() : FunctionPass((intptr_t)&ID) {} /// Pass Implementation stuff. This doesn't do any analysis. /// diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h index f20f050..07910e9 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((intptr_t)&ID, true) { + PostDominatorTree() : FunctionPass((intptr_t)&ID) { DT = new DominatorTreeBase<BasicBlock>(true); } diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index 5894d8c..4d9d5e5 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -192,7 +192,7 @@ namespace llvm { void *Impl; // ScalarEvolution uses the pimpl pattern public: static char ID; // Pass identification, replacement for typeid - ScalarEvolution() : FunctionPass((intptr_t)&ID, true), Impl(0) {} + 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/CallGraphSCCPass.h b/include/llvm/CallGraphSCCPass.h index f2190e6..2600505 100644 --- a/include/llvm/CallGraphSCCPass.h +++ b/include/llvm/CallGraphSCCPass.h @@ -31,7 +31,7 @@ class PMStack; struct CallGraphSCCPass : public Pass { - explicit CallGraphSCCPass(intptr_t pid, bool AP = false) : Pass(pid, AP) {} + explicit 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. diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h index 07355da..a0ffcde 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -73,7 +73,6 @@ enum PassManagerType { class Pass { AnalysisResolver *Resolver; // Used to resolve analysis intptr_t PassID; - bool isAnalysisPass; // True if this pass is an analysis pass. // AnalysisImpls - This keeps track of which passes implement the interfaces // that are required by the current pass (to implement getAnalysis()). // @@ -82,14 +81,11 @@ class Pass { void operator=(const Pass&); // DO NOT IMPLEMENT Pass(const Pass &); // DO NOT IMPLEMENT public: - explicit Pass(intptr_t pid, bool AP = false) : Resolver(0), PassID(pid), - isAnalysisPass(AP) {} - explicit Pass(const void *pid, bool AP = false) : Resolver(0), - PassID((intptr_t)pid), - isAnalysisPass(AP) {} + explicit Pass(intptr_t pid) : Resolver(0), PassID(pid) {} + explicit Pass(const void *pid) : Resolver(0), + PassID((intptr_t)pid) {} virtual ~Pass(); - bool isAnalysis() const { return isAnalysisPass; } /// getPassName - Return a nice clean name for a pass. This usually /// implemented in terms of the name that is registered by one of the /// Registration templates, but can be overloaded directly. @@ -231,8 +227,8 @@ public: return PMT_ModulePassManager; } - explicit ModulePass(intptr_t pid, bool AP = false) : Pass(pid, AP) {} - explicit ModulePass(const void *pid, bool AP = false) : Pass(pid, AP) {} + explicit ModulePass(intptr_t pid) : Pass(pid) {} + explicit ModulePass(const void *pid) : Pass(pid) {} // Force out-of-line virtual method. virtual ~ModulePass(); }; @@ -257,9 +253,9 @@ public: /// bool runOnModule(Module &M) { return false; } - explicit ImmutablePass(intptr_t pid, bool AP = false) : ModulePass(pid, AP) {} - explicit ImmutablePass(const void *pid, bool AP = false) - : ModulePass(pid, AP) {} + explicit ImmutablePass(intptr_t pid) : ModulePass(pid) {} + explicit ImmutablePass(const void *pid) + : ModulePass(pid) {} // Force out-of-line virtual method. virtual ~ImmutablePass(); @@ -276,8 +272,8 @@ public: /// class FunctionPass : public Pass { public: - explicit FunctionPass(intptr_t pid, bool AP = false) : Pass(pid, AP) {} - explicit FunctionPass(const void *pid, bool AP = false) : Pass(pid, AP) {} + explicit FunctionPass(intptr_t pid) : Pass(pid) {} + explicit FunctionPass(const void *pid) : Pass(pid) {} /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. @@ -328,8 +324,8 @@ public: /// class BasicBlockPass : public Pass { public: - explicit BasicBlockPass(intptr_t pid, bool AP = false) : Pass(pid, AP) {} - explicit BasicBlockPass(const void *pid, bool AP = false) : Pass(pid, AP) {} + explicit BasicBlockPass(intptr_t pid) : Pass(pid) {} + explicit BasicBlockPass(const void *pid) : Pass(pid) {} /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h index 1ddc2df..68fd901 100644 --- a/include/llvm/PassSupport.h +++ b/include/llvm/PassSupport.h @@ -39,6 +39,7 @@ class PassInfo { const char *PassArgument; // Command Line argument to run this pass intptr_t PassID; bool IsCFGOnlyPass; // Pass only looks at the CFG. + bool IsAnalysis; // True if an analysis pass. bool IsAnalysisGroup; // True if an analysis group. std::vector<const PassInfo*> ItfImpl;// Interfaces implemented by this pass @@ -48,9 +49,10 @@ 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, - Pass *(*normal)() = 0, bool isCFGOnly = false) + Pass *(*normal)() = 0, bool isCFGOnly = false, bool isAnalysis = false) : PassName(name), PassArgument(arg), PassID(pi), - IsCFGOnlyPass(isCFGOnly), IsAnalysisGroup(false), NormalCtor(normal) { + IsCFGOnlyPass(isCFGOnly), + IsAnalysis(isAnalysis), IsAnalysisGroup(false), NormalCtor(normal) { } /// getPassName - Return the friendly name for the pass, never returns null @@ -72,6 +74,7 @@ public: /// pass. /// bool isAnalysisGroup() const { return IsAnalysisGroup; } + bool isAnalysis() const { return IsAnalysis; } void SetIsAnalysisGroup() { IsAnalysisGroup = true; } /// isCFGOnlyPass - return true if this pass only looks at the CFG for the @@ -140,8 +143,9 @@ struct RegisterPassBase { typedef Pass* (*NormalCtor_t)(); RegisterPassBase(const char *Name, const char *Arg, intptr_t TI, - NormalCtor_t NormalCtor = 0, bool CFGOnly = false) - : PIObj(Name, Arg, TI, NormalCtor, CFGOnly) { + NormalCtor_t NormalCtor = 0, bool CFGOnly = false, + bool IsAnalysis = false) + : PIObj(Name, Arg, TI, NormalCtor, CFGOnly, IsAnalysis) { registerPass(); } explicit RegisterPassBase(intptr_t TI) @@ -164,9 +168,11 @@ template<typename PassName> struct RegisterPass : public RegisterPassBase { // Register Pass using default constructor... - RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false) + RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false, + bool IsAnalysis = false) : RegisterPassBase(Name, PassArg, intptr_t(&PassName::ID), - RegisterPassBase::NormalCtor_t(callDefaultCtor<PassName>), CFGOnly) { + RegisterPassBase::NormalCtor_t(callDefaultCtor<PassName>), + CFGOnly, IsAnalysis) { } }; |