]> git.proxmox.com Git - rustc.git/blame - src/llvm/lib/Analysis/DominanceFrontier.cpp
Imported Upstream version 1.0.0+dfsg1
[rustc.git] / src / llvm / lib / Analysis / DominanceFrontier.cpp
CommitLineData
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
13using namespace llvm;
14
1a4d82fc
JJ
15namespace llvm {
16template class DominanceFrontierBase<BasicBlock>;
17template class ForwardDominanceFrontierBase<BasicBlock>;
18}
19
223e47cc 20char DominanceFrontier::ID = 0;
1a4d82fc 21
223e47cc
LB
22INITIALIZE_PASS_BEGIN(DominanceFrontier, "domfrontier",
23 "Dominance Frontier Construction", true, true)
1a4d82fc 24INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
223e47cc
LB
25INITIALIZE_PASS_END(DominanceFrontier, "domfrontier",
26 "Dominance Frontier Construction", true, true)
27
1a4d82fc
JJ
28DominanceFrontier::DominanceFrontier()
29 : FunctionPass(ID),
30 Base() {
31 initializeDominanceFrontierPass(*PassRegistry::getPassRegistry());
223e47cc
LB
32}
33
1a4d82fc
JJ
34void DominanceFrontier::releaseMemory() {
35 Base.releaseMemory();
36}
223e47cc 37
1a4d82fc
JJ
38bool DominanceFrontier::runOnFunction(Function &) {
39 releaseMemory();
40 Base.analyze(getAnalysis<DominatorTreeWrapperPass>().getDomTree());
41 return false;
42}
223e47cc 43
1a4d82fc
JJ
44void DominanceFrontier::getAnalysisUsage(AnalysisUsage &AU) const {
45 AU.setPreservesAll();
46 AU.addRequired<DominatorTreeWrapperPass>();
223e47cc
LB
47}
48
1a4d82fc
JJ
49void 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 54void DominanceFrontier::dump() const {
223e47cc
LB
55 print(dbgs());
56}
57#endif