diff options
author | Devang Patel <dpatel@apple.com> | 2007-06-04 16:22:33 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-06-04 16:22:33 +0000 |
commit | 26a6908768a0139fff72bc07908d55872cba136b (patch) | |
tree | 0127f5ccd2c62f22f25645dbfe73e90c0cf4e629 /include/llvm/Analysis/Dominators.h | |
parent | 39833585556a69de12053ca1e104fe7edfd86cbd (diff) | |
download | external_llvm-26a6908768a0139fff72bc07908d55872cba136b.zip external_llvm-26a6908768a0139fff72bc07908d55872cba136b.tar.gz external_llvm-26a6908768a0139fff72bc07908d55872cba136b.tar.bz2 |
Add basic block level interface to change immediate dominator
and create new node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37414 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/Dominators.h')
-rw-r--r-- | include/llvm/Analysis/Dominators.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 29612dc..f36afd4 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -110,7 +110,7 @@ private: /// DominatorTree - Calculate the immediate dominator tree for a function. /// class DominatorTreeBase : public DominatorBase { -public: + protected: std::map<BasicBlock*, DomTreeNode*> DomTreeNodes; void reset(); @@ -118,6 +118,7 @@ protected: DomTreeNode *RootNode; + // Information record used during immediate dominators computation. struct InfoRec { unsigned Semi; unsigned Size; @@ -136,8 +137,7 @@ protected: // Info - Collection of information used during the computation of idoms. std::map<BasicBlock*, InfoRec> Info; -public: -public: + public: DominatorTreeBase(intptr_t ID, bool isPostDom) : DominatorBase(ID, isPostDom) {} ~DominatorTreeBase() { reset(); } @@ -180,6 +180,10 @@ public: return DomTreeNodes[BB] = IDomNode->addChild(new DomTreeNode(BB, IDomNode)); } + void createNewNode(BasicBlock *BB, BasicBlock *DomBB) { + createNewNode(BB, getNode(DomBB)); + } + /// changeImmediateDominator - This method is used to update the dominator /// tree information when a node's immediate dominator changes. /// @@ -188,6 +192,11 @@ public: N->setIDom(NewIDom); } + void changeImmediateDominator(BasicBlock *BB, BasicBlock *NewBB) { + changeImmediateDominator(getNode(BB), getNode(NewBB)); + } + + /// removeNode - Removes a node from the dominator tree. Block must not /// dominate any other blocks. Invalidates any node pointing to removed /// block. |