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

Devang Patel dpatel at apple.com
Mon Jun 11 17:55:10 PDT 2007



Changes in directory llvm/include/llvm/Analysis:

Dominators.h updated: 1.102 -> 1.103
PostDominators.h updated: 1.23 -> 1.24
---
Log message:

Break DominatorTree from ETNode.
Remove unused PostETForest.


---
Diffs of the changes:  (+4 -54)

 Dominators.h     |   34 ++++------------------------------
 PostDominators.h |   24 ------------------------
 2 files changed, 4 insertions(+), 54 deletions(-)


Index: llvm/include/llvm/Analysis/Dominators.h
diff -u llvm/include/llvm/Analysis/Dominators.h:1.102 llvm/include/llvm/Analysis/Dominators.h:1.103
--- llvm/include/llvm/Analysis/Dominators.h:1.102	Mon Jun 11 19:14:41 2007
+++ llvm/include/llvm/Analysis/Dominators.h	Mon Jun 11 19:54:38 2007
@@ -63,7 +63,6 @@
 class DomTreeNode {
   BasicBlock *TheBB;
   DomTreeNode *IDom;
-  ETNode *ETN;
   std::vector<DomTreeNode*> Children;
   int DFSNumIn, DFSNumOut;
 
@@ -78,14 +77,10 @@
   
   inline BasicBlock *getBlock() const { return TheBB; }
   inline DomTreeNode *getIDom() const { return IDom; }
-  inline ETNode *getETNode() const { return ETN; }
   inline const std::vector<DomTreeNode*> &getChildren() const { return Children; }
   
-  inline DomTreeNode(BasicBlock *BB, DomTreeNode *iDom, ETNode *E) 
-    : TheBB(BB), IDom(iDom), ETN(E), DFSNumIn(-1), DFSNumOut(-1) {
-    if (IDom)
-      ETN->setFather(IDom->getETNode());
-  }
+  inline DomTreeNode(BasicBlock *BB, DomTreeNode *iDom)
+    : TheBB(BB), IDom(iDom), DFSNumIn(-1), DFSNumOut(-1) { }
   inline DomTreeNode *addChild(DomTreeNode *C) { Children.push_back(C); return C; }
   void setIDom(DomTreeNode *NewIDom);
 
@@ -111,9 +106,6 @@
   DomTreeNodeMapType DomTreeNodes;
   DomTreeNode *RootNode;
 
-  typedef std::map<BasicBlock*, ETNode*> ETMapType;
-  ETMapType ETNodes;
-
   bool DFSInfoValid;
   unsigned int SlowQueries;
   // Information record used during immediate dominators computation.
@@ -197,17 +189,6 @@
 
   void updateDFSNumbers();  
 
-  /// Return the nearest common dominator of A and B.
-  BasicBlock *nearestCommonDominator(BasicBlock *A, BasicBlock *B) const  {
-    ETNode *NodeA = getNode(A)->getETNode();
-    ETNode *NodeB = getNode(B)->getETNode();
-    
-    ETNode *Common = NodeA->NCA(NodeB);
-    if (!Common)
-      return NULL;
-    return Common->getData<BasicBlock>();
-  }
-
   /// isReachableFromEntry - Return true if A is dominated by the entry
   /// block of the function containing it.
   const bool isReachableFromEntry(BasicBlock* A);
@@ -222,12 +203,8 @@
     if (A == 0 || B == 0)
       return false;
 
-    ETNode *NodeA = A->getETNode();
-    ETNode *NodeB = B->getETNode();
-    
     if (DFSInfoValid)
       return B->DominatedBy(A);
-      //return NodeB->DominatedBy(NodeA);
 
     // If we end up with too many slow queries, just update the
     // DFS numbers on the theory that we are going to keep querying.
@@ -235,9 +212,8 @@
     if (SlowQueries > 32) {
       updateDFSNumbers();
       return B->DominatedBy(A);
-      //return NodeB->DominatedBy(NodeA);
     }
-    //return NodeB->DominatedBySlow(NodeA);
+
     return dominatedBySlowTreeWalk(A, B);
   }
 
@@ -268,10 +244,8 @@
     DomTreeNode *IDomNode = getNode(DomBB);
     assert(IDomNode && "Not immediate dominator specified for block!");
     DFSInfoValid = false;
-    ETNode *E = new ETNode(BB);
-    ETNodes[BB] = E;
     return DomTreeNodes[BB] = 
-      IDomNode->addChild(new DomTreeNode(BB, IDomNode, E));
+      IDomNode->addChild(new DomTreeNode(BB, IDomNode));
   }
 
   /// changeImmediateDominator - This method is used to update the dominator


Index: llvm/include/llvm/Analysis/PostDominators.h
diff -u llvm/include/llvm/Analysis/PostDominators.h:1.23 llvm/include/llvm/Analysis/PostDominators.h:1.24
--- llvm/include/llvm/Analysis/PostDominators.h:1.23	Sun Jun  3 19:32:21 2007
+++ llvm/include/llvm/Analysis/PostDominators.h	Mon Jun 11 19:54:38 2007
@@ -51,30 +51,6 @@
 };
 
 
-/// PostETForest Class - Concrete subclass of ETForestBase that is used to
-/// compute a forwards post-dominator ET-Forest.
-struct PostETForest : public ETForestBase {
-  static char ID;
-  PostETForest() : ETForestBase((intptr_t)&ID, true) {}
-
-  virtual void getAnalysisUsage(AnalysisUsage &AU) const {
-    AU.setPreservesAll();
-    AU.addRequired<PostDominatorTree>();
-  }
-
-  virtual bool runOnFunction(Function &F) {
-    reset();     // Reset from the last time we were run...
-    PostDominatorTree &DT = getAnalysis<PostDominatorTree>();
-    Roots = DT.getRoots();
-    calculate(DT);
-    return false;
-  }
-
-  void calculate(const PostDominatorTree &DT);
-  ETNode *getNodeForBlock(BasicBlock *BB);
-};
-
-
 /// PostDominanceFrontier Class - Concrete subclass of DominanceFrontier that is
 /// used to compute the a post-dominance frontier.
 ///






More information about the llvm-commits mailing list