1 //=- llvm/Analysis/PostDominators.h - Post Dominator Calculation -*- C++ -*--=//
3 // This file exposes interfaces to post dominance information.
5 //===----------------------------------------------------------------------===//
7 #ifndef LLVM_ANALYSIS_POST_DOMINATORS_H
8 #define LLVM_ANALYSIS_POST_DOMINATORS_H
10 #include "llvm/Analysis/Dominators.h"
13 //===-------------------------------------
14 // DominatorSet Class - Concrete subclass of DominatorSetBase that is used to
15 // compute the post-dominator set.
17 struct PostDominatorSet : public DominatorSetBase {
18 PostDominatorSet() : DominatorSetBase(true) {}
20 virtual bool runOnFunction(Function &F);
22 // getAnalysisUsage - This obviously provides a dominator set, but it also
23 // uses the UnifyFunctionExitNode pass if building post-dominators
25 virtual void getAnalysisUsage(AnalysisUsage &AU) const;
30 //===-------------------------------------
31 // ImmediatePostDominators Class - Concrete subclass of ImmediateDominatorsBase
32 // that is used to compute the immediate post-dominators.
34 struct ImmediatePostDominators : public ImmediateDominatorsBase {
35 ImmediatePostDominators() : ImmediateDominatorsBase(true) {}
37 virtual bool runOnFunction(Function &F) {
38 IDoms.clear(); // Reset from the last time we were run...
39 PostDominatorSet &DS = getAnalysis<PostDominatorSet>();
45 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
47 AU.addRequired<PostDominatorSet>();
52 //===-------------------------------------
53 // PostDominatorTree Class - Concrete subclass of DominatorTree that is used to
54 // compute the a post-dominator tree.
56 struct PostDominatorTree : public DominatorTreeBase {
57 PostDominatorTree() : DominatorTreeBase(true) {}
59 virtual bool runOnFunction(Function &F) {
60 reset(); // Reset from the last time we were run...
61 PostDominatorSet &DS = getAnalysis<PostDominatorSet>();
67 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
69 AU.addRequired<PostDominatorSet>();
72 void calculate(const PostDominatorSet &DS);
76 //===-------------------------------------
77 // PostDominanceFrontier Class - Concrete subclass of DominanceFrontier that is
78 // used to compute the a post-dominance frontier.
80 struct PostDominanceFrontier : public DominanceFrontierBase {
81 PostDominanceFrontier() : DominanceFrontierBase(true) {}
83 virtual bool runOnFunction(Function &) {
85 PostDominatorTree &DT = getAnalysis<PostDominatorTree>();
87 calculate(DT, DT[Root]);
91 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
93 AU.addRequired<PostDominatorTree>();
96 // stub - dummy function, just ignore it
100 const DomSetType &calculate(const PostDominatorTree &DT,
101 const DominatorTree::Node *Node);
104 // Make sure that any clients of this file link in PostDominators.cpp
106 POST_DOMINATOR_INCLUDE_FILE((void*)&PostDominanceFrontier::stub);