diff options
author | Devang Patel <dpatel@apple.com> | 2008-03-19 00:48:41 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2008-03-19 00:48:41 +0000 |
commit | c7fe32e840758baa9ce4f93c321b508a69b98262 (patch) | |
tree | 8880489b1046f714fff98a468cd30202e533b6f4 /include | |
parent | bebc3642d354ef744f3fd55a20d28ba29ec51063 (diff) | |
download | external_llvm-c7fe32e840758baa9ce4f93c321b508a69b98262.zip external_llvm-c7fe32e840758baa9ce4f93c321b508a69b98262.tar.gz external_llvm-c7fe32e840758baa9ce4f93c321b508a69b98262.tar.bz2 |
Do not use virtual function to identify an analysis pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48520 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/Dominators.h | 13 | ||||
-rw-r--r-- | include/llvm/Analysis/FindUsedTypes.h | 6 | ||||
-rw-r--r-- | include/llvm/Analysis/IntervalPartition.h | 5 | ||||
-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 | 5 | ||||
-rw-r--r-- | include/llvm/Analysis/PostDominators.h | 8 | ||||
-rw-r--r-- | include/llvm/Analysis/ScalarEvolution.h | 5 | ||||
-rw-r--r-- | include/llvm/CallGraphSCCPass.h | 2 | ||||
-rw-r--r-- | include/llvm/Pass.h | 32 |
10 files changed, 26 insertions, 57 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 8c1a3ed..1b7fa75 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -300,9 +300,6 @@ public: // FIXME: Should remove this virtual bool runOnFunction(Function &F) { return false; } - /// isAnalysis - Return true if this pass is implementing an analysis pass. - virtual bool isAnalysis() const { return true; } - virtual void releaseMemory() { reset(); } /// getNode - return the (Post)DominatorTree node for the specified basic @@ -667,7 +664,7 @@ public: static char ID; // Pass ID, replacement for typeid DominatorTreeBase<BasicBlock>* DT; - DominatorTree() : FunctionPass(intptr_t(&ID)) { + DominatorTree() : FunctionPass(intptr_t(&ID), true) { DT = new DominatorTreeBase<BasicBlock>(false); } @@ -694,9 +691,6 @@ public: return DT->getRootNode(); } - /// isAnalysis - Return true if this pass is implementing an analysis pass. - virtual bool isAnalysis() const { return true; } - virtual bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { @@ -843,7 +837,7 @@ protected: public: DominanceFrontierBase(intptr_t ID, bool isPostDom) - : FunctionPass(ID), IsPostDominators(isPostDom) {} + : FunctionPass(ID, true), IsPostDominators(isPostDom) {} /// getRoots - Return the root blocks of the current CFG. This may include /// multiple blocks if we are computing post dominators. For forward @@ -916,9 +910,6 @@ public: return Roots[0]; } - /// isAnalysis - Return true if this pass is implementing an analysis pass. - virtual bool isAnalysis() const { return true; } - virtual bool runOnFunction(Function &) { Frontiers.clear(); DominatorTree &DT = getAnalysis<DominatorTree>(); diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h index 605cc07..6a128c8 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) {} + FindUsedTypes() : ModulePass((intptr_t)&ID, true) {} /// getTypes - After the pass has been run, return the set containing all of /// the types used in the module. @@ -50,10 +50,6 @@ private: void IncorporateValue(const Value *V); public: - - /// isAnalysis - Return true if this pass is implementing an analysis pass. - virtual bool isAnalysis() const { return true; } - /// run - This incorporates all types used by the specified module bool runOnModule(Module &M); diff --git a/include/llvm/Analysis/IntervalPartition.h b/include/llvm/Analysis/IntervalPartition.h index 855e3a4..42d27fe 100644 --- a/include/llvm/Analysis/IntervalPartition.h +++ b/include/llvm/Analysis/IntervalPartition.h @@ -47,10 +47,7 @@ class IntervalPartition : public FunctionPass { public: static char ID; // Pass identification, replacement for typeid - IntervalPartition() : FunctionPass((intptr_t)&ID), RootInterval(0) {} - - /// isAnalysis - Return true if this pass is implementing an analysis pass. - virtual bool isAnalysis() const { return true; } + IntervalPartition() : FunctionPass((intptr_t)&ID, true), 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 ab7cb7e..cc2b10e 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)) { + LoopInfo() : FunctionPass(intptr_t(&ID), true) { LI = new LoopInfoBase<BasicBlock>(); } @@ -919,9 +919,6 @@ 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 3b5f565..8ebbbaf 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) : Pass(pid) {} + explicit LoopPass(intptr_t pid, bool AP = false) : Pass(pid, AP) {} // 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 d16295b..c683a6b 100644 --- a/include/llvm/Analysis/MemoryDependenceAnalysis.h +++ b/include/llvm/Analysis/MemoryDependenceAnalysis.h @@ -66,10 +66,7 @@ class MemoryDependenceAnalysis : public FunctionPass { static Instruction* const Dirty; static char ID; // Class identification, replacement for typeinfo - MemoryDependenceAnalysis() : FunctionPass((intptr_t)&ID) {} - - /// isAnalysis - Return true if this pass is implementing an analysis pass. - virtual bool isAnalysis() const { return true; } + MemoryDependenceAnalysis() : FunctionPass((intptr_t)&ID, true) {} /// Pass Implementation stuff. This doesn't do any analysis. /// diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h index c55022b..f20f050 100644 --- a/include/llvm/Analysis/PostDominators.h +++ b/include/llvm/Analysis/PostDominators.h @@ -25,13 +25,10 @@ struct PostDominatorTree : public FunctionPass { static char ID; // Pass identification, replacement for typeid DominatorTreeBase<BasicBlock>* DT; - PostDominatorTree() : FunctionPass((intptr_t)&ID) { + PostDominatorTree() : FunctionPass((intptr_t)&ID, true) { DT = new DominatorTreeBase<BasicBlock>(true); } - /// isAnalysis - Return true if this pass is implementing an analysis pass. - virtual bool isAnalysis() const { return true; } - virtual bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { @@ -72,9 +69,6 @@ struct PostDominanceFrontier : public DominanceFrontierBase { PostDominanceFrontier() : DominanceFrontierBase((intptr_t) &ID, true) {} - /// isAnalysis - Return true if this pass is implementing an analysis pass. - virtual bool isAnalysis() const { return true; } - virtual bool runOnFunction(Function &) { Frontiers.clear(); PostDominatorTree &DT = getAnalysis<PostDominatorTree>(); diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index d97abe4..5894d8c 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), Impl(0) {} + ScalarEvolution() : FunctionPass((intptr_t)&ID, true), Impl(0) {} /// getSCEV - Return a SCEV expression handle for the full generality of the /// specified expression. @@ -291,9 +291,6 @@ namespace llvm { /// that no dangling references are left around. void deleteValueFromRecords(Value *V) const; - /// isAnalysis - Return true if this pass is implementing an analysis pass. - virtual bool isAnalysis() const { return true; } - virtual bool runOnFunction(Function &F); virtual void releaseMemory(); virtual void getAnalysisUsage(AnalysisUsage &AU) const; diff --git a/include/llvm/CallGraphSCCPass.h b/include/llvm/CallGraphSCCPass.h index 2600505..f2190e6 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) : Pass(pid) {} + explicit CallGraphSCCPass(intptr_t pid, bool AP = false) : Pass(pid, AP) {} /// 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 58bdfc0..07355da 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -73,7 +73,7 @@ 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,10 +82,14 @@ class Pass { void operator=(const Pass&); // DO NOT IMPLEMENT Pass(const Pass &); // DO NOT IMPLEMENT public: - explicit Pass(intptr_t pid) : Resolver(0), PassID(pid) {} - explicit Pass(const void *pid) : Resolver(0), PassID((intptr_t)pid) {} + 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) {} 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. @@ -130,11 +134,6 @@ public: return Resolver; } - /// isAnalysis - Return true if this pass is implementing an analysis pass. - virtual bool isAnalysis() const { - return false; - } - /// getAnalysisUsage - This function should be overriden by passes that need /// analysis information to do their job. If a pass specifies that it uses a /// particular analysis result to this function, it can then use the @@ -232,8 +231,8 @@ public: return PMT_ModulePassManager; } - explicit ModulePass(intptr_t pid) : Pass(pid) {} - explicit ModulePass(const void *pid) : Pass(pid) {} + explicit ModulePass(intptr_t pid, bool AP = false) : Pass(pid, AP) {} + explicit ModulePass(const void *pid, bool AP = false) : Pass(pid, AP) {} // Force out-of-line virtual method. virtual ~ModulePass(); }; @@ -258,8 +257,9 @@ public: /// bool runOnModule(Module &M) { return false; } - explicit ImmutablePass(intptr_t pid) : ModulePass(pid) {} - explicit ImmutablePass(const void *pid) : ModulePass(pid) {} + explicit ImmutablePass(intptr_t pid, bool AP = false) : ModulePass(pid, AP) {} + explicit ImmutablePass(const void *pid, bool AP = false) + : ModulePass(pid, AP) {} // Force out-of-line virtual method. virtual ~ImmutablePass(); @@ -276,8 +276,8 @@ public: /// class FunctionPass : public Pass { public: - explicit FunctionPass(intptr_t pid) : Pass(pid) {} - explicit FunctionPass(const void *pid) : Pass(pid) {} + explicit FunctionPass(intptr_t pid, bool AP = false) : Pass(pid, AP) {} + explicit FunctionPass(const void *pid, bool AP = false) : Pass(pid, AP) {} /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. @@ -328,8 +328,8 @@ public: /// class BasicBlockPass : public Pass { public: - explicit BasicBlockPass(intptr_t pid) : Pass(pid) {} - explicit BasicBlockPass(const void *pid) : Pass(pid) {} + explicit BasicBlockPass(intptr_t pid, bool AP = false) : Pass(pid, AP) {} + explicit BasicBlockPass(const void *pid, bool AP = false) : Pass(pid, AP) {} /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. |