blob: 6704298c17d6ef354052e0299ecf9eaf9a437a71 [file] [log] [blame]
Matt Arsenault4181ea32014-07-12 21:59:52 +00001//===- MachineDominanceFrontier.cpp ---------------------------------------===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Matt Arsenault4181ea32014-07-12 21:59:52 +00006//
7//===----------------------------------------------------------------------===//
8
9#include "llvm/CodeGen/MachineDominanceFrontier.h"
Matt Arsenault4181ea32014-07-12 21:59:52 +000010#include "llvm/Analysis/DominanceFrontierImpl.h"
Chandler Carruthd9903882015-01-14 11:23:27 +000011#include "llvm/CodeGen/MachineDominators.h"
Matt Arsenault4181ea32014-07-12 21:59:52 +000012#include "llvm/CodeGen/Passes.h"
13
Matt Arsenault4181ea32014-07-12 21:59:52 +000014using namespace llvm;
15
16namespace llvm {
Jakub Kuderskib292c222017-07-14 18:26:09 +000017template class DominanceFrontierBase<MachineBasicBlock, false>;
18template class DominanceFrontierBase<MachineBasicBlock, true>;
Matt Arsenault4181ea32014-07-12 21:59:52 +000019template class ForwardDominanceFrontierBase<MachineBasicBlock>;
20}
21
22
23char MachineDominanceFrontier::ID = 0;
24
25INITIALIZE_PASS_BEGIN(MachineDominanceFrontier, "machine-domfrontier",
26 "Machine Dominance Frontier Construction", true, true)
27INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree)
28INITIALIZE_PASS_END(MachineDominanceFrontier, "machine-domfrontier",
29 "Machine Dominance Frontier Construction", true, true)
30
31MachineDominanceFrontier::MachineDominanceFrontier()
32 : MachineFunctionPass(ID),
33 Base() {
34 initializeMachineDominanceFrontierPass(*PassRegistry::getPassRegistry());
35}
36
37char &llvm::MachineDominanceFrontierID = MachineDominanceFrontier::ID;
38
39bool MachineDominanceFrontier::runOnMachineFunction(MachineFunction &) {
40 releaseMemory();
41 Base.analyze(getAnalysis<MachineDominatorTree>().getBase());
42 return false;
43}
44
45void MachineDominanceFrontier::releaseMemory() {
46 Base.releaseMemory();
47}
48
49void MachineDominanceFrontier::getAnalysisUsage(AnalysisUsage &AU) const {
50 AU.setPreservesAll();
51 AU.addRequired<MachineDominatorTree>();
52 MachineFunctionPass::getAnalysisUsage(AU);
53}