54 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include "llvm/CodeGen/MachineDominanceFrontier.h"10#include "llvm/CodeGen/MachineDominators.h"11#include "llvm/CodeGen/Passes.h"12#include "llvm/InitializePasses.h"13#include "llvm/Pass.h"14#include "llvm/PassRegistry.h"15 16using namespace llvm;17 18namespace llvm {19template class DominanceFrontierBase<MachineBasicBlock, false>;20template class DominanceFrontierBase<MachineBasicBlock, true>;21template class ForwardDominanceFrontierBase<MachineBasicBlock>;22}23 24 25char MachineDominanceFrontier::ID = 0;26 27INITIALIZE_PASS_BEGIN(MachineDominanceFrontier, "machine-domfrontier",28 "Machine Dominance Frontier Construction", true, true)29INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass)30INITIALIZE_PASS_END(MachineDominanceFrontier, "machine-domfrontier",31 "Machine Dominance Frontier Construction", true, true)32 33MachineDominanceFrontier::MachineDominanceFrontier() : MachineFunctionPass(ID) {34 initializeMachineDominanceFrontierPass(*PassRegistry::getPassRegistry());35}36 37char &llvm::MachineDominanceFrontierID = MachineDominanceFrontier::ID;38 39bool MachineDominanceFrontier::runOnMachineFunction(MachineFunction &) {40 releaseMemory();41 Base.analyze(getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree());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<MachineDominatorTreeWrapperPass>();52 MachineFunctionPass::getAnalysisUsage(AU);53}54