Don't attribute in file headers anymore. See llvmdev for the
[oota-llvm.git] / include / llvm / Analysis / PostDominators.h
index d87f60465bb7d712d0495ef4da85a560746a83a1..77ce4cddd252439ca551aa0496939334786deaf8 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -21,23 +21,39 @@ namespace llvm {
 /// PostDominatorTree Class - Concrete subclass of DominatorTree that is used to
 /// compute the a post-dominator tree.
 ///
-struct PostDominatorTree : public DominatorTreeBase {
+struct PostDominatorTree : public FunctionPass {
   static char ID; // Pass identification, replacement for typeid
+  DominatorTreeBase<BasicBlock>* DT;
 
-  PostDominatorTree() : 
-    DominatorTreeBase((intptr_t)&ID, true) {}
-
-  virtual bool runOnFunction(Function &F) {
-    reset();     // Reset from the last time we were run...
-    PDTcalculate(*this, F);
-    return false;
+  PostDominatorTree() : FunctionPass((intptr_t)&ID) {
+    DT = new DominatorTreeBase<BasicBlock>(true);
   }
 
+  virtual bool runOnFunction(Function &F);
+
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
     AU.setPreservesAll();
   }
-private:
-  friend void PDTcalculate(PostDominatorTree& PDT, Function &F);
+  
+  inline const std::vector<BasicBlock*> &getRoots() const {
+    return DT->getRoots();
+  }
+  
+  inline DomTreeNode *getRootNode() const {
+    return DT->getRootNode();
+  }
+  
+  inline DomTreeNode *operator[](BasicBlock *BB) const {
+    return DT->getNode(BB);
+  }
+  
+  inline bool properlyDominates(const DomTreeNode* A, DomTreeNode* B) const {
+    return DT->properlyDominates(A, B);
+  }
+  
+  inline bool properlyDominates(BasicBlock* A, BasicBlock* B) const {
+    return DT->properlyDominates(A, B);
+  }
 };