diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/Dominators.h | 14 | ||||
-rw-r--r-- | include/llvm/Analysis/ET-Forest.h | 8 |
2 files changed, 22 insertions, 0 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index c8e753c..778b4ea 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -327,6 +327,20 @@ public: const ETNode *idom = NodeA->getFather(); return idom ? idom->getData<BasicBlock>() : 0; } + + void getChildren(BasicBlock *A, std::vector<BasicBlock*>& children) { + ETNode *NodeA = getNode(A); + const ETNode* son = NodeA->getSon(); + + if (!son) return; + children.push_back(son->getData<BasicBlock>()); + + const ETNode* brother = son->getBrother(); + while (brother != son) { + children.push_back(brother->getData<BasicBlock>()); + brother = brother->getBrother(); + } + } virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); diff --git a/include/llvm/Analysis/ET-Forest.h b/include/llvm/Analysis/ET-Forest.h index f41e1f5..8bd5e44 100644 --- a/include/llvm/Analysis/ET-Forest.h +++ b/include/llvm/Analysis/ET-Forest.h @@ -275,6 +275,14 @@ public: return DFSNumOut; } + const ETNode *getSon() const { + return Son; + } + + const ETNode *getBrother() const { + return Left; + } + private: // Data represented by the node void *data; |