Tidy up PMStack. Add a bunch of consts, use std::vector instead of
authorDan Gohman <gohman@apple.com>
Sat, 7 Aug 2010 00:53:01 +0000 (00:53 +0000)
committerDan Gohman <gohman@apple.com>
Sat, 7 Aug 2010 00:53:01 +0000 (00:53 +0000)
std::deque, since this is a stack and only supports push/pop on
one end, and remove an unimplemented declaration.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110495 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/LoopPass.h
include/llvm/PassManagers.h

index 3e1c2a941802fa4b66c44842c0fe8e6608579f83..0d92de79f9c371fe65711fcfe43df39ce9b80637 100644 (file)
@@ -19,6 +19,7 @@
 #include "llvm/Pass.h"
 #include "llvm/PassManagers.h"
 #include "llvm/Function.h"
+#include <deque>
 
 namespace llvm {
 
index 1f9b9821d59f7d42fbe9a19cfa3666ce3a4848bb..c592a084afc4074fab1b0c47609182c3eebce6fc 100644 (file)
@@ -18,7 +18,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/DenseMap.h"
-#include <deque>
+#include <vector>
 #include <map>
 
 //===----------------------------------------------------------------------===//
@@ -138,30 +138,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;
 };