X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FAnalysis%2FPostDominators.h;h=77ce4cddd252439ca551aa0496939334786deaf8;hb=7ed47a13356daed2a34cd2209a31f92552e3bdd8;hp=06a42dac38d592daf1cb19d5d2bf363d95a1192f;hpb=04fa56932052f416ea911fe65615ebecbf154f6d;p=oota-llvm.git diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h index 06a42dac38d..77ce4cddd25 100644 --- a/include/llvm/Analysis/PostDominators.h +++ b/include/llvm/Analysis/PostDominators.h @@ -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,29 +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* 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(true); } + virtual bool runOnFunction(Function &F); + virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); } -private: - unsigned DFSPass(BasicBlock *V, unsigned N); - friend void PDTcalculate(PostDominatorTree& PDT, Function &F); - friend void PDTCompress(PostDominatorTree& PDT, BasicBlock *V, - InfoRec &VInfo); - friend BasicBlock *PDTEval(PostDominatorTree& PDT, BasicBlock *V); - friend void PDTLink(PostDominatorTree& PDT,BasicBlock *V, - BasicBlock *W, InfoRec &WInfo); + + inline const std::vector &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); + } };