summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2016-06-28 04:07:03 +0000
committerXinliang David Li <davidxl@google.com>2016-06-28 04:07:03 +0000
commit8dd5ce97f91111c229e9c444145b5d005d39b3d6 (patch)
tree68eebd5416e7c96ff005ae09cb30819a49f32568 /llvm/lib
parentbd861acf29bb49c6530870de2e05d4828eb1a9a2 (diff)
downloadbcm5719-llvm-8dd5ce97f91111c229e9c444145b5d005d39b3d6.tar.gz
bcm5719-llvm-8dd5ce97f91111c229e9c444145b5d005d39b3d6.zip
[BFI]: enhance BFI graph dump
MBFI supports profile count dumping and function name based filtering. Add these two feature to BFI as well. The filtering option is shared between BFI and MBFI: -view-bfi-func-name=.. llvm-svn: 273992
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/BlockFrequencyInfo.cpp33
-rw-r--r--llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp7
2 files changed, 23 insertions, 17 deletions
diff --git a/llvm/lib/Analysis/BlockFrequencyInfo.cpp b/llvm/lib/Analysis/BlockFrequencyInfo.cpp
index 1370ace759b..f470d3c6a8b 100644
--- a/llvm/lib/Analysis/BlockFrequencyInfo.cpp
+++ b/llvm/lib/Analysis/BlockFrequencyInfo.cpp
@@ -27,18 +27,22 @@ using namespace llvm;
#define DEBUG_TYPE "block-freq"
#ifndef NDEBUG
-static cl::opt<GVDAGType>
-ViewBlockFreqPropagationDAG("view-block-freq-propagation-dags", cl::Hidden,
- cl::desc("Pop up a window to show a dag displaying how block "
- "frequencies propagation through the CFG."),
- cl::values(
- clEnumValN(GVDT_None, "none",
- "do not display graphs."),
- clEnumValN(GVDT_Fraction, "fraction", "display a graph using the "
- "fractional block frequency representation."),
- clEnumValN(GVDT_Integer, "integer", "display a graph using the raw "
- "integer fractional block frequency representation."),
- clEnumValEnd));
+static cl::opt<GVDAGType> ViewBlockFreqPropagationDAG(
+ "view-block-freq-propagation-dags", cl::Hidden,
+ cl::desc("Pop up a window to show a dag displaying how block "
+ "frequencies propagation through the CFG."),
+ cl::values(clEnumValN(GVDT_None, "none", "do not display graphs."),
+ clEnumValN(GVDT_Fraction, "fraction",
+ "display a graph using the "
+ "fractional block frequency representation."),
+ clEnumValN(GVDT_Integer, "integer",
+ "display a graph using the raw "
+ "integer fractional block frequency representation."),
+ clEnumValN(GVDT_Count, "count", "display a graph using the real "
+ "profile count if available."),
+ clEnumValEnd));
+
+cl::opt<std::string> ViewBlockFreqFuncName("view-bfi-func-name", cl::Hidden);
namespace llvm {
@@ -113,8 +117,11 @@ void BlockFrequencyInfo::calculate(const Function &F,
BFI.reset(new ImplType);
BFI->calculate(F, BPI, LI);
#ifndef NDEBUG
- if (ViewBlockFreqPropagationDAG != GVDT_None)
+ if (ViewBlockFreqPropagationDAG != GVDT_None &&
+ (ViewBlockFreqFuncName.empty() ||
+ F.getName().equals(ViewBlockFreqFuncName))) {
view();
+ }
#endif
}
diff --git a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
index f02356b92c5..7e05ebe2848 100644
--- a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
+++ b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
@@ -46,8 +46,7 @@ static cl::opt<GVDAGType> ViewMachineBlockFreqPropagationDAG(
clEnumValEnd));
-static cl::opt<std::string> ViewMachineBlockFreqFuncName("view-mbfi-func-name",
- cl::Hidden);
+extern cl::opt<std::string> ViewBlockFreqFuncName;
namespace llvm {
@@ -134,8 +133,8 @@ bool MachineBlockFrequencyInfo::runOnMachineFunction(MachineFunction &F) {
MBFI->calculate(F, MBPI, MLI);
#ifndef NDEBUG
if (ViewMachineBlockFreqPropagationDAG != GVDT_None &&
- (ViewMachineBlockFreqFuncName.empty() ||
- F.getName().equals(ViewMachineBlockFreqFuncName))) {
+ (ViewBlockFreqFuncName.empty() ||
+ F.getName().equals(ViewBlockFreqFuncName))) {
view();
}
#endif
OpenPOWER on IntegriCloud