mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 05:29:24 +00:00
Make DomTreeBase not a FunctionPass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43263 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
de09040946
commit
7feb3be0b7
@ -43,12 +43,12 @@ namespace llvm {
|
||||
/// inherit from.
|
||||
///
|
||||
template <class NodeT>
|
||||
class DominatorBase : public FunctionPass {
|
||||
class DominatorBase {
|
||||
protected:
|
||||
std::vector<NodeT*> Roots;
|
||||
const bool IsPostDominators;
|
||||
inline DominatorBase(intptr_t ID, bool isPostDom) :
|
||||
FunctionPass(ID), Roots(), IsPostDominators(isPostDom) {}
|
||||
inline DominatorBase(bool isPostDom) :
|
||||
Roots(), IsPostDominators(isPostDom) {}
|
||||
public:
|
||||
|
||||
/// getRoots - Return the root blocks of the current CFG. This may include
|
||||
@ -293,9 +293,9 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
DominatorTreeBase(intptr_t ID, bool isPostDom)
|
||||
: DominatorBase<NodeT>(ID, isPostDom), DFSInfoValid(false), SlowQueries(0) {}
|
||||
~DominatorTreeBase() { reset(); }
|
||||
DominatorTreeBase(bool isPostDom)
|
||||
: DominatorBase<NodeT>(isPostDom), DFSInfoValid(false), SlowQueries(0) {}
|
||||
virtual ~DominatorTreeBase() { reset(); }
|
||||
|
||||
// FIXME: Should remove this
|
||||
virtual bool runOnFunction(Function &F) { return false; }
|
||||
@ -658,7 +658,7 @@ public:
|
||||
DominatorTreeBase<BasicBlock>* DT;
|
||||
|
||||
DominatorTree() : FunctionPass(intptr_t(&ID)) {
|
||||
DT = new DominatorTreeBase<BasicBlock>(intptr_t(&ID), false);
|
||||
DT = new DominatorTreeBase<BasicBlock>(false);
|
||||
}
|
||||
|
||||
~DominatorTree() {
|
||||
@ -817,15 +817,28 @@ template <> struct GraphTraits<DominatorTree*>
|
||||
/// DominanceFrontierBase - Common base class for computing forward and inverse
|
||||
/// dominance frontiers for a function.
|
||||
///
|
||||
class DominanceFrontierBase : public DominatorBase<BasicBlock> {
|
||||
class DominanceFrontierBase : public FunctionPass {
|
||||
public:
|
||||
typedef std::set<BasicBlock*> DomSetType; // Dom set for a bb
|
||||
typedef std::map<BasicBlock*, DomSetType> DomSetMapType; // Dom set map
|
||||
protected:
|
||||
DomSetMapType Frontiers;
|
||||
std::vector<BasicBlock*> Roots;
|
||||
const bool IsPostDominators;
|
||||
|
||||
public:
|
||||
DominanceFrontierBase(intptr_t ID, bool isPostDom)
|
||||
: DominatorBase<BasicBlock>(ID, isPostDom) {}
|
||||
: FunctionPass(ID), IsPostDominators(isPostDom) {}
|
||||
|
||||
/// getRoots - Return the root blocks of the current CFG. This may include
|
||||
/// multiple blocks if we are computing post dominators. For forward
|
||||
/// dominators, this will always be a single block (the entry node).
|
||||
///
|
||||
inline const std::vector<BasicBlock*> &getRoots() const { return Roots; }
|
||||
|
||||
/// isPostDominator - Returns true if analysis based of postdoms
|
||||
///
|
||||
bool isPostDominator() const { return IsPostDominators; }
|
||||
|
||||
virtual void releaseMemory() { Frontiers.clear(); }
|
||||
|
||||
|
@ -26,7 +26,7 @@ struct PostDominatorTree : public FunctionPass {
|
||||
DominatorTreeBase<BasicBlock>* DT;
|
||||
|
||||
PostDominatorTree() : FunctionPass((intptr_t)&ID) {
|
||||
DT = new DominatorTreeBase<BasicBlock>(intptr_t(&ID), true);
|
||||
DT = new DominatorTreeBase<BasicBlock>(true);
|
||||
}
|
||||
|
||||
virtual bool runOnFunction(Function &F);
|
||||
|
Loading…
Reference in New Issue
Block a user