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

Devang Patel dpatel at apple.com
Tue Jan 16 13:43:34 PST 2007



Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.124 -> 1.125
---
Log message:

Undo last check-in.
Remove setupPassManager() and its use.


---
Diffs of the changes:  (+50 -62)

 PassManager.cpp |  112 +++++++++++++++++++++++++-------------------------------
 1 files changed, 50 insertions(+), 62 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.124 llvm/lib/VMCore/PassManager.cpp:1.125
--- llvm/lib/VMCore/PassManager.cpp:1.124	Tue Jan 16 13:46:09 2007
+++ llvm/lib/VMCore/PassManager.cpp	Tue Jan 16 15:43:18 2007
@@ -366,7 +366,8 @@
 /// the manager. Remove dead passes. This is a recursive function.
 void PMTopLevelManager::schedulePass(Pass *P) {
 
-  P->setupPassManager(activeStack);
+  // TODO : Allocate function manager for this pass, other wise required set
+  // may be inserted into previous function manager
 
   AnalysisUsage AnUsage;
   P->getAnalysisUsage(AnUsage);
@@ -1217,55 +1218,47 @@
   MPP->add(this);
 }
 
-/// Setup Pass Manager in advance before checking availability of
-/// required analysis passes.
-void FunctionPass::setupPassManager(PMStack &PMS) {
+/// Find appropriate Function Pass Manager or Call Graph Pass Manager
+/// in the PM Stack and add self into that manager. 
+void FunctionPass::assignPassManager(PMStack &PMS) {
 
   // Find Module Pass Manager (TODO : Or Call Graph Pass Manager)
   while(!PMS.empty()) {
     if (PMS.top()->getPassManagerType() > PMT_FunctionPassManager)
       PMS.pop();
     else
-      break;
+      break; 
   }
+  FPPassManager *FPP = dynamic_cast<FPPassManager *>(PMS.top());
 
-  assert(!PMS.empty() && "Unable to create Function Pass Manager");
+  // Create new Function Pass Manager
+  if (!FPP) {
+    assert(!PMS.empty() && "Unable to create Function Pass Manager");
+    PMDataManager *PMD = PMS.top();
 
-  if (PMS.top()->getPassManagerType() == PMT_FunctionPassManager
-      || PMS.top()->getPassManagerType() == PMT_CallGraphPassManager)
-    return;
-      
-  PMDataManager *PMD = PMS.top();
-  
-  // [1] Create new Function Pass Manager
-  FPPassManager *FPP = new FPPassManager(PMD->getDepth() + 1);
-  
-  // [2] Set up new manager's top level manager
-  PMTopLevelManager *TPM = PMD->getTopLevelManager();
-  TPM->addIndirectPassManager(FPP);
-  
-  // [3] Assign manager to manage this new manager. This may create
-  // and push new managers into PMS
-  Pass *P = dynamic_cast<Pass *>(FPP);
-  P->assignPassManager(PMS);
-  
-  // [4] Push new manager into PMS
-  PMS.push(FPP);
-}
+    // [1] Create new Function Pass Manager
+    FPP = new FPPassManager(PMD->getDepth() + 1);
 
-/// Find appropriate Function Pass Manager or Call Graph Pass Manager
-/// in the PM Stack and add self into that manager. 
-void FunctionPass::assignPassManager(PMStack &PMS) {
+    // [2] Set up new manager's top level manager
+    PMTopLevelManager *TPM = PMD->getTopLevelManager();
+    TPM->addIndirectPassManager(FPP);
+
+    // [3] Assign manager to manage this new manager. This may create
+    // and push new managers into PMS
+    Pass *P = dynamic_cast<Pass *>(FPP);
+    P->assignPassManager(PMS);
 
-  PMDataManager *PMD = dynamic_cast<PMDataManager *>(PMS.top());
-  assert(PMD && "Unable to assign Pass Manager");
+    // [4] Push new manager into PMS
+    PMS.push(FPP);
+  }
 
-  PMD->add(this);
+  // Assign FPP as the manager of this pass.
+  FPP->add(this);
 }
 
-/// Setup Pass Manager in advance before checking availability of
-/// required analysis passes.
-void BasicBlockPass::setupPassManager(PMStack &PMS) {
+/// Find appropriate Basic Pass Manager or Call Graph Pass Manager
+/// in the PM Stack and add self into that manager. 
+void BasicBlockPass::assignPassManager(PMStack &PMS) {
 
   BBPassManager *BBP = NULL;
 
@@ -1275,37 +1268,32 @@
     BBP = dynamic_cast<BBPassManager *>(PMS.top());
   }
 
-  if (BBP)
-    return;
+  // If leaf manager is not Basic Block Pass manager then create new
+  // basic Block Pass manager.
+
+  if (!BBP) {
+    assert(!PMS.empty() && "Unable to create BasicBlock Pass Manager");
+    PMDataManager *PMD = PMS.top();
+
+    // [1] Create new Basic Block Manager
+    BBP = new BBPassManager(PMD->getDepth() + 1);
+
+    // [2] Set up new manager's top level manager
+    // Basic Block Pass Manager does not live by itself
+    PMTopLevelManager *TPM = PMD->getTopLevelManager();
+    TPM->addIndirectPassManager(BBP);
 
-  assert(!PMS.empty() && "Unable to create BasicBlock Pass Manager");
-  PMDataManager *PMD = PMS.top();
-  
-  // [1] Create new Basic Block Manager
-  BBP = new BBPassManager(PMD->getDepth() + 1);
-  
-  // [2] Set up new manager's top level manager
-  // Basic Block Pass Manager does not live by itself
-  PMTopLevelManager *TPM = PMD->getTopLevelManager();
-  TPM->addIndirectPassManager(BBP);
-  
     // [3] Assign manager to manage this new manager. This may create
     // and push new managers into PMS
-  Pass *P = dynamic_cast<Pass *>(BBP);
-  P->assignPassManager(PMS);
-  
-  // [4] Push new manager into PMS
-  PMS.push(BBP);
-}
-
-/// Find appropriate Basic Pass Manager or Call Graph Pass Manager
-/// in the PM Stack and add self into that manager. 
-void BasicBlockPass::assignPassManager(PMStack &PMS) {
+    Pass *P = dynamic_cast<Pass *>(BBP);
+    P->assignPassManager(PMS);
 
-  PMDataManager *PMD = dynamic_cast<PMDataManager *>(PMS.top());
-  assert(PMD && "Unable to assign Pass Manager");
+    // [4] Push new manager into PMS
+    PMS.push(BBP);
+  }
 
-  PMD->add(this);
+  // Assign BBP as the manager of this pass.
+  BBP->add(this);
 }
 
 






More information about the llvm-commits mailing list