2011-01-18 14:06:27 +08:00
|
|
|
//===- DominanceFrontier.cpp - Dominance Frontier Calculation -------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/Analysis/DominanceFrontier.h"
|
2014-07-13 05:59:52 +08:00
|
|
|
#include "llvm/Analysis/DominanceFrontierImpl.h"
|
|
|
|
|
2011-01-18 14:06:27 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
2014-07-13 05:59:52 +08:00
|
|
|
namespace llvm {
|
|
|
|
template class DominanceFrontierBase<BasicBlock>;
|
|
|
|
template class ForwardDominanceFrontierBase<BasicBlock>;
|
|
|
|
}
|
|
|
|
|
2011-01-18 14:06:27 +08:00
|
|
|
char DominanceFrontier::ID = 0;
|
2014-07-13 05:59:52 +08:00
|
|
|
|
2011-01-18 14:06:27 +08:00
|
|
|
INITIALIZE_PASS_BEGIN(DominanceFrontier, "domfrontier",
|
|
|
|
"Dominance Frontier Construction", true, true)
|
2014-01-13 21:07:17 +08:00
|
|
|
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
2011-01-18 14:06:27 +08:00
|
|
|
INITIALIZE_PASS_END(DominanceFrontier, "domfrontier",
|
|
|
|
"Dominance Frontier Construction", true, true)
|
|
|
|
|
2014-07-13 05:59:52 +08:00
|
|
|
DominanceFrontier::DominanceFrontier()
|
|
|
|
: FunctionPass(ID),
|
|
|
|
Base() {
|
|
|
|
initializeDominanceFrontierPass(*PassRegistry::getPassRegistry());
|
2011-01-18 14:06:27 +08:00
|
|
|
}
|
|
|
|
|
2014-07-13 05:59:52 +08:00
|
|
|
void DominanceFrontier::releaseMemory() {
|
|
|
|
Base.releaseMemory();
|
|
|
|
}
|
2011-01-18 14:06:27 +08:00
|
|
|
|
2014-07-13 05:59:52 +08:00
|
|
|
bool DominanceFrontier::runOnFunction(Function &) {
|
|
|
|
releaseMemory();
|
|
|
|
Base.analyze(getAnalysis<DominatorTreeWrapperPass>().getDomTree());
|
|
|
|
return false;
|
|
|
|
}
|
2011-01-18 14:06:27 +08:00
|
|
|
|
2014-07-13 05:59:52 +08:00
|
|
|
void DominanceFrontier::getAnalysisUsage(AnalysisUsage &AU) const {
|
|
|
|
AU.setPreservesAll();
|
|
|
|
AU.addRequired<DominatorTreeWrapperPass>();
|
2011-01-18 14:06:27 +08:00
|
|
|
}
|
|
|
|
|
2014-07-13 05:59:52 +08:00
|
|
|
void DominanceFrontier::print(raw_ostream &OS, const Module *) const {
|
|
|
|
Base.print(OS);
|
2011-01-18 14:06:27 +08:00
|
|
|
}
|
|
|
|
|
2012-09-12 13:06:18 +08:00
|
|
|
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
|
2014-07-13 05:59:52 +08:00
|
|
|
void DominanceFrontier::dump() const {
|
2011-01-18 14:06:27 +08:00
|
|
|
print(dbgs());
|
|
|
|
}
|
2012-09-07 03:55:56 +08:00
|
|
|
#endif
|