diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-22 06:03:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-22 06:03:06 +0000 |
commit | 476e9bd1146624fa17243ae55fdb156f905ba3d4 (patch) | |
tree | 05d19c1e722c5a9095a8517de04e345d87a79ed5 /include | |
parent | 6f6e87db19e2976b3e581587db0f44fdfc4be0ad (diff) | |
download | external_llvm-476e9bd1146624fa17243ae55fdb156f905ba3d4.zip external_llvm-476e9bd1146624fa17243ae55fdb156f905ba3d4.tar.gz external_llvm-476e9bd1146624fa17243ae55fdb156f905ba3d4.tar.bz2 |
elimiante the dynamic_cast's from opt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94160 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/LoopPass.h | 4 | ||||
-rw-r--r-- | include/llvm/CallGraphSCCPass.h | 4 | ||||
-rw-r--r-- | include/llvm/Pass.h | 34 |
3 files changed, 28 insertions, 14 deletions
diff --git a/include/llvm/Analysis/LoopPass.h b/include/llvm/Analysis/LoopPass.h index 25488da..10ff103 100644 --- a/include/llvm/Analysis/LoopPass.h +++ b/include/llvm/Analysis/LoopPass.h @@ -28,8 +28,8 @@ class PMStack; class LoopPass : public Pass { public: - explicit LoopPass(intptr_t pid) : Pass(pid) {} - explicit LoopPass(void *pid) : Pass(pid) {} + explicit LoopPass(intptr_t pid) : Pass(PT_Loop, pid) {} + explicit LoopPass(void *pid) : Pass(PT_Loop, pid) {} // runOnLoop - This method should be implemented by the subclass to perform // whatever action is necessary for the specified Loop. diff --git a/include/llvm/CallGraphSCCPass.h b/include/llvm/CallGraphSCCPass.h index fc9feda..feab763 100644 --- a/include/llvm/CallGraphSCCPass.h +++ b/include/llvm/CallGraphSCCPass.h @@ -32,8 +32,8 @@ class PMStack; struct CallGraphSCCPass : public Pass { - explicit CallGraphSCCPass(intptr_t pid) : Pass(pid) {} - explicit CallGraphSCCPass(void *pid) : Pass(pid) {} + explicit CallGraphSCCPass(intptr_t pid) : Pass(PT_CallGraphSCC, pid) {} + explicit CallGraphSCCPass(void *pid) : Pass(PT_CallGraphSCC, 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 7bc6295..ab08afb 100644 --- a/include/llvm/Pass.h +++ b/include/llvm/Pass.h @@ -64,6 +64,16 @@ enum PassManagerType { PMT_Last }; +// Different types of passes. +enum PassKind { + PT_BasicBlock, + PT_Loop, + PT_Function, + PT_CallGraphSCC, + PT_Module, + PT_PassManager +}; + //===----------------------------------------------------------------------===// /// Pass interface - Implemented by all 'passes'. Subclass this if you are an /// interprocedural optimization or you do not fit into any of the more @@ -72,19 +82,23 @@ enum PassManagerType { class Pass { AnalysisResolver *Resolver; // Used to resolve analysis intptr_t PassID; - + PassKind Kind; 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(PassKind K, intptr_t pid) : Resolver(0), PassID(pid), Kind(K) { assert(pid && "pid cannot be 0"); } - explicit Pass(const void *pid) : Resolver(0), PassID((intptr_t)pid) { + explicit Pass(PassKind K, const void *pid) + : Resolver(0), PassID((intptr_t)pid), Kind(K) { assert(pid && "pid cannot be 0"); } virtual ~Pass(); + + PassKind getPassKind() const { return Kind; } + /// 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. @@ -118,7 +132,7 @@ public: // Access AnalysisResolver inline void setResolver(AnalysisResolver *AR) { - assert (!Resolver && "Resolver is already set"); + assert(!Resolver && "Resolver is already set"); Resolver = AR; } inline AnalysisResolver *getResolver() { @@ -229,8 +243,8 @@ public: /// Return what kind of Pass Manager can manage this pass. virtual PassManagerType getPotentialPassManagerType() const; - explicit ModulePass(intptr_t pid) : Pass(pid) {} - explicit ModulePass(const void *pid) : Pass(pid) {} + explicit ModulePass(intptr_t pid) : Pass(PT_Module, pid) {} + explicit ModulePass(const void *pid) : Pass(PT_Module, pid) {} // Force out-of-line virtual method. virtual ~ModulePass(); }; @@ -276,8 +290,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) : Pass(PT_Function, pid) {} + explicit FunctionPass(const void *pid) : Pass(PT_Function, pid) {} /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. @@ -326,8 +340,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) : Pass(PT_BasicBlock, pid) {} + explicit BasicBlockPass(const void *pid) : Pass(PT_BasicBlock, pid) {} /// doInitialization - Virtual method overridden by subclasses to do /// any necessary per-module initialization. |