Add an accessor to make ETForest more useful.
authorOwen Anderson <resistor@mac.com>
Wed, 18 Apr 2007 04:38:39 +0000 (04:38 +0000)
committerOwen Anderson <resistor@mac.com>
Wed, 18 Apr 2007 04:38:39 +0000 (04:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36246 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/Dominators.h

index c550fe0d30816711c49f4d45992dd35e744acae0..c8e753c149573a7a4040583d94d4cb99f8f047a3 100644 (file)
@@ -320,6 +320,13 @@ public:
       return NULL;
     return Common->getData<BasicBlock>();
   }
+  
+  /// Return the immediate dominator of A.
+  BasicBlock *getIDom(BasicBlock *A) {
+    ETNode *NodeA = getNode(A);
+    const ETNode *idom = NodeA->getFather();
+    return idom ? idom->getData<BasicBlock>() : 0;
+  }
 
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
     AU.setPreservesAll();