diff options
author | Hiroshi Yamauchi <yamauchi@google.com> | 2017-08-26 00:31:00 +0000 |
---|---|---|
committer | Hiroshi Yamauchi <yamauchi@google.com> | 2017-08-26 00:31:00 +0000 |
commit | 63e17ebf8b8449932f57d334f25692515b36571a (patch) | |
tree | 43226126b74fc990067c3d50b44885d927f13f8c /llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp | |
parent | d27386a9edfa0d1c33bf6bb4ba704ba1e4bee7c7 (diff) | |
download | llvm-63e17ebf8b8449932f57d334f25692515b36571a.zip llvm-63e17ebf8b8449932f57d334f25692515b36571a.tar.gz llvm-63e17ebf8b8449932f57d334f25692515b36571a.tar.bz2 |
Add options to dump block frequency/branch probability info in text.
Summary:
Add options -print-bfi/-print-bpi that dump block frequency and branch
probability info like -view-block-freq-propagation-dags and
-view-machine-block-freq-propagation-dags do but in text.
This is useful when the graph is very large and complex (the dot command
crashes, lines/edges too close to tell apart, hard to navigate without textual
search) or simply when text is preferred.
Reviewers: davidxl
Reviewed By: davidxl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D37165
llvm-svn: 311822
Diffstat (limited to 'llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp index 104180a..14cd912 100644 --- a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp +++ b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp @@ -68,6 +68,14 @@ extern cl::opt<std::string> ViewBlockFreqFuncName; // Defined in Analysis/BlockFrequencyInfo.cpp: -view-hot-freq-perc= extern cl::opt<unsigned> ViewHotFreqPercent; +static cl::opt<bool> PrintMachineBlockFreq( + "print-machine-bfi", cl::init(false), cl::Hidden, + cl::desc("Print the machine block frequency info.")); + +// Command line option to specify the name of the function for block frequency +// dump. Defined in Analysis/BlockFrequencyInfo.cpp. +extern cl::opt<std::string> PrintBlockFreqFuncName; + static GVDAGType getGVDT() { if (ViewBlockLayoutWithBFI != GVDT_None) return ViewBlockLayoutWithBFI; @@ -185,6 +193,11 @@ void MachineBlockFrequencyInfo::calculate( F.getName().equals(ViewBlockFreqFuncName))) { view("MachineBlockFrequencyDAGS." + F.getName()); } + if (PrintMachineBlockFreq && + (PrintBlockFreqFuncName.empty() || + F.getName().equals(PrintBlockFreqFuncName))) { + MBFI->print(dbgs()); + } } bool MachineBlockFrequencyInfo::runOnMachineFunction(MachineFunction &F) { |