Tidy up PMStack. Add a bunch of consts, use std::vector instead of

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
This commit is contained in:
Dan Gohman 2010-08-07 00:53:01 +00:00
parent 11112e0d7b
commit 4bdeede8c7
2 changed files with 13 additions and 14 deletions

View File

@ -19,6 +19,7 @@
#include "llvm/Pass.h"
#include "llvm/PassManagers.h"
#include "llvm/Function.h"
#include <deque>
namespace llvm {

View 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;
};