1193323Sed//===- MachineDominators.cpp - Machine Dominator Calculation --------------===//
2193323Sed//
3193323Sed//                     The LLVM Compiler Infrastructure
4193323Sed//
5193323Sed// This file is distributed under the University of Illinois Open Source
6193323Sed// License. See LICENSE.TXT for details.
7193323Sed//
8193323Sed//===----------------------------------------------------------------------===//
9193323Sed//
10193323Sed// This file implements simple dominator construction algorithms for finding
11193323Sed// forward dominators on machine functions.
12193323Sed//
13193323Sed//===----------------------------------------------------------------------===//
14193323Sed
15193323Sed#include "llvm/CodeGen/MachineDominators.h"
16193323Sed#include "llvm/CodeGen/Passes.h"
17193323Sed
18193323Sedusing namespace llvm;
19193323Sed
20201360Srdivackynamespace llvm {
21193323SedTEMPLATE_INSTANTIATION(class DomTreeNodeBase<MachineBasicBlock>);
22193323SedTEMPLATE_INSTANTIATION(class DominatorTreeBase<MachineBasicBlock>);
23201360Srdivacky}
24193323Sed
25193323Sedchar MachineDominatorTree::ID = 0;
26193323Sed
27212904SdimINITIALIZE_PASS(MachineDominatorTree, "machinedomtree",
28218893Sdim                "MachineDominator Tree Construction", true, true)
29193323Sed
30212904Sdimchar &llvm::MachineDominatorsID = MachineDominatorTree::ID;
31193323Sed
32193323Sedvoid MachineDominatorTree::getAnalysisUsage(AnalysisUsage &AU) const {
33193323Sed  AU.setPreservesAll();
34193323Sed  MachineFunctionPass::getAnalysisUsage(AU);
35193323Sed}
36193323Sed
37193323Sedbool MachineDominatorTree::runOnMachineFunction(MachineFunction &F) {
38193323Sed  DT->recalculate(F);
39193323Sed
40193323Sed  return false;
41193323Sed}
42193323Sed
43193323SedMachineDominatorTree::MachineDominatorTree()
44212904Sdim    : MachineFunctionPass(ID) {
45218893Sdim  initializeMachineDominatorTreePass(*PassRegistry::getPassRegistry());
46193323Sed  DT = new DominatorTreeBase<MachineBasicBlock>(false);
47193323Sed}
48193323Sed
49193323SedMachineDominatorTree::~MachineDominatorTree() {
50193323Sed  delete DT;
51193323Sed}
52193323Sed
53193323Sedvoid MachineDominatorTree::releaseMemory() {
54193323Sed  DT->releaseMemory();
55193323Sed}
56198090Srdivacky
57198090Srdivackyvoid MachineDominatorTree::print(raw_ostream &OS, const Module*) const {
58198090Srdivacky  DT->print(OS);
59198090Srdivacky}
60