[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

Devang Patel dpatel at apple.com
Mon Mar 5 14:58:06 PST 2007



Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.141 -> 1.142
---
Log message:

Current pass manager, not the parent pass manager,  assumes the role of 
last user when one of the managed pass uses info provided by parent pass 
manager.

This was exposed by LPPassManager work.


---
Diffs of the changes:  (+10 -22)

 PassManager.cpp |   32 ++++++++++----------------------
 1 files changed, 10 insertions(+), 22 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.141 llvm/lib/VMCore/PassManager.cpp:1.142
--- llvm/lib/VMCore/PassManager.cpp:1.141	Mon Mar  5 14:01:30 2007
+++ llvm/lib/VMCore/PassManager.cpp	Mon Mar  5 16:57:49 2007
@@ -158,7 +158,6 @@
       recordAvailableAnalysis(IP);
     } else {
       P->assignPassManager(activeStack);
-      activeStack.handleLastUserOverflow();
     }
 
   }
@@ -259,7 +258,6 @@
       recordAvailableAnalysis(IP);
     } else {
       P->assignPassManager(activeStack);
-      activeStack.handleLastUserOverflow();
     }
 
   }
@@ -587,6 +585,10 @@
   AnalysisResolver *AR = new AnalysisResolver(*this);
   P->setResolver(AR);
 
+  // If a FunctionPass F is the last user of ModulePass info M
+  // then the F's manager, not F, records itself as a last user of M.
+  std::vector<Pass *> TransferLastUses;
+
   if (ProcessAnalysis) {
 
     // At the moment, this pass is the last user of all required passes.
@@ -622,6 +624,12 @@
       LastUses.push_back(P);
     TPM->setLastUser(LastUses, P);
 
+    if (!TransferLastUses.empty()) {
+      Pass *My_PM = dynamic_cast<Pass *>(this);
+      TPM->setLastUser(TransferLastUses, My_PM);
+      TransferLastUses.clear();
+    }
+
     // Take a note of analysis required and made available by this pass.
     // Remove the analysis not preserved by this pass
     removeNotPreservedAnalysis(P);
@@ -1231,26 +1239,6 @@
     printf ("\n");
 }
 
-// Walk Pass Manager stack and set LastUse markers if any
-// manager is transfering this priviledge to its parent manager
-void PMStack::handleLastUserOverflow() {
-
-  for(PMStack::iterator I = this->begin(), E = this->end(); I != E;) {
-
-    PMDataManager *Child = *I++;
-    if (I != E) {
-      PMDataManager *Parent = *I++;
-      PMTopLevelManager *TPM = Parent->getTopLevelManager();
-      std::vector<Pass *> &TLU = Child->getTransferredLastUses();
-      if (!TLU.empty()) {
-        Pass *P = dynamic_cast<Pass *>(Parent);
-        TPM->setLastUser(TLU, P);
-        TLU.clear();
-      }
-    }
-  }
-}
-
 /// Find appropriate Module Pass Manager in the PM Stack and
 /// add self into that manager. 
 void ModulePass::assignPassManager(PMStack &PMS, 






More information about the llvm-commits mailing list