[llvm-commits] CVS: llvm/include/llvm/Analysis/Dominators.h ET-Forest.h

Owen Anderson resistor at mac.com
Tue Apr 17 22:25:27 PDT 2007



Changes in directory llvm/include/llvm/Analysis:

Dominators.h updated: 1.73 -> 1.74
ET-Forest.h updated: 1.9 -> 1.10
---
Log message:

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


---
Diffs of the changes:  (+22 -0)

 Dominators.h |   14 ++++++++++++++
 ET-Forest.h  |    8 ++++++++
 2 files changed, 22 insertions(+)


Index: llvm/include/llvm/Analysis/Dominators.h
diff -u llvm/include/llvm/Analysis/Dominators.h:1.73 llvm/include/llvm/Analysis/Dominators.h:1.74
--- llvm/include/llvm/Analysis/Dominators.h:1.73	Tue Apr 17 23:38:39 2007
+++ llvm/include/llvm/Analysis/Dominators.h	Wed Apr 18 00:25:09 2007
@@ -327,6 +327,20 @@
     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: llvm/include/llvm/Analysis/ET-Forest.h
diff -u llvm/include/llvm/Analysis/ET-Forest.h:1.9 llvm/include/llvm/Analysis/ET-Forest.h:1.10
--- llvm/include/llvm/Analysis/ET-Forest.h:1.9	Wed Feb 21 13:57:33 2007
+++ llvm/include/llvm/Analysis/ET-Forest.h	Wed Apr 18 00:25:09 2007
@@ -275,6 +275,14 @@
     return DFSNumOut;
   }
 
+  const ETNode *getSon() const {
+    return Son;
+  }
+  
+  const ETNode *getBrother() const {
+    return Left;
+  }
+
  private:
   // Data represented by the node
   void *data;






More information about the llvm-commits mailing list