13861d79fSDimitry Andric //===- MachinePostDominators.cpp -Machine Post Dominator Calculation ------===// 23861d79fSDimitry Andric // 33861d79fSDimitry Andric // The LLVM Compiler Infrastructure 43861d79fSDimitry Andric // 53861d79fSDimitry Andric // This file is distributed under the University of Illinois Open Source 63861d79fSDimitry Andric // License. See LICENSE.TXT for details. 73861d79fSDimitry Andric // 83861d79fSDimitry Andric //===----------------------------------------------------------------------===// 93861d79fSDimitry Andric // 103861d79fSDimitry Andric // This file implements simple dominator construction algorithms for finding 113861d79fSDimitry Andric // post dominators on machine functions. 123861d79fSDimitry Andric // 133861d79fSDimitry Andric //===----------------------------------------------------------------------===// 143861d79fSDimitry Andric 153861d79fSDimitry Andric #include "llvm/CodeGen/MachinePostDominators.h" 163861d79fSDimitry Andric 173861d79fSDimitry Andric using namespace llvm; 183861d79fSDimitry Andric 19*b40b48b8SDimitry Andric namespace llvm { 20*b40b48b8SDimitry Andric template class DominatorTreeBase<MachineBasicBlock, true>; // PostDomTreeBase 21*b40b48b8SDimitry Andric } 22*b40b48b8SDimitry Andric 233861d79fSDimitry Andric char MachinePostDominatorTree::ID = 0; 243861d79fSDimitry Andric 253861d79fSDimitry Andric //declare initializeMachinePostDominatorTreePass 263861d79fSDimitry Andric INITIALIZE_PASS(MachinePostDominatorTree, "machinepostdomtree", 273861d79fSDimitry Andric "MachinePostDominator Tree Construction", true, true) 283861d79fSDimitry Andric MachinePostDominatorTree()293861d79fSDimitry AndricMachinePostDominatorTree::MachinePostDominatorTree() : MachineFunctionPass(ID) { 303861d79fSDimitry Andric initializeMachinePostDominatorTreePass(*PassRegistry::getPassRegistry()); 31*b40b48b8SDimitry Andric DT = new PostDomTreeBase<MachineBasicBlock>(); 323861d79fSDimitry Andric } 333861d79fSDimitry Andric 343861d79fSDimitry Andric FunctionPass * createMachinePostDominatorTreePass()353861d79fSDimitry AndricMachinePostDominatorTree::createMachinePostDominatorTreePass() { 363861d79fSDimitry Andric return new MachinePostDominatorTree(); 373861d79fSDimitry Andric } 383861d79fSDimitry Andric 393861d79fSDimitry Andric bool runOnMachineFunction(MachineFunction & F)403861d79fSDimitry AndricMachinePostDominatorTree::runOnMachineFunction(MachineFunction &F) { 413861d79fSDimitry Andric DT->recalculate(F); 423861d79fSDimitry Andric return false; 433861d79fSDimitry Andric } 443861d79fSDimitry Andric ~MachinePostDominatorTree()453861d79fSDimitry AndricMachinePostDominatorTree::~MachinePostDominatorTree() { 463861d79fSDimitry Andric delete DT; 473861d79fSDimitry Andric } 483861d79fSDimitry Andric 493861d79fSDimitry Andric void getAnalysisUsage(AnalysisUsage & AU) const503861d79fSDimitry AndricMachinePostDominatorTree::getAnalysisUsage(AnalysisUsage &AU) const { 513861d79fSDimitry Andric AU.setPreservesAll(); 523861d79fSDimitry Andric MachineFunctionPass::getAnalysisUsage(AU); 533861d79fSDimitry Andric } 543861d79fSDimitry Andric 553861d79fSDimitry Andric void print(llvm::raw_ostream & OS,const Module * M) const563861d79fSDimitry AndricMachinePostDominatorTree::print(llvm::raw_ostream &OS, const Module *M) const { 573861d79fSDimitry Andric DT->print(OS); 583861d79fSDimitry Andric } 59