LLVM API Documentation
00001 //===- MachineDominators.cpp - Machine Dominator Calculation --------------===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file implements simple dominator construction algorithms for finding 00011 // forward dominators on machine functions. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #include "llvm/CodeGen/MachineDominators.h" 00016 #include "llvm/CodeGen/Passes.h" 00017 00018 using namespace llvm; 00019 00020 TEMPLATE_INSTANTIATION(class DomTreeNodeBase<MachineBasicBlock>); 00021 TEMPLATE_INSTANTIATION(class DominatorTreeBase<MachineBasicBlock>); 00022 00023 char MachineDominatorTree::ID = 0; 00024 00025 static RegisterPass<MachineDominatorTree> 00026 E("machinedomtree", "MachineDominator Tree Construction", true); 00027 00028 const PassInfo *const llvm::MachineDominatorsID = &E; 00029 00030 void MachineDominatorTree::getAnalysisUsage(AnalysisUsage &AU) const { 00031 AU.setPreservesAll(); 00032 MachineFunctionPass::getAnalysisUsage(AU); 00033 } 00034 00035 bool MachineDominatorTree::runOnMachineFunction(MachineFunction &F) { 00036 DT->recalculate(F); 00037 00038 return false; 00039 } 00040 00041 MachineDominatorTree::MachineDominatorTree() 00042 : MachineFunctionPass(intptr_t(&ID)) { 00043 DT = new DominatorTreeBase<MachineBasicBlock>(false); 00044 } 00045 00046 MachineDominatorTree::~MachineDominatorTree() { 00047 DT->releaseMemory(); 00048 delete DT; 00049 } 00050 00051 void MachineDominatorTree::releaseMemory() { 00052 DT->releaseMemory(); 00053 }