aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-10-23 21:42:49 +0000
committerOwen Anderson <resistor@mac.com>2007-10-23 21:42:49 +0000
commit7feb3be0b76c72134c515995b1a37466171cf83b (patch)
tree0f376bfd789860e69268a8ccc7cc5d93de20a7f0 /include
parentde09040946b4aa9bdc70057d65f840685ac31fef (diff)
downloadexternal_llvm-7feb3be0b76c72134c515995b1a37466171cf83b.zip
external_llvm-7feb3be0b76c72134c515995b1a37466171cf83b.tar.gz
external_llvm-7feb3be0b76c72134c515995b1a37466171cf83b.tar.bz2
Make DomTreeBase not a FunctionPass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43263 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/Dominators.h31
-rw-r--r--include/llvm/Analysis/PostDominators.h2
2 files changed, 23 insertions, 10 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index f1e374a..7e7f1a7 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -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(); }
diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h
index ca9f6b1..56e1e74 100644
--- a/include/llvm/Analysis/PostDominators.h
+++ b/include/llvm/Analysis/PostDominators.h
@@ -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);