Add accessor to get the blocks immediately dominated by a given block to ETForest.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36251 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2007-04-18 05:25:09 +00:00
parent f44c72817e
commit 9e7919785e
2 changed files with 22 additions and 0 deletions

View File

@ -328,6 +328,20 @@ public:
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();
AU.addRequired<DominatorTree>();

View File

@ -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;