1 //=- llvm/Analysis/PostDominators.h - Post Dominator Calculation-*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file exposes interfaces to post dominance information.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_ANALYSIS_POST_DOMINATORS_H
15 #define LLVM_ANALYSIS_POST_DOMINATORS_H
17 #include "llvm/Analysis/Dominators.h"
21 /// PostDominatorTree Class - Concrete subclass of DominatorTree that is used to
22 /// compute the a post-dominator tree.
24 struct PostDominatorTree : public DominatorTreeBase {
25 static char ID; // Pass identification, replacement for typeid
28 DominatorTreeBase((intptr_t)&ID, true) {}
30 virtual bool runOnFunction(Function &F);
32 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
36 friend void PDTcalculate(PostDominatorTree& PDT, Function &F);
40 /// PostDominanceFrontier Class - Concrete subclass of DominanceFrontier that is
41 /// used to compute the a post-dominance frontier.
43 struct PostDominanceFrontier : public DominanceFrontierBase {
45 PostDominanceFrontier()
46 : DominanceFrontierBase((intptr_t) &ID, true) {}
48 virtual bool runOnFunction(Function &) {
50 PostDominatorTree &DT = getAnalysis<PostDominatorTree>();
51 Roots = DT.getRoots();
52 if (const DomTreeNode *Root = DT.getRootNode())
57 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
59 AU.addRequired<PostDominatorTree>();
63 const DomSetType &calculate(const PostDominatorTree &DT,
64 const DomTreeNode *Node);
67 } // End llvm namespace
69 // Make sure that any clients of this file link in PostDominators.cpp
70 FORCE_DEFINING_FILE_TO_BE_LINKED(PostDominanceFrontier)