LLVM API Documentation

MachineDominators.cpp
Go to the documentation of this file.
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 namespace llvm {
00021 TEMPLATE_INSTANTIATION(class DomTreeNodeBase<MachineBasicBlock>);
00022 TEMPLATE_INSTANTIATION(class DominatorTreeBase<MachineBasicBlock>);
00023 }
00024 
00025 char MachineDominatorTree::ID = 0;
00026 
00027 INITIALIZE_PASS(MachineDominatorTree, "machinedomtree",
00028                 "MachineDominator Tree Construction", true, true)
00029 
00030 char &llvm::MachineDominatorsID = MachineDominatorTree::ID;
00031 
00032 void MachineDominatorTree::getAnalysisUsage(AnalysisUsage &AU) const {
00033   AU.setPreservesAll();
00034   MachineFunctionPass::getAnalysisUsage(AU);
00035 }
00036 
00037 bool MachineDominatorTree::runOnMachineFunction(MachineFunction &F) {
00038   CriticalEdgesToSplit.clear();
00039   NewBBs.clear();
00040   DT->recalculate(F);
00041 
00042   return false;
00043 }
00044 
00045 MachineDominatorTree::MachineDominatorTree()
00046     : MachineFunctionPass(ID) {
00047   initializeMachineDominatorTreePass(*PassRegistry::getPassRegistry());
00048   DT = new DominatorTreeBase<MachineBasicBlock>(false);
00049 }
00050 
00051 MachineDominatorTree::~MachineDominatorTree() {
00052   delete DT;
00053 }
00054 
00055 void MachineDominatorTree::releaseMemory() {
00056   DT->releaseMemory();
00057 }
00058 
00059 void MachineDominatorTree::print(raw_ostream &OS, const Module*) const {
00060   DT->print(OS);
00061 }