blob: 28ecc8f96805aa4ea4ce306f8043b19736f8b4d3 [file] [log] [blame]
Matt Arsenault4181ea32014-07-12 21:59:52 +00001//===- MachineDominanceFrontier.cpp ---------------------------------------===//
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/CodeGen/MachineDominanceFrontier.h"
Matt Arsenault4181ea32014-07-12 21:59:52 +000011#include "llvm/Analysis/DominanceFrontierImpl.h"
Chandler Carruthd9903882015-01-14 11:23:27 +000012#include "llvm/CodeGen/MachineDominators.h"
Matt Arsenault4181ea32014-07-12 21:59:52 +000013#include "llvm/CodeGen/Passes.h"
14
Matt Arsenault4181ea32014-07-12 21:59:52 +000015using namespace llvm;
16
17namespace llvm {
18template class DominanceFrontierBase<MachineBasicBlock>;
19template 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}