[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp
Devang Patel
dpatel at apple.com
Thu Jan 11 14:15:45 PST 2007
Changes in directory llvm/lib/VMCore:
PassManager.cpp updated: 1.116 -> 1.117
---
Log message:
Start using PMStack. Now each pass is responsibe for assinging
a pass manager for itself.
There is some opportunity to remove some dead code from PassManager.cpp.
---
Diffs of the changes: (+24 -29)
PassManager.cpp | 53 ++++++++++++++++++++++++-----------------------------
1 files changed, 24 insertions(+), 29 deletions(-)
Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.116 llvm/lib/VMCore/PassManager.cpp:1.117
--- llvm/lib/VMCore/PassManager.cpp:1.116 Thu Jan 11 13:59:06 2007
+++ llvm/lib/VMCore/PassManager.cpp Thu Jan 11 16:15:30 2007
@@ -24,6 +24,7 @@
using namespace llvm;
class llvm::PMDataManager;
+class llvm::PMStack;
//===----------------------------------------------------------------------===//
// Overview:
@@ -190,6 +191,9 @@
void initializeAllAnalysisInfo();
+ // Active Pass Managers
+ PMStack activeStack;
+
protected:
/// Collection of pass managers
@@ -434,9 +438,8 @@
//
/// FunctionPassManagerImpl manages FPPassManagers
class FunctionPassManagerImpl : public Pass,
- public PMDataManager,
- public PMTopLevelManager {
-
+ public PMDataManager,
+ public PMTopLevelManager {
public:
FunctionPassManagerImpl(int Depth) : PMDataManager(Depth) {
@@ -551,8 +554,8 @@
//
/// PassManagerImpl manages MPPassManagers
class PassManagerImpl : public Pass,
- public PMDataManager,
- public PMTopLevelManager {
+ public PMDataManager,
+ public PMTopLevelManager {
public:
@@ -1218,19 +1221,15 @@
/// manage it.
bool FunctionPassManagerImpl::addPass(Pass *P) {
- if (!activeManager || !activeManager->addPass(P)) {
- activeManager = new FPPassManager(getDepth() + 1);
- // Inherit top level manager
- activeManager->setTopLevelManager(this->getTopLevelManager());
-
- // This top level manager is going to manage activeManager.
- // Set up analysis resolver to connect them.
- AnalysisResolver *AR = new AnalysisResolver(*this);
- activeManager->setResolver(AR);
-
- addPassManager(activeManager);
- return activeManager->addPass(P);
+ if (activeStack.empty()) {
+ FPPassManager *FPP = new FPPassManager(getDepth() + 1);
+ FPP->setTopLevelManager(this->getTopLevelManager());
+ addPassManager(FPP);
+ activeStack.push(FPP);
}
+
+ P->assignPassManager(activeStack);
+
return true;
}
@@ -1525,21 +1524,16 @@
/// manage it.
bool PassManagerImpl::addPass(Pass *P) {
- if (!activeManager || !activeManager->addPass(P)) {
- activeManager = new MPPassManager(getDepth() + 1);
-
- // Inherit top level manager
- activeManager->setTopLevelManager(this->getTopLevelManager());
+ if (activeStack.empty()) {
+ MPPassManager *MPP = new MPPassManager(getDepth() + 1);
+ MPP->setTopLevelManager(this->getTopLevelManager());
+ addPassManager(MPP);
+ activeStack.push(MPP);
+ }
- // This top level manager is going to manage activeManager.
- // Set up analysis resolver to connect them.
- AnalysisResolver *AR = new AnalysisResolver(*this);
- activeManager->setResolver(AR);
+ P->assignPassManager(activeStack);
- addPassManager(activeManager);
- return activeManager->addPass(P);
- }
return true;
}
@@ -1618,6 +1612,7 @@
//===----------------------------------------------------------------------===//
// PMStack implementation
//
+
// Pop Pass Manager from the stack and clear its analysis info.
void PMStack::pop() {
More information about the llvm-commits
mailing list