Matt Arsenault | 4181ea3 | 2014-07-12 21:59:52 +0000 | [diff] [blame] | 1 | //===- MachineDominanceFrontier.cpp ---------------------------------------===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Matt Arsenault | 4181ea3 | 2014-07-12 21:59:52 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "llvm/CodeGen/MachineDominanceFrontier.h" |
Matt Arsenault | 4181ea3 | 2014-07-12 21:59:52 +0000 | [diff] [blame] | 10 | #include "llvm/Analysis/DominanceFrontierImpl.h" |
Chandler Carruth | d990388 | 2015-01-14 11:23:27 +0000 | [diff] [blame] | 11 | #include "llvm/CodeGen/MachineDominators.h" |
Matt Arsenault | 4181ea3 | 2014-07-12 21:59:52 +0000 | [diff] [blame] | 12 | #include "llvm/CodeGen/Passes.h" |
Reid Kleckner | 05da2fe | 2019-11-13 13:15:01 -0800 | [diff] [blame] | 13 | #include "llvm/InitializePasses.h" |
Matt Arsenault | 4181ea3 | 2014-07-12 21:59:52 +0000 | [diff] [blame] | 14 | |
Matt Arsenault | 4181ea3 | 2014-07-12 21:59:52 +0000 | [diff] [blame] | 15 | using namespace llvm; |
| 16 | |
| 17 | namespace llvm { |
Jakub Kuderski | b292c22 | 2017-07-14 18:26:09 +0000 | [diff] [blame] | 18 | template class DominanceFrontierBase<MachineBasicBlock, false>; |
| 19 | template class DominanceFrontierBase<MachineBasicBlock, true>; |
Matt Arsenault | 4181ea3 | 2014-07-12 21:59:52 +0000 | [diff] [blame] | 20 | template class ForwardDominanceFrontierBase<MachineBasicBlock>; |
| 21 | } |
| 22 | |
| 23 | |
| 24 | char MachineDominanceFrontier::ID = 0; |
| 25 | |
| 26 | INITIALIZE_PASS_BEGIN(MachineDominanceFrontier, "machine-domfrontier", |
| 27 | "Machine Dominance Frontier Construction", true, true) |
| 28 | INITIALIZE_PASS_DEPENDENCY(MachineDominatorTree) |
| 29 | INITIALIZE_PASS_END(MachineDominanceFrontier, "machine-domfrontier", |
| 30 | "Machine Dominance Frontier Construction", true, true) |
| 31 | |
| 32 | MachineDominanceFrontier::MachineDominanceFrontier() |
| 33 | : MachineFunctionPass(ID), |
| 34 | Base() { |
| 35 | initializeMachineDominanceFrontierPass(*PassRegistry::getPassRegistry()); |
| 36 | } |
| 37 | |
| 38 | char &llvm::MachineDominanceFrontierID = MachineDominanceFrontier::ID; |
| 39 | |
| 40 | bool MachineDominanceFrontier::runOnMachineFunction(MachineFunction &) { |
| 41 | releaseMemory(); |
| 42 | Base.analyze(getAnalysis<MachineDominatorTree>().getBase()); |
| 43 | return false; |
| 44 | } |
| 45 | |
| 46 | void MachineDominanceFrontier::releaseMemory() { |
| 47 | Base.releaseMemory(); |
| 48 | } |
| 49 | |
| 50 | void MachineDominanceFrontier::getAnalysisUsage(AnalysisUsage &AU) const { |
| 51 | AU.setPreservesAll(); |
| 52 | AU.addRequired<MachineDominatorTree>(); |
| 53 | MachineFunctionPass::getAnalysisUsage(AU); |
| 54 | } |