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

Devang Patel dpatel at apple.com
Fri Nov 10 18:04:33 PST 2006



Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.17 -> 1.18
---
Log message:

While adding pass into the manager, process Analysis only if it is
required to do so.


---
Diffs of the changes:  (+15 -12)

 PassManager.cpp |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.17 llvm/lib/VMCore/PassManager.cpp:1.18
--- llvm/lib/VMCore/PassManager.cpp:1.17	Fri Nov 10 19:56:39 2006
+++ llvm/lib/VMCore/PassManager.cpp	Fri Nov 10 20:04:19 2006
@@ -48,8 +48,8 @@
   void removeDeadPasses() { /* TODO : Implement */ }
 
   /// Add pass P into the PassVector. Update RequiredAnalysis and
-  /// AvailableAnalysis appropriately
-  void addPassToManager (Pass *P);
+  /// AvailableAnalysis appropriately if ProcessAnalysis is true.
+  void addPassToManager (Pass *P, bool ProcessAnalysis = true);
 
   inline std::vector<Pass *>::iterator passVectorBegin() { 
     return PassVector.begin(); 
@@ -248,18 +248,21 @@
 }
 
 /// Add pass P into the PassVector. Update RequiredAnalysis and
-/// AvailableAnalysis appropriately
-void CommonPassManagerImpl::addPassToManager (Pass *P) {
+/// AvailableAnalysis appropriately if ProcessAnalysis is true.
+void CommonPassManagerImpl::addPassToManager (Pass *P, 
+                                              bool ProcessAnalysis) {
+
+  if (ProcessAnalysis) {
+    // Take a note of analysis required and made available by this pass
+    noteDownRequiredAnalysis(P);
+    noteDownAvailableAnalysis(P);
 
-  // Take a note of analysis required and made available by this pass
-  noteDownRequiredAnalysis(P);
-  noteDownAvailableAnalysis(P);
+    // Remove the analysis not preserved by this pass
+    removeNotPreservedAnalysis(P);
+  }
 
   // Add pass
   PassVector.push_back(P);
-
-  // Remove the analysis not preserved by this pass
-  removeNotPreservedAnalysis(P);
 }
 
 /// BasicBlockPassManager implementation
@@ -341,7 +344,7 @@
         || !activeBBPassManager->addPass(BP)) {
 
       activeBBPassManager = new BasicBlockPassManager_New();
-      addPassToManager(activeBBPassManager);
+      addPassToManager(activeBBPassManager, false);
       if (!activeBBPassManager->addPass(BP))
         assert(0 && "Unable to add Pass");
     }
@@ -397,7 +400,7 @@
         || !activeFunctionPassManager->addPass(P)) {
 
       activeFunctionPassManager = new FunctionPassManagerImpl_New();
-      addPassToManager(activeFunctionPassManager);
+      addPassToManager(activeFunctionPassManager, false);
       if (!activeFunctionPassManager->addPass(FP))
         assert(0 && "Unable to add pass");
     }






More information about the llvm-commits mailing list