X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FAnalysis%2FPostDominators.h;h=9ec47a30644366efe02944c7794fd8784674aedb;hb=70416f80a7147ccecf1ae980b01c9064811c67a8;hp=3681cc01f3b7ebb70662370ef3c880c1f3da667b;hpb=d53e42efe93f6a716d082ad63862794da0e59895;p=oota-llvm.git diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h index 3681cc01f3b..9ec47a30644 100644 --- a/include/llvm/Analysis/PostDominators.h +++ b/include/llvm/Analysis/PostDominators.h @@ -11,10 +11,10 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_ANALYSIS_POST_DOMINATORS_H -#define LLVM_ANALYSIS_POST_DOMINATORS_H +#ifndef LLVM_ANALYSIS_POSTDOMINATORS_H +#define LLVM_ANALYSIS_POSTDOMINATORS_H -#include "llvm/Analysis/Dominators.h" +#include "llvm/IR/Dominators.h" namespace llvm { @@ -25,7 +25,8 @@ struct PostDominatorTree : public FunctionPass { static char ID; // Pass identification, replacement for typeid DominatorTreeBase* DT; - PostDominatorTree() : FunctionPass(&ID) { + PostDominatorTree() : FunctionPass(ID) { + initializePostDominatorTreePass(*PassRegistry::getPassRegistry()); DT = new DominatorTreeBase(true); } @@ -69,6 +70,21 @@ struct PostDominatorTree : public FunctionPass { return DT->properlyDominates(A, B); } + inline BasicBlock *findNearestCommonDominator(BasicBlock *A, BasicBlock *B) { + return DT->findNearestCommonDominator(A, B); + } + + inline const BasicBlock *findNearestCommonDominator(const BasicBlock *A, + const BasicBlock *B) { + return DT->findNearestCommonDominator(A, B); + } + + /// Get all nodes post-dominated by R, including R itself. + void getDescendants(BasicBlock *R, + SmallVectorImpl &Result) const { + DT->getDescendants(R, Result); + } + virtual void releaseMemory() { DT->releaseMemory(); } @@ -96,35 +112,6 @@ template <> struct GraphTraits } }; -/// PostDominanceFrontier Class - Concrete subclass of DominanceFrontier that is -/// used to compute the a post-dominance frontier. -/// -struct PostDominanceFrontier : public DominanceFrontierBase { - static char ID; - PostDominanceFrontier() - : DominanceFrontierBase(&ID, true) {} - - virtual bool runOnFunction(Function &) { - Frontiers.clear(); - PostDominatorTree &DT = getAnalysis(); - Roots = DT.getRoots(); - if (const DomTreeNode *Root = DT.getRootNode()) - calculate(DT, Root); - return false; - } - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - AU.addRequired(); - } - -private: - const DomSetType &calculate(const PostDominatorTree &DT, - const DomTreeNode *Node); -}; - -FunctionPass* createPostDomFrontier(); - } // End llvm namespace #endif