diff options
author | Owen Anderson <resistor@mac.com> | 2007-10-23 20:58:37 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2007-10-23 20:58:37 +0000 |
commit | d20cc14dbf6d54d896e67b9920cd9bccdc14c41a (patch) | |
tree | b79b117fe5e3ab6d2046c2adecc3c604549b7869 /include | |
parent | 7bb175b4d12e3a22a66a26f0e9ba2ebd4406acc7 (diff) |
Make DomTree and PostDomTree thin wrappers around DomTreeBase, rather than inheriting from it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43259 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/PostDominators.h | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h index 71b06e2877..ca9f6b192a 100644 --- a/include/llvm/Analysis/PostDominators.h +++ b/include/llvm/Analysis/PostDominators.h @@ -21,17 +21,39 @@ namespace llvm { /// PostDominatorTree Class - Concrete subclass of DominatorTree that is used to /// compute the a post-dominator tree. /// -struct PostDominatorTree : public DominatorTreeBase<BasicBlock> { +struct PostDominatorTree : public FunctionPass { static char ID; // Pass identification, replacement for typeid + DominatorTreeBase<BasicBlock>* DT; - PostDominatorTree() : - DominatorTreeBase<BasicBlock>((intptr_t)&ID, true) {} + PostDominatorTree() : FunctionPass((intptr_t)&ID) { + DT = new DominatorTreeBase<BasicBlock>(intptr_t(&ID), true); + } virtual bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); } + + inline const std::vector<BasicBlock*> &getRoots() const { + return DT->getRoots(); + } + + inline DomTreeNode *getRootNode() const { + return DT->getRootNode(); + } + + inline DomTreeNode *operator[](BasicBlock *BB) const { + return DT->getNode(BB); + } + + inline bool properlyDominates(const DomTreeNode* A, DomTreeNode* B) const { + return DT->properlyDominates(A, B); + } + + inline bool properlyDominates(BasicBlock* A, BasicBlock* B) const { + return DT->properlyDominates(A, B); + } }; |