aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/PassManager.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-01-16 02:00:38 +0000
committerDevang Patel <dpatel@apple.com>2007-01-16 02:00:38 +0000
commit8f3f3d103a8b92bd0514ab5998865205e17ef550 (patch)
treefe087ce27ecc9d52f12468d6090a241e83464574 /lib/VMCore/PassManager.cpp
parent66eeb49d8fcfdfa4946c41fd92b8165c0086689d (diff)
Code refactoring.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33245 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/PassManager.cpp')
-rw-r--r--lib/VMCore/PassManager.cpp39
1 files changed, 21 insertions, 18 deletions
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp
index db03842bce..1e3b48ee68 100644
--- a/lib/VMCore/PassManager.cpp
+++ b/lib/VMCore/PassManager.cpp
@@ -112,7 +112,8 @@ class FunctionPassManagerImpl : public Pass,
public PMTopLevelManager {
public:
- FunctionPassManagerImpl(int Depth) : PMDataManager(Depth) { }
+ FunctionPassManagerImpl(int Depth) : PMDataManager(Depth),
+ PMTopLevelManager(TLM_Function) { }
/// add - Add a pass to the queue of passes to run. This passes ownership of
/// the Pass to the PassManager. When the PassManager is destroyed, the pass
@@ -151,13 +152,6 @@ public:
addImmutablePass(IP);
recordAvailableAnalysis(IP);
} else {
- // Assign manager
- if (activeStack.empty()) {
- FPPassManager *FPP = new FPPassManager(getDepth() + 1);
- FPP->setTopLevelManager(this->getTopLevelManager());
- addPassManager(FPP);
- activeStack.push(FPP);
- }
P->assignPassManager(activeStack);
}
@@ -220,7 +214,8 @@ class PassManagerImpl : public Pass,
public:
- PassManagerImpl(int Depth) : PMDataManager(Depth) { }
+ PassManagerImpl(int Depth) : PMDataManager(Depth),
+ PMTopLevelManager(TLM_Pass) { }
/// add - Add a pass to the queue of passes to run. This passes ownership of
/// the Pass to the PassManager. When the PassManager is destroyed, the pass
@@ -251,15 +246,6 @@ public:
addImmutablePass(IP);
recordAvailableAnalysis(IP);
} else {
-
- // Assign manager
- if (activeStack.empty()) {
- MPPassManager *MPP = new MPPassManager(getDepth() + 1);
- MPP->setTopLevelManager(this->getTopLevelManager());
- addPassManager(MPP);
- activeStack.push(MPP);
- }
-
P->assignPassManager(activeStack);
}
@@ -331,6 +317,23 @@ static TimingInfo *TheTimeInfo;
//===----------------------------------------------------------------------===//
// PMTopLevelManager implementation
+/// Initialize top level manager. Create first pass manager.
+PMTopLevelManager::PMTopLevelManager (enum TopLevelManagerType t) {
+
+ if (t == TLM_Pass) {
+ MPPassManager *MPP = new MPPassManager(1);
+ MPP->setTopLevelManager(this);
+ addPassManager(MPP);
+ activeStack.push(MPP);
+ }
+ else if (t == TLM_Function) {
+ FPPassManager *FPP = new FPPassManager(1);
+ FPP->setTopLevelManager(this);
+ addPassManager(FPP);
+ activeStack.push(FPP);
+ }
+}
+
/// Set pass P as the last user of the given analysis passes.
void PMTopLevelManager::setLastUser(std::vector<Pass *> &AnalysisPasses,
Pass *P) {