Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.122 -> 1.123
---
Log message:

Code refactoring.


---
Diffs of the changes:  (+21 -18)

 PassManager.cpp |   39 +++++++++++++++++++++------------------
 1 files changed, 21 insertions(+), 18 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.122 
llvm/lib/VMCore/PassManager.cpp:1.123
--- llvm/lib/VMCore/PassManager.cpp:1.122       Mon Jan 15 17:06:56 2007
+++ llvm/lib/VMCore/PassManager.cpp     Mon Jan 15 20:00:38 2007
@@ -112,7 +112,8 @@
                                 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 @@
       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 @@
 
 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 @@
       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 @@
 
//===----------------------------------------------------------------------===//
 // 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) {



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to