More #include cleanups.
[oota-llvm.git] / include / llvm / PassManagers.h
index d5685c664c23e79b2b9115f726984f7ca095b095..4ef73b878ae8b435773fe224b026370ab9d788eb 100644 (file)
 #ifndef LLVM_PASSMANAGERS_H
 #define LLVM_PASSMANAGERS_H
 
-#include "llvm/PassManager.h"
+#include "llvm/Pass.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/DenseMap.h"
-#include <deque>
+#include <vector>
 #include <map>
 
 //===----------------------------------------------------------------------===//
@@ -96,6 +96,7 @@ namespace llvm {
   class StringRef;
   class Value;
   class Timer;
+  class PMDataManager;
 
 /// FunctionPassManager and PassManager, two top level managers, serve 
 /// as the public interface of pass manager infrastructure.
@@ -138,30 +139,28 @@ public:
 //===----------------------------------------------------------------------===//
 // PMStack
 //
-/// PMStack
+/// PMStack - This class implements a stack data structure of PMDataManager
+/// pointers.
+///
 /// Top level pass managers (see PassManager.cpp) maintain active Pass Managers 
 /// using PMStack. Each Pass implements assignPassManager() to connect itself
 /// with appropriate manager. assignPassManager() walks PMStack to find
 /// suitable manager.
-///
-/// PMStack is just a wrapper around standard deque that overrides pop() and
-/// push() methods.
 class PMStack {
 public:
-  typedef std::deque<PMDataManager *>::reverse_iterator iterator;
-  iterator begin() { return S.rbegin(); }
-  iterator end() { return S.rend(); }
-
-  void handleLastUserOverflow();
+  typedef std::vector<PMDataManager *>::const_reverse_iterator iterator;
+  iterator begin() const { return S.rbegin(); }
+  iterator end() const { return S.rend(); }
 
   void pop();
-  inline PMDataManager *top() { return S.back(); }
+  PMDataManager *top() const { return S.back(); }
   void push(PMDataManager *PM);
-  inline bool empty() { return S.empty(); }
+  bool empty() const { return S.empty(); }
+
+  void dump() const;
 
-  void dump();
 private:
-  std::deque<PMDataManager *> S;
+  std::vector<PMDataManager *> S;
 };
 
 
@@ -302,10 +301,7 @@ public:
   /// through getAnalysis interface.
   virtual void addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass);
 
-  virtual Pass * getOnTheFlyPass(Pass *P, const PassInfo *PI, Function &F) {
-    assert (0 && "Unable to find on the fly pass");
-    return NULL;
-  }
+  virtual Pass *getOnTheFlyPass(Pass *P, AnalysisID PI, Function &F);
 
   /// Initialize available analysis information.
   void initializeAnalysisInfo() { 
@@ -413,12 +409,11 @@ private:
 /// It batches all function passes and basic block pass managers together and 
 /// sequence them to process one function at a time before processing next 
 /// function.
-
 class FPPassManager : public ModulePass, public PMDataManager {
 public:
   static char ID;
   explicit FPPassManager(int Depth) 
-  : ModulePass(&ID), PMDataManager(Depth) { }
+  : ModulePass(ID), PMDataManager(Depth) { }
   
   /// run - Execute all of the passes scheduled for execution.  Keep track of
   /// whether any of the passes modifies the module, and if so, return true.
@@ -462,8 +457,7 @@ public:
   }
 };
 
-extern Timer *StartPassTimer(Pass *);
-extern void StopPassTimer(Pass *, Timer *);
+Timer *getPassTimer(Pass *);
 
 }