Add default constructor to APSInt
[oota-llvm.git] / include / llvm / PassManagers.h
index c9944b5c87f3082530127f2c6eb1be89a81171d7..f8e1308c235b4b3a74f158f920ba4832ba592f95 100644 (file)
@@ -13,6 +13,8 @@
 
 #include "llvm/PassManager.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/DenseMap.h"
 #include <deque>
 #include <map>
 
@@ -172,6 +174,9 @@ public:
   /// then return NULL.
   Pass *findAnalysisPass(AnalysisID AID);
 
+  /// Find analysis usage information for the pass P.
+  AnalysisUsage *findAnalysisUsage(Pass *P);
+
   explicit PMTopLevelManager(enum TopLevelManagerType t);
   virtual ~PMTopLevelManager(); 
 
@@ -181,7 +186,7 @@ public:
     ImmutablePasses.push_back(P);
   }
 
-  inline std::vector<ImmutablePass *>& getImmutablePasses() {
+  inline SmallVector<ImmutablePass *, 8>& getImmutablePasses() {
     return ImmutablePasses;
   }
 
@@ -207,20 +212,27 @@ public:
 protected:
   
   /// Collection of pass managers
-  std::vector<PMDataManager *> PassManagers;
+  SmallVector<PMDataManager *, 8> PassManagers;
 
 private:
 
   /// Collection of pass managers that are not directly maintained
   /// by this pass manager
-  std::vector<PMDataManager *> IndirectPassManagers;
+  SmallVector<PMDataManager *, 8> IndirectPassManagers;
 
   // Map to keep track of last user of the analysis pass.
   // LastUser->second is the last user of Lastuser->first.
-  std::map<Pass *, Pass *> LastUser;
+  DenseMap<Pass *, Pass *> LastUser;
+
+  // Map to keep track of passes that are last used by a pass.
+  // This inverse map is initialized at PM->run() based on
+  // LastUser map.
+  DenseMap<Pass *, SmallPtrSet<Pass *, 8> > InversedLastUser;
 
   /// Immutable passes are managed by top level manager.
-  std::vector<ImmutablePass *> ImmutablePasses;
+  SmallVector<ImmutablePass *, 8> ImmutablePasses;
+
+  DenseMap<Pass *, AnalysisUsage *> AnUsageMap;
 };
 
 
@@ -308,8 +320,8 @@ public:
   void dumpPassArguments() const;
   void dumpPassInfo(Pass *P, enum PassDebuggingString S1,
                     enum PassDebuggingString S2, const char *Msg);
-  void dumpAnalysisSetInfo(const char *Msg, Pass *P,
-                           const AnalysisUsage::VectorType &Set) const;
+  void dumpRequiredSet(const Pass *P) const;
+  void dumpPreservedSet(const Pass *P) const;
 
   virtual unsigned getNumContainedPasses() const {
     return (unsigned)PassVector.size();
@@ -338,7 +350,7 @@ protected:
   PMTopLevelManager *TPM;
 
   // Collection of pass that are managed by this manager
-  std::vector<Pass *> PassVector;
+  SmallVector<Pass *, 16> PassVector;
 
   // Collection of Analysis provided by Parent pass manager and
   // used by current pass manager. At at time there can not be more
@@ -346,6 +358,9 @@ protected:
   std::map<AnalysisID, Pass *> *InheritedAnalysis[PMT_Last];
 
 private:
+  void dumpAnalysisUsage(const char *Msg, const Pass *P,
+                           const AnalysisUsage::VectorType &Set) const;
+
   // Set of available Analysis. This information is used while scheduling 
   // pass. If a pass requires an analysis which is not not available then 
   // equired analysis pass is scheduled to run before the pass itself is 
@@ -354,7 +369,7 @@ private:
 
   // Collection of higher level analysis used by the pass managed by
   // this manager.
-  std::vector<Pass *> HigherLevelAnalysis;
+  SmallVector<Pass *, 8> HigherLevelAnalysis;
 
   unsigned Depth;
 };