[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp
Devang Patel
dpatel at apple.com
Mon Nov 13 17:23:44 PST 2006
Changes in directory llvm/lib/VMCore:
PassManager.cpp updated: 1.23 -> 1.24
---
Log message:
Manage analysis passes during run.
---
Diffs of the changes: (+25 -0)
PassManager.cpp | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+)
Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.23 llvm/lib/VMCore/PassManager.cpp:1.24
--- llvm/lib/VMCore/PassManager.cpp:1.23 Mon Nov 13 18:03:04 2006
+++ llvm/lib/VMCore/PassManager.cpp Mon Nov 13 19:23:29 2006
@@ -53,6 +53,13 @@
/// AvailableAnalysis appropriately if ProcessAnalysis is true.
void addPassToManager (Pass *P, bool ProcessAnalysis = true);
+ /// Clear analysis vectors RequiredAnalysis and AvailableAnalysis.
+ /// This is used before running passes managed by the manager.
+ void clearAnalysis() {
+ RequiredAnalysis.clear();
+ AvailableAnalysis.clear();
+ }
+
inline std::vector<Pass *>::iterator passVectorBegin() {
return PassVector.begin();
}
@@ -311,12 +318,18 @@
BasicBlockPassManager_New::runOnFunction(Function &F) {
bool Changed = false;
+ clearAnalysis();
+
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
for (std::vector<Pass *>::iterator itr = passVectorBegin(),
e = passVectorEnd(); itr != e; ++itr) {
Pass *P = *itr;
+
+ noteDownAvailableAnalysis(P);
BasicBlockPass *BP = dynamic_cast<BasicBlockPass*>(P);
Changed |= BP->runOnBasicBlock(*I);
+ removeNotPreservedAnalysis(P);
+ removeDeadPasses();
}
return Changed;
}
@@ -395,12 +408,18 @@
FunctionPassManagerImpl_New::runOnModule(Module &M) {
bool Changed = false;
+ clearAnalysis();
+
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
for (std::vector<Pass *>::iterator itr = passVectorBegin(),
e = passVectorEnd(); itr != e; ++itr) {
Pass *P = *itr;
+
+ noteDownAvailableAnalysis(P);
FunctionPass *FP = dynamic_cast<FunctionPass*>(P);
Changed |= FP->runOnFunction(*I);
+ removeNotPreservedAnalysis(P);
+ removeDeadPasses();
}
return Changed;
}
@@ -464,11 +483,17 @@
bool
ModulePassManager_New::runOnModule(Module &M) {
bool Changed = false;
+ clearAnalysis();
+
for (std::vector<Pass *>::iterator itr = passVectorBegin(),
e = passVectorEnd(); itr != e; ++itr) {
Pass *P = *itr;
+
+ noteDownAvailableAnalysis(P);
ModulePass *MP = dynamic_cast<ModulePass*>(P);
Changed |= MP->runOnModule(M);
+ removeNotPreservedAnalysis(P);
+ removeDeadPasses();
}
return Changed;
}
More information about the llvm-commits
mailing list