LLVM API Documentation

MachinePostDominators.cpp
Go to the documentation of this file.
00001 //===- MachinePostDominators.cpp -Machine Post 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 // post dominators on machine functions.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #include "llvm/CodeGen/MachinePostDominators.h"
00016 
00017 using namespace llvm;
00018 
00019 char MachinePostDominatorTree::ID = 0;
00020 
00021 //declare initializeMachinePostDominatorTreePass
00022 INITIALIZE_PASS(MachinePostDominatorTree, "machinepostdomtree",
00023                 "MachinePostDominator Tree Construction", true, true)
00024 
00025 MachinePostDominatorTree::MachinePostDominatorTree() : MachineFunctionPass(ID) {
00026   initializeMachinePostDominatorTreePass(*PassRegistry::getPassRegistry());
00027   DT = new DominatorTreeBase<MachineBasicBlock>(true); //true indicate
00028                                                        // postdominator
00029 }
00030 
00031 FunctionPass *
00032 MachinePostDominatorTree::createMachinePostDominatorTreePass() {
00033   return new MachinePostDominatorTree();
00034 }
00035 
00036 bool
00037 MachinePostDominatorTree::runOnMachineFunction(MachineFunction &F) {
00038   DT->recalculate(F);
00039   return false;
00040 }
00041 
00042 MachinePostDominatorTree::~MachinePostDominatorTree() {
00043   delete DT;
00044 }
00045 
00046 void
00047 MachinePostDominatorTree::getAnalysisUsage(AnalysisUsage &AU) const {
00048   AU.setPreservesAll();
00049   MachineFunctionPass::getAnalysisUsage(AU);
00050 }
00051 
00052 void
00053 MachinePostDominatorTree::print(llvm::raw_ostream &OS, const Module *M) const {
00054   DT->print(OS);
00055 }