Line | Count | Source |
1 | //===- MachineDominanceFrontier.cpp ---------------------------------------===// | |
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 | #include "llvm/CodeGen/MachineDominanceFrontier.h" | |
10 | #include "llvm/Analysis/DominanceFrontierImpl.h" | |
11 | #include "llvm/CodeGen/MachineDominators.h" | |
12 | #include "llvm/CodeGen/Passes.h" | |
13 | ||
14 | using namespace llvm; | |
15 | ||
16 | namespace llvm { | |
17 | template class DominanceFrontierBase<MachineBasicBlock, false>; | |
18 | template class DominanceFrontierBase<MachineBasicBlock, true>; | |
19 | template class ForwardDominanceFrontierBase<MachineBasicBlock>; | |
20 | } | |
21 | ||
22 | ||
23 | char MachineDominanceFrontier::ID = 0; | |
24 | ||
25 | 102k | INITIALIZE_PASS_BEGIN(MachineDominanceFrontier, "machine-domfrontier", |
26 | 102k | "Machine Dominance Frontier Construction", true, true) |
27 | 102k | INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree) |
28 | 102k | INITIALIZE_PASS_END(MachineDominanceFrontier, "machine-domfrontier", |
29 | "Machine Dominance Frontier Construction", true, true) | |
30 | ||
31 | MachineDominanceFrontier::MachineDominanceFrontier() | |
32 | : MachineFunctionPass(ID), | |
33 | 2.13k | Base() { |
34 | 2.13k | initializeMachineDominanceFrontierPass(*PassRegistry::getPassRegistry()); |
35 | 2.13k | } |
36 | ||
37 | char &llvm::MachineDominanceFrontierID = MachineDominanceFrontier::ID; | |
38 | ||
39 | 11.1k | bool MachineDominanceFrontier::runOnMachineFunction(MachineFunction &) { |
40 | 11.1k | releaseMemory(); |
41 | 11.1k | Base.analyze(getAnalysis<MachineDominatorTree>().getBase()); |
42 | 11.1k | return false; |
43 | 11.1k | } |
44 | ||
45 | 22.3k | void MachineDominanceFrontier::releaseMemory() { |
46 | 22.3k | Base.releaseMemory(); |
47 | 22.3k | } |
48 | ||
49 | 2.13k | void MachineDominanceFrontier::getAnalysisUsage(AnalysisUsage &AU) const { |
50 | 2.13k | AU.setPreservesAll(); |
51 | 2.13k | AU.addRequired<MachineDominatorTree>(); |
52 | 2.13k | MachineFunctionPass::getAnalysisUsage(AU); |
53 | 2.13k | } |