summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-01-04 04:36:11 +0000
committerChris Lattner <sabre@nondot.org>2006-01-04 04:36:11 +0000
commitafb8ee6d251e709803a308f62faa39acbf92464c (patch)
tree9798488f931fa726ee6ec7a066ddf13cde13c58a /llvm/lib
parenta69bb989f1b490a6bc886b917537ae391ddfecdc (diff)
downloadbcm5719-llvm-afb8ee6d251e709803a308f62faa39acbf92464c.tar.gz
bcm5719-llvm-afb8ee6d251e709803a308f62faa39acbf92464c.zip
patch #4 in Saem's passmanager refactoring.
llvm-svn: 25077
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/PassManagerT.h65
1 files changed, 50 insertions, 15 deletions
diff --git a/llvm/lib/VMCore/PassManagerT.h b/llvm/lib/VMCore/PassManagerT.h
index 88bedd27db1..53bff14c042 100644
--- a/llvm/lib/VMCore/PassManagerT.h
+++ b/llvm/lib/VMCore/PassManagerT.h
@@ -620,6 +620,7 @@ public:
// Initialize the immutable pass...
IP->initializePass();
}
+
};
@@ -659,7 +660,10 @@ public:
virtual const char *getPMName() const { return "BasicBlock"; }
virtual const char *getPassName() const { return "BasicBlock Pass Manager"; }
-
+
+ virtual bool runOnBasicBlock(BasicBlock &BB);
+
+
// TODO:Start absorbing PassManagerTraits<BasicBlock>
};
@@ -682,7 +686,12 @@ public:
// Implement the BasicBlockPass interface...
virtual bool doInitialization(Module &M);
virtual bool doInitialization(Function &F);
- virtual bool runOnBasicBlock(BasicBlock &BB);
+
+ // Forwarded
+ virtual bool runOnBasicBlock(BasicBlock &BB) {
+ return BasicBlockPassManager::runOnBasicBlock(BB);
+ }
+
virtual bool doFinalization(Function &F);
virtual bool doFinalization(Module &M);
@@ -728,7 +737,10 @@ public:
virtual const char *getPMName() const { return "Function"; }
virtual const char *getPassName() const { return "Function Pass Manager"; }
-
+
+ virtual bool runOnFunction(Function &F);
+
+
// TODO:Start absorbing PassManagerTraits<Function>
};
@@ -749,7 +761,12 @@ public:
// Implement the FunctionPass interface...
virtual bool doInitialization(Module &M);
- virtual bool runOnFunction(Function &F);
+
+ // Forwarded
+ virtual bool runOnFunction(Function &F) {
+ return FunctionPassManagerT::runOnFunction(F);
+ }
+
virtual bool doFinalization(Module &M);
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -762,7 +779,6 @@ public:
}
};
-
//===----------------------------------------------------------------------===//
// ModulePassManager
//
@@ -792,6 +808,8 @@ public:
// debugging.
virtual const char *getPMName() const { return "Module"; }
+ // runOnModule - Implement the PassManager interface.
+ virtual bool runOnModule(Module &M);
// TODO:Start absorbing PassManagerTraits<Module>
};
@@ -808,9 +826,9 @@ public:
// runPass - Specify how the pass should be run on the UnitType
static bool runPass(PassClass *P, Module *M) { return P->runOnModule(*M); }
- // runOnModule - Implement the PassManager interface.
+ // Forwarded
bool runOnModule(Module &M) {
- return ((PassManagerT<Module>*)this)->runOnUnit(&M);
+ return ModulePassManager::runOnModule(M);
}
// Forwarded
@@ -824,6 +842,31 @@ public:
// PassManagerTraits Method Implementations
//
+// BasicBlockPassManager Implementations
+//
+
+inline bool BasicBlockPassManager::runOnBasicBlock(BasicBlock &BB) {
+ return ((PMType*)this)->runOnUnit(&BB);
+}
+
+// FunctionPassManagerT Implementations
+//
+
+inline bool FunctionPassManagerT::runOnFunction(Function &F) {
+ return ((PMType*)this)->runOnUnit(&F);
+}
+
+// ModulePassManager Implementations
+//
+
+bool ModulePassManager::runOnModule(Module &M) {
+ return ((PassManagerT<Module>*)this)->runOnUnit(&M);
+}
+
+//===----------------------------------------------------------------------===//
+// PassManagerTraits Method Implementations
+//
+
// PassManagerTraits<BasicBlock> Implementations
//
inline bool PassManagerTraits<BasicBlock>::doInitialization(Module &M) {
@@ -840,10 +883,6 @@ inline bool PassManagerTraits<BasicBlock>::doInitialization(Function &F) {
return Changed;
}
-inline bool PassManagerTraits<BasicBlock>::runOnBasicBlock(BasicBlock &BB) {
- return ((PMType*)this)->runOnUnit(&BB);
-}
-
inline bool PassManagerTraits<BasicBlock>::doFinalization(Function &F) {
bool Changed = false;
for (unsigned i = 0, e = ((PMType*)this)->Passes.size(); i != e; ++i)
@@ -868,10 +907,6 @@ inline bool PassManagerTraits<Function>::doInitialization(Module &M) {
return Changed;
}
-inline bool PassManagerTraits<Function>::runOnFunction(Function &F) {
- return ((PMType*)this)->runOnUnit(&F);
-}
-
inline bool PassManagerTraits<Function>::doFinalization(Module &M) {
bool Changed = false;
for (unsigned i = 0, e = ((PMType*)this)->Passes.size(); i != e; ++i)
OpenPOWER on IntegriCloud