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"
11 #include "llvm/Analysis/DominanceFrontierImpl.h"
12 
13 using namespace llvm;
14 
15 namespace llvm {
16 template class DominanceFrontierBase<BasicBlock>;
17 template class ForwardDominanceFrontierBase<BasicBlock>;
18 }
19 
20 char DominanceFrontier::ID = 0;
21 
22 INITIALIZE_PASS_BEGIN(DominanceFrontier, "domfrontier",
23                 "Dominance Frontier Construction", true, true)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)24 INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
25 INITIALIZE_PASS_END(DominanceFrontier, "domfrontier",
26                 "Dominance Frontier Construction", true, true)
27 
28 DominanceFrontier::DominanceFrontier()
29   : FunctionPass(ID),
30     Base() {
31   initializeDominanceFrontierPass(*PassRegistry::getPassRegistry());
32 }
33 
releaseMemory()34 void DominanceFrontier::releaseMemory() {
35   Base.releaseMemory();
36 }
37 
runOnFunction(Function &)38 bool DominanceFrontier::runOnFunction(Function &) {
39   releaseMemory();
40   Base.analyze(getAnalysis<DominatorTreeWrapperPass>().getDomTree());
41   return false;
42 }
43 
getAnalysisUsage(AnalysisUsage & AU) const44 void DominanceFrontier::getAnalysisUsage(AnalysisUsage &AU) const {
45   AU.setPreservesAll();
46   AU.addRequired<DominatorTreeWrapperPass>();
47 }
48 
print(raw_ostream & OS,const Module *) const49 void DominanceFrontier::print(raw_ostream &OS, const Module *) const {
50   Base.print(OS);
51 }
52 
53 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
dump() const54 void DominanceFrontier::dump() const {
55   print(dbgs());
56 }
57 #endif
58