LLVM API Documentation

DominanceFrontier.cpp
Go to the documentation of this file.
00001 //===- DominanceFrontier.cpp - Dominance Frontier 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 #include "llvm/Analysis/DominanceFrontier.h"
00011 #include "llvm/Analysis/DominanceFrontierImpl.h"
00012 
00013 using namespace llvm;
00014 
00015 namespace llvm {
00016 template class DominanceFrontierBase<BasicBlock>;
00017 template class ForwardDominanceFrontierBase<BasicBlock>;
00018 }
00019 
00020 char DominanceFrontier::ID = 0;
00021 
00022 INITIALIZE_PASS_BEGIN(DominanceFrontier, "domfrontier",
00023                 "Dominance Frontier Construction", true, true)
00024 INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
00025 INITIALIZE_PASS_END(DominanceFrontier, "domfrontier",
00026                 "Dominance Frontier Construction", true, true)
00027 
00028 DominanceFrontier::DominanceFrontier()
00029   : FunctionPass(ID),
00030     Base() {
00031   initializeDominanceFrontierPass(*PassRegistry::getPassRegistry());
00032 }
00033 
00034 void DominanceFrontier::releaseMemory() {
00035   Base.releaseMemory();
00036 }
00037 
00038 bool DominanceFrontier::runOnFunction(Function &) {
00039   releaseMemory();
00040   Base.analyze(getAnalysis<DominatorTreeWrapperPass>().getDomTree());
00041   return false;
00042 }
00043 
00044 void DominanceFrontier::getAnalysisUsage(AnalysisUsage &AU) const {
00045   AU.setPreservesAll();
00046   AU.addRequired<DominatorTreeWrapperPass>();
00047 }
00048 
00049 void DominanceFrontier::print(raw_ostream &OS, const Module *) const {
00050   Base.print(OS);
00051 }
00052 
00053 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
00054 void DominanceFrontier::dump() const {
00055   print(dbgs());
00056 }
00057 #endif