aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-04-18 05:25:09 +0000
committerOwen Anderson <resistor@mac.com>2007-04-18 05:25:09 +0000
commit9e7919785ee375540a67622fa19f7d10592c3351 (patch)
treeaa81e199672af7f7dfa12c6d5e681100359c4fac /include
parentf44c72817e3a7f517ad796705effb8d59e6a6dfa (diff)
downloadexternal_llvm-9e7919785ee375540a67622fa19f7d10592c3351.zip
external_llvm-9e7919785ee375540a67622fa19f7d10592c3351.tar.gz
external_llvm-9e7919785ee375540a67622fa19f7d10592c3351.tar.bz2
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
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/Dominators.h14
-rw-r--r--include/llvm/Analysis/ET-Forest.h8
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;