forked from OSchip/llvm-project
Add accessor to get the blocks immediately dominated by a given block to ETForest.
llvm-svn: 36251
This commit is contained in:
parent
4c53d321aa
commit
9749c4744e
|
@ -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>();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue