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

Devang Patel dpatel at apple.com
Fri Dec 15 14:58:04 PST 2006



Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.105 -> 1.106
---
Log message:

Cosmetic changes, based on Chris's review.


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

 PassManager.cpp |   48 +++++++++++++++++++++---------------------------
 1 files changed, 21 insertions(+), 27 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.105 llvm/lib/VMCore/PassManager.cpp:1.106
--- llvm/lib/VMCore/PassManager.cpp:1.105	Fri Dec 15 14:13:01 2006
+++ llvm/lib/VMCore/PassManager.cpp	Fri Dec 15 16:57:49 2006
@@ -221,7 +221,7 @@
 /// used by pass managers.
 class PMDataManager {
 public:
-  PMDataManager(int D) : TPM(NULL), Depth(D) {
+  PMDataManager(int Depth) : TPM(NULL), Depth(Depth) {
     initializeAnalysisInfo();
   }
 
@@ -331,7 +331,7 @@
                               public FunctionPass {
 
 public:
-  BasicBlockPassManager(int D) : PMDataManager(D) { }
+  BasicBlockPassManager(int Depth) : PMDataManager(Depth) { }
 
   /// Add a pass into a passmanager queue. 
   bool addPass(Pass *p);
@@ -372,7 +372,7 @@
                                     public PMDataManager,
                                     public PMTopLevelManager {
 public:
-  FunctionPassManagerImpl_New(int D) : PMDataManager(D) { 
+  FunctionPassManagerImpl_New(int Depth) : PMDataManager(Depth) { 
     activeBBPassManager = NULL;
   }
   ~FunctionPassManagerImpl_New() { /* TODO */ };
@@ -449,7 +449,7 @@
 class ModulePassManager : public Pass, public PMDataManager {
  
 public:
-  ModulePassManager(int D) : PMDataManager(D) { 
+  ModulePassManager(int Depth) : PMDataManager(Depth) { 
     activeFunctionPassManager = NULL; 
   }
   
@@ -490,7 +490,7 @@
 
 public:
 
-  PassManagerImpl_New(int D) : PMDataManager(D) {
+  PassManagerImpl_New(int Depth) : PMDataManager(Depth) {
     activeManager = NULL;
   }
 
@@ -674,12 +674,9 @@
 
     // If Pass not found then check the interfaces implemented by Immutable Pass
     if (!P) {
-      const std::vector<const PassInfo*> &ImmPI = 
-        PI->getInterfacesImplemented();
-      for (unsigned Index = 0, End = ImmPI.size(); 
-           P == NULL && Index != End; ++Index)
-        if (ImmPI[Index] == AID)
-          P = *I;
+      const std::vector<const PassInfo*> &ImmPI = PI->getInterfacesImplemented();
+      if (std::find(ImmPI.begin(), ImmPI.end(), AID) != ImmPI.end())
+        P = *I;
     }
   }
 
@@ -756,16 +753,13 @@
   const std::vector<AnalysisID> &PreservedSet = AnUsage.getPreservedSet();
   for (std::map<AnalysisID, Pass*>::iterator I = AvailableAnalysis.begin(),
          E = AvailableAnalysis.end(); I != E; ) {
-    if (std::find(PreservedSet.begin(), PreservedSet.end(), I->first) == 
+    std::map<AnalysisID, Pass*>::iterator Info = I++;
+    if (std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) == 
         PreservedSet.end()) {
       // Remove this analysis
-      if (!dynamic_cast<ImmutablePass*>(I->second)) {
-        std::map<AnalysisID, Pass*>::iterator J = I++;
-        AvailableAnalysis.erase(J);
-      } else
-        ++I;
-    } else
-      ++I;
+      if (!dynamic_cast<ImmutablePass*>(Info->second))
+        AvailableAnalysis.erase(Info);
+    }
   }
 }
 
@@ -975,8 +969,8 @@
   if (!BP)
     return false;
 
-  // If this pass does not preserve anlysis that is used by other passes
-  // managed by this manager than it is not a suiable pass for this manager.
+  // If this pass does not preserve analysis that is used by other passes
+  // managed by this manager than it is not a suitable pass for this manager.
   if (!manageablePass(P))
     return false;
 
@@ -1026,7 +1020,7 @@
       recordAvailableAnalysis(P);
       removeDeadPasses(P, Msg2);
     }
-  return Changed | doFinalization(F);
+  return Changed |= doFinalization(F);
 }
 
 // Implement doInitialization and doFinalization
@@ -1197,8 +1191,8 @@
   if (!FP)
     return false;
 
-  // If this pass does not preserve anlysis that is used by other passes
-  // managed by this manager than it is not a suiable pass for this manager.
+  // If this pass does not preserve analysis that is used by other passes
+  // managed by this manager than it is not a suitable pass for this manager.
   if (!manageablePass(P))
     return false;
 
@@ -1224,7 +1218,7 @@
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
     this->runOnFunction(*I);
 
-  return Changed | doFinalization(M);
+  return Changed |= doFinalization(M);
 }
 
 /// Execute all of the passes scheduled for execution by invoking 
@@ -1366,8 +1360,8 @@
   if (!MP)
     return false;
 
-  // If this pass does not preserve anlysis that is used by other passes
-  // managed by this manager than it is not a suiable pass for this manager.
+  // If this pass does not preserve analysis that is used by other passes
+  // managed by this manager than it is not a suitable pass for this manager.
   if (!manageablePass(P))
     return false;
 






More information about the llvm-commits mailing list