OSDN Git Service

Add accessor to get the blocks immediately dominated by a given block to ETForest.
authorOwen Anderson <resistor@mac.com>
Wed, 18 Apr 2007 05:25:09 +0000 (05:25 +0000)
committerOwen Anderson <resistor@mac.com>
Wed, 18 Apr 2007 05:25:09 +0000 (05:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36251 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/Dominators.h
include/llvm/Analysis/ET-Forest.h

index c8e753c..778b4ea 100644 (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();
index f41e1f5..8bd5e44 100644 (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;