Convert to SymbolTable's new iteration interface.
[oota-llvm.git] / lib / VMCore / PassManagerT.h
index c5cac1d7fef36a92e0fee780ac6e5487484434ee..af5544cd98da6e1da0d0b04e94a298c03f3b4dfd 100644 (file)
@@ -31,8 +31,6 @@
 
 namespace llvm {
 
-class Annotable;
-
 //===----------------------------------------------------------------------===//
 // Pass debugging information.  Often it is useful to find out what pass is
 // running when a crash occurs in a utility.  When this library is compiled with
@@ -75,7 +73,9 @@ struct PMDebug {
   }
 
   static void PrintArgumentInformation(const Pass *P);
-  static void PrintPassInformation(unsigned,const char*,Pass *, Annotable *);
+  static void PrintPassInformation(unsigned,const char*,Pass *, Module *);
+  static void PrintPassInformation(unsigned,const char*,Pass *, Function *);
+  static void PrintPassInformation(unsigned,const char*,Pass *, BasicBlock *);
   static void PrintAnalysisSetInfo(unsigned,const char*,Pass *P,
                                    const std::vector<AnalysisID> &);
 };
@@ -208,7 +208,6 @@ public:
                                           E = LastUseOf.end(); I != E; ++I)
       LastUserOf[I->second].push_back(I->first);
 
-
     // Output debug information...
     if (Parent == 0) PMDebug::PerformPassStartupStuff(this);
 
@@ -216,8 +215,7 @@ public:
     for (unsigned i = 0, e = Passes.size(); i < e; ++i) {
       PassClass *P = Passes[i];
       
-      PMDebug::PrintPassInformation(getDepth(), "Executing Pass", P,
-                                    (Annotable*)M);
+      PMDebug::PrintPassInformation(getDepth(), "Executing Pass", P, M);
 
       // Get information about what analyses the pass uses...
       AnalysisUsage AnUsage;
@@ -259,8 +257,7 @@ public:
                                     P->getPassName() + "'");
 
       if (Changed)
-        PMDebug::PrintPassInformation(getDepth()+1, "Made Modification", P,
-                                      (Annotable*)M);
+        PMDebug::PrintPassInformation(getDepth()+1, "Made Modification", P, M);
       PMDebug::PrintAnalysisSetInfo(getDepth(), "Preserved", P,
                                     AnUsage.getPreservedSet());
 
@@ -301,8 +298,7 @@ public:
       std::vector<Pass*> &DeadPass = LastUserOf[P];
       for (std::vector<Pass*>::iterator I = DeadPass.begin(),E = DeadPass.end();
            I != E; ++I) {
-        PMDebug::PrintPassInformation(getDepth()+1, "Freeing Pass", *I,
-                                      (Annotable*)M);
+        PMDebug::PrintPassInformation(getDepth()+1, "Freeing Pass", *I, M);
         (*I)->releaseMemory();
       }
 
@@ -400,6 +396,16 @@ public:
 
     if (I != CurrentAnalyses.end()) {
       LastUseOf[I->second] = User;    // Local pass, extend the lifetime
+
+      // Prolong live range of analyses that are needed after an analysis pass
+      // is destroyed, for querying by subsequent passes
+      AnalysisUsage AnUsage;
+      I->second->getAnalysisUsage(AnUsage);
+      const std::vector<AnalysisID> &IDs = AnUsage.getRequiredTransitiveSet();
+      for (std::vector<AnalysisID>::const_iterator i = IDs.begin(),
+             e = IDs.end(); i != e; ++i)
+        markPassUsed(*i, User);
+
     } else {
       // Pass not in current available set, must be a higher level pass
       // available to us, propagate to parent pass manager...  We tell the