Point people to ConstantExpr and ConstantFolding,
[oota-llvm.git] / include / llvm / PassManagers.h
index d37691311cf9f8db8cefd7c1abfb4390bfe9e41d..ff06024ed47e5ae0e59172e7b5ce9331b2ae289b 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>
 
@@ -28,8 +30,8 @@
 //
 // Pass Manager Infrastructure uses multiple pass managers.  They are
 // PassManager, FunctionPassManager, MPPassManager, FPPassManager, BBPassManager.
-// This class hierarcy uses multiple inheritance but pass managers do not derive
-// from another pass manager.
+// This class hierarchy uses multiple inheritance but pass managers do not
+// derive from another pass manager.
 //
 // PassManager and FunctionPassManager are two top-level pass manager that
 // represents the external interface of this entire pass manager infrastucture.
@@ -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(); 
 
@@ -217,10 +222,17 @@ private:
 
   // 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;
+
+  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 std::vector<AnalysisID> &Set) const;
+  void dumpRequiredSet(const Pass *P) const;
+  void dumpPreservedSet(const Pass *P) const;
 
   virtual unsigned getNumContainedPasses() const {
     return (unsigned)PassVector.size();
@@ -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