[llvm-mca] Move the logic that prints dispatch unit statistics from BackendStatistics to its own view.

This patch moves the logic that collects and analyzes dispatch events to the
DispatchStatistics view.

Added flag -dispatch-stats to print statistics related to the dispatch logic.

llvm-svn: 329708
diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp
index ab9c137..f49ae23 100644
--- a/llvm/tools/llvm-mca/llvm-mca.cpp
+++ b/llvm/tools/llvm-mca/llvm-mca.cpp
@@ -24,6 +24,7 @@
 #include "BackendPrinter.h"
 #include "BackendStatistics.h"
 #include "CodeRegion.h"
+#include "DispatchStatistics.h"
 #include "InstructionInfoView.h"
 #include "InstructionTables.h"
 #include "RegisterFileStatistics.h"
@@ -94,6 +95,11 @@
                            cl::init(false));
 
 static cl::opt<bool>
+    PrintDispatchStats("dispatch-stats",
+                       cl::desc("Print dispatch statistics"),
+                       cl::init(false));
+
+static cl::opt<bool>
     PrintResourcePressureView("resource-pressure",
                               cl::desc("Print the resource pressure view"),
                               cl::init(true));
@@ -423,6 +429,9 @@
       Printer.addView(
           llvm::make_unique<mca::InstructionInfoView>(*STI, *MCII, S, *IP));
 
+    if (PrintDispatchStats)
+      Printer.addView(llvm::make_unique<mca::DispatchStatistics>(*STI));
+
     if (PrintModeVerbose)
       Printer.addView(llvm::make_unique<mca::BackendStatistics>(*STI));