]>
Commit | Line | Data |
---|---|---|
223e47cc LB |
1 | //===- DominanceFrontier.cpp - Dominance Frontier Calculation -------------===// |
2 | // | |
3 | // The LLVM Compiler Infrastructure | |
4 | // | |
5 | // This file is distributed under the University of Illinois Open Source | |
6 | // License. See LICENSE.TXT for details. | |
7 | // | |
8 | //===----------------------------------------------------------------------===// | |
9 | ||
10 | #include "llvm/Analysis/DominanceFrontier.h" | |
1a4d82fc JJ |
11 | #include "llvm/Analysis/DominanceFrontierImpl.h" |
12 | ||
223e47cc LB |
13 | using namespace llvm; |
14 | ||
1a4d82fc JJ |
15 | namespace llvm { |
16 | template class DominanceFrontierBase<BasicBlock>; | |
17 | template class ForwardDominanceFrontierBase<BasicBlock>; | |
18 | } | |
19 | ||
223e47cc | 20 | char DominanceFrontier::ID = 0; |
1a4d82fc | 21 | |
223e47cc LB |
22 | INITIALIZE_PASS_BEGIN(DominanceFrontier, "domfrontier", |
23 | "Dominance Frontier Construction", true, true) | |
1a4d82fc | 24 | INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) |
223e47cc LB |
25 | INITIALIZE_PASS_END(DominanceFrontier, "domfrontier", |
26 | "Dominance Frontier Construction", true, true) | |
27 | ||
1a4d82fc JJ |
28 | DominanceFrontier::DominanceFrontier() |
29 | : FunctionPass(ID), | |
30 | Base() { | |
31 | initializeDominanceFrontierPass(*PassRegistry::getPassRegistry()); | |
223e47cc LB |
32 | } |
33 | ||
1a4d82fc JJ |
34 | void DominanceFrontier::releaseMemory() { |
35 | Base.releaseMemory(); | |
36 | } | |
223e47cc | 37 | |
1a4d82fc JJ |
38 | bool DominanceFrontier::runOnFunction(Function &) { |
39 | releaseMemory(); | |
40 | Base.analyze(getAnalysis<DominatorTreeWrapperPass>().getDomTree()); | |
41 | return false; | |
42 | } | |
223e47cc | 43 | |
1a4d82fc JJ |
44 | void DominanceFrontier::getAnalysisUsage(AnalysisUsage &AU) const { |
45 | AU.setPreservesAll(); | |
46 | AU.addRequired<DominatorTreeWrapperPass>(); | |
223e47cc LB |
47 | } |
48 | ||
1a4d82fc JJ |
49 | void DominanceFrontier::print(raw_ostream &OS, const Module *) const { |
50 | Base.print(OS); | |
223e47cc LB |
51 | } |
52 | ||
53 | #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) | |
1a4d82fc | 54 | void DominanceFrontier::dump() const { |
223e47cc LB |
55 | print(dbgs()); |
56 | } | |
57 | #endif |