[llvm-readobj] - Fix BB after r372087.
[llvm-complete.git] / lib / CodeGen / MachinePostDominators.cpp
blob7f220ed1fd8f33c98158ce6636f2b8178adf20dc
1 //===- MachinePostDominators.cpp -Machine Post Dominator Calculation ------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements simple dominator construction algorithms for finding
10 // post dominators on machine functions.
12 //===----------------------------------------------------------------------===//
14 #include "llvm/CodeGen/MachinePostDominators.h"
16 using namespace llvm;
18 namespace llvm {
19 template class DominatorTreeBase<MachineBasicBlock, true>; // PostDomTreeBase
22 char MachinePostDominatorTree::ID = 0;
24 //declare initializeMachinePostDominatorTreePass
25 INITIALIZE_PASS(MachinePostDominatorTree, "machinepostdomtree",
26 "MachinePostDominator Tree Construction", true, true)
28 MachinePostDominatorTree::MachinePostDominatorTree() : MachineFunctionPass(ID) {
29 initializeMachinePostDominatorTreePass(*PassRegistry::getPassRegistry());
30 DT = new PostDomTreeBase<MachineBasicBlock>();
33 FunctionPass *
34 MachinePostDominatorTree::createMachinePostDominatorTreePass() {
35 return new MachinePostDominatorTree();
38 bool
39 MachinePostDominatorTree::runOnMachineFunction(MachineFunction &F) {
40 DT->recalculate(F);
41 return false;
44 MachinePostDominatorTree::~MachinePostDominatorTree() {
45 delete DT;
48 void
49 MachinePostDominatorTree::getAnalysisUsage(AnalysisUsage &AU) const {
50 AU.setPreservesAll();
51 MachineFunctionPass::getAnalysisUsage(AU);
54 void
55 MachinePostDominatorTree::print(llvm::raw_ostream &OS, const Module *M) const {
56 DT->print(OS);