Add an option to enable MBFI dot viewer for a given function

llvm-svn: 273366
This commit is contained in:
Xinliang David Li 2016-06-22 02:12:54 +00:00
parent 189d6a8834
commit 80457ce5fa
1 changed files with 6 additions and 1 deletions

View File

@ -42,6 +42,9 @@ static cl::opt<GVDAGType> ViewMachineBlockFreqPropagationDAG(
"integer fractional block frequency representation."),
clEnumValEnd));
static cl::opt<std::string> ViewMachineBlockFreqFuncName("view-mbfi-func-name",
cl::Hidden);
namespace llvm {
template <> struct GraphTraits<MachineBlockFrequencyInfo *> {
@ -137,7 +140,9 @@ bool MachineBlockFrequencyInfo::runOnMachineFunction(MachineFunction &F) {
MBFI.reset(new ImplType);
MBFI->calculate(F, MBPI, MLI);
#ifndef NDEBUG
if (ViewMachineBlockFreqPropagationDAG != GVDT_None) {
if (ViewMachineBlockFreqPropagationDAG != GVDT_None &&
(ViewMachineBlockFreqFuncName.empty() ||
F.getName().equals(ViewMachineBlockFreqFuncName))) {
view();
}
#endif