aboutsummaryrefslogtreecommitdiff
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
commit53745b852d519e1b68862164f89bd9c8fbc9a415 (patch)
treed1c5b562b628714aa83ecdcdcfd8dd7d2b0e6582
parent60e9187a90c93a7660946789af52d9b40f652a0c (diff)
patch #4 in Saem's passmanager refactoring.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25077 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/PassManagerT.h65
1 files changed, 50 insertions, 15 deletions
diff --git a/lib/VMCore/PassManagerT.h b/lib/VMCore/PassManagerT.h
index 88bedd27db..53bff14c04 100644
--- a/lib/VMCore/PassManagerT.h
+++ b/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)