OSDN Git Service

Add an option to enable MBFI dot viewer for a given function
authorXinliang David Li <davidxl@google.com>
Wed, 22 Jun 2016 02:12:54 +0000 (02:12 +0000)
committerXinliang David Li <davidxl@google.com>
Wed, 22 Jun 2016 02:12:54 +0000 (02:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273366 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineBlockFrequencyInfo.cpp

index d0c6261..8843136 100644 (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