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

Devang Patel dpatel at apple.com
Mon Jun 4 09:22:56 PDT 2007



Changes in directory llvm/include/llvm/Analysis:

Dominators.h updated: 1.85 -> 1.86
---
Log message:

Add basic block level interface to change immediate dominator
and create new node.


---
Diffs of the changes:  (+12 -3)

 Dominators.h |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)


Index: llvm/include/llvm/Analysis/Dominators.h
diff -u llvm/include/llvm/Analysis/Dominators.h:1.85 llvm/include/llvm/Analysis/Dominators.h:1.86
--- llvm/include/llvm/Analysis/Dominators.h:1.85	Sun Jun  3 19:32:21 2007
+++ llvm/include/llvm/Analysis/Dominators.h	Mon Jun  4 11:22:33 2007
@@ -110,7 +110,7 @@
 /// DominatorTree - Calculate the immediate dominator tree for a function.
 ///
 class DominatorTreeBase : public DominatorBase {
-public:
+
 protected:
   std::map<BasicBlock*, DomTreeNode*> DomTreeNodes;
   void reset();
@@ -118,6 +118,7 @@
 
   DomTreeNode *RootNode;
 
+  // Information record used during immediate dominators computation.
   struct InfoRec {
     unsigned Semi;
     unsigned Size;
@@ -136,8 +137,7 @@
   // Info - Collection of information used during the computation of idoms.
   std::map<BasicBlock*, InfoRec> Info;
 
-public:
-public:
+  public:
   DominatorTreeBase(intptr_t ID, bool isPostDom) 
     : DominatorBase(ID, isPostDom) {}
   ~DominatorTreeBase() { reset(); }
@@ -180,6 +180,10 @@
     return DomTreeNodes[BB] = IDomNode->addChild(new DomTreeNode(BB, IDomNode));
   }
 
+  void createNewNode(BasicBlock *BB, BasicBlock *DomBB) {
+    createNewNode(BB, getNode(DomBB));
+  }
+
   /// changeImmediateDominator - This method is used to update the dominator
   /// tree information when a node's immediate dominator changes.
   ///
@@ -188,6 +192,11 @@
     N->setIDom(NewIDom);
   }
 
+  void changeImmediateDominator(BasicBlock *BB, BasicBlock *NewBB) {
+    changeImmediateDominator(getNode(BB), getNode(NewBB));
+  }
+
+
   /// removeNode - Removes a node from the dominator tree.  Block must not
   /// dominate any other blocks.  Invalidates any node pointing to removed
   /// block.






More information about the llvm-commits mailing list