blob: 488377998cb31a080869da0fb1f094eb08623f32 [file] [log] [blame]
Tom Stellard86af62c2012-09-17 14:08:37 +00001//===- MachinePostDominators.cpp -Machine Post Dominator 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// This file implements simple dominator construction algorithms for finding
11// post dominators on machine functions.
12//
13//===----------------------------------------------------------------------===//
14
15#include "llvm/CodeGen/MachinePostDominators.h"
16
17using namespace llvm;
18
Jakub Kuderskib292c222017-07-14 18:26:09 +000019namespace llvm {
20template class DominatorTreeBase<MachineBasicBlock, true>; // PostDomTreeBase
21}
22
Tom Stellard86af62c2012-09-17 14:08:37 +000023char MachinePostDominatorTree::ID = 0;
24
25//declare initializeMachinePostDominatorTreePass
26INITIALIZE_PASS(MachinePostDominatorTree, "machinepostdomtree",
27 "MachinePostDominator Tree Construction", true, true)
28
29MachinePostDominatorTree::MachinePostDominatorTree() : MachineFunctionPass(ID) {
30 initializeMachinePostDominatorTreePass(*PassRegistry::getPassRegistry());
Jakub Kuderskib292c222017-07-14 18:26:09 +000031 DT = new PostDomTreeBase<MachineBasicBlock>();
Tom Stellard86af62c2012-09-17 14:08:37 +000032}
33
34FunctionPass *
35MachinePostDominatorTree::createMachinePostDominatorTreePass() {
36 return new MachinePostDominatorTree();
37}
38
39bool
40MachinePostDominatorTree::runOnMachineFunction(MachineFunction &F) {
41 DT->recalculate(F);
42 return false;
43}
44
45MachinePostDominatorTree::~MachinePostDominatorTree() {
46 delete DT;
47}
48
49void
50MachinePostDominatorTree::getAnalysisUsage(AnalysisUsage &AU) const {
51 AU.setPreservesAll();
52 MachineFunctionPass::getAnalysisUsage(AU);
53}
54
55void
56MachinePostDominatorTree::print(llvm::raw_ostream &OS, const Module *M) const {
57 DT->print(OS);
58}