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

llvm-svn: 36251
This commit is contained in:
Owen Anderson 2007-04-18 05:25:09 +00:00
parent 4c53d321aa
commit 9749c4744e
2 changed files with 22 additions and 0 deletions

View File

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

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;