diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index c8e753c1495..778b4eab759 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() : 0; } + + void getChildren(BasicBlock *A, std::vector& children) { + ETNode *NodeA = getNode(A); + const ETNode* son = NodeA->getSon(); + + if (!son) return; + children.push_back(son->getData()); + + const ETNode* brother = son->getBrother(); + while (brother != son) { + children.push_back(brother->getData()); + 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 f41e1f59c9b..8bd5e447bca 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;