[llvm-commits] CVS: llvm/include/llvm/Pass.h

Devang Patel dpatel at apple.com
Mon Jan 8 11:29:55 PST 2007



Changes in directory llvm/include/llvm:

Pass.h updated: 1.70 -> 1.71
---
Log message:

Add PMStack, a Pass Manager stack. 
Eventually, Top level pass managers  will use this to keep track of
active pass managers. Eass pass will also learn how to find appropriate
manager from these managers stack. 


---
Diffs of the changes:  (+32 -2)

 Pass.h |   34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/Pass.h
diff -u llvm/include/llvm/Pass.h:1.70 llvm/include/llvm/Pass.h:1.71
--- llvm/include/llvm/Pass.h:1.70	Fri Jan  5 16:47:07 2007
+++ llvm/include/llvm/Pass.h	Mon Jan  8 13:29:38 2007
@@ -31,6 +31,7 @@
 
 #include "llvm/Support/Streams.h"
 #include <vector>
+#include <deque>
 #include <map>
 #include <iosfwd>
 #include <typeinfo>
@@ -49,6 +50,7 @@
 class BasicBlockPassManager;
 class FunctionPassManagerT;
 class ModulePassManager;
+class PMStack;
 class AnalysisResolver;
 
 // AnalysisID - Use the PassInfo to identify a pass...
@@ -133,8 +135,6 @@
   // dumpPassStructure - Implement the -debug-passes=PassStructure option
   virtual void dumpPassStructure(unsigned Offset = 0);
 
-
-  // getPassInfo - Static method to get the pass information from a class name.
   template<typename AnalysisClass>
   static const PassInfo *getClassPassInfo() {
     return lookupPassInfo(typeid(AnalysisClass));
@@ -198,6 +198,7 @@
   virtual bool runPass(Module &M) { return runOnModule(M); }
   virtual bool runPass(BasicBlock&) { return false; }
 
+  virtual void assignPassManager(PMStack &PMS);
   // Force out-of-line virtual method.
   virtual ~ModulePass();
 };
@@ -263,6 +264,7 @@
   ///
   bool run(Function &F);
 
+  virtual void assignPassManager(PMStack &PMS);
 };
 
 
@@ -316,8 +318,36 @@
   virtual bool runPass(Module &M) { return false; }
   virtual bool runPass(BasicBlock &BB);
 
+  virtual void assignPassManager(PMStack &PMS);
+};
+
+/// PMStack
+/// Top level pass manager (see PasManager.cpp) maintains 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 PMDataManager;
+class PMStack {
+public:
+  typedef std::deque<PMDataManager *>::reverse_iterator iterator;
+  iterator begin() { return S.rbegin(); }
+  iterator end() { return S.rend(); }
+
+  void handleLastUserOverflow();
+
+  void pop();
+  inline PMDataManager *top() { return S.back(); }
+  void push(PMDataManager *PM);
+  inline bool empty() { return S.empty(); }
+
+private:
+  std::deque<PMDataManager *> S;
 };
 
+
 /// If the user specifies the -time-passes argument on an LLVM tool command line
 /// then the value of this boolean will be true, otherwise false.
 /// @brief This is the storage for the -time-passes option.






More information about the llvm-commits mailing list