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

Andrea Di Biagio via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 10 07:55:14 PDT 2018


Author: adibiagio
Date: Tue Apr 10 07:55:14 2018
New Revision: 329708

URL: http://llvm.org/viewvc/llvm-project?rev=329708&view=rev
Log:
[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.

Added:
    llvm/trunk/tools/llvm-mca/DispatchStatistics.cpp
    llvm/trunk/tools/llvm-mca/DispatchStatistics.h
Modified:
    llvm/trunk/docs/CommandGuide/llvm-mca.rst
    llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-1.s
    llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-2.s
    llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-3.s
    llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-4.s
    llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-5.s
    llvm/trunk/tools/llvm-mca/BackendStatistics.cpp
    llvm/trunk/tools/llvm-mca/BackendStatistics.h
    llvm/trunk/tools/llvm-mca/CMakeLists.txt
    llvm/trunk/tools/llvm-mca/llvm-mca.cpp

Modified: llvm/trunk/docs/CommandGuide/llvm-mca.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-mca.rst?rev=329708&r1=329707&r2=329708&view=diff
==============================================================================
--- llvm/trunk/docs/CommandGuide/llvm-mca.rst (original)
+++ llvm/trunk/docs/CommandGuide/llvm-mca.rst Tue Apr 10 07:55:14 2018
@@ -144,6 +144,12 @@ option specifies "``-``", then the outpu
 
   Enable register file usage statistics.
 
+.. option:: -dispatch-stats
+
+  Enable extra dispatch statistics. This view collects and analyzes instruction
+  dispatch events, as well as static/dynamic dispatch stall events. This view
+  is disabled by default.
+
 .. option:: -instruction-info
 
   Enable the instruction info view. This is enabled by default.

Modified: llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-1.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-1.s?rev=329708&r1=329707&r2=329708&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-1.s (original)
+++ llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-1.s Tue Apr 10 07:55:14 2018
@@ -1,4 +1,4 @@
-# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=5 -verbose -instruction-info=false -register-file-stats -timeline < %s | FileCheck %s
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=5 -instruction-info=false -dispatch-stats -register-file-stats -timeline < %s | FileCheck %s
 
 vaddps %xmm0, %xmm0, %xmm0
 vmulps %xmm0, %xmm0, %xmm0

Modified: llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-2.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-2.s?rev=329708&r1=329707&r2=329708&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-2.s (original)
+++ llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-2.s Tue Apr 10 07:55:14 2018
@@ -1,4 +1,4 @@
-# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -register-file-size=5 -iterations=5 -verbose -instruction-info=false -register-file-stats -timeline < %s | FileCheck %s
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -register-file-size=5 -iterations=5 -instruction-info=false -dispatch-stats -register-file-stats -timeline < %s | FileCheck %s
 
 vaddps %xmm0, %xmm0, %xmm0
 vmulps %xmm0, %xmm0, %xmm0

Modified: llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-3.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-3.s?rev=329708&r1=329707&r2=329708&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-3.s (original)
+++ llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-3.s Tue Apr 10 07:55:14 2018
@@ -1,4 +1,4 @@
-# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -register-file-size=5 -iterations=2 -verbose -register-file-stats -timeline < %s | FileCheck %s
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -register-file-size=5 -iterations=2 -dispatch-stats -register-file-stats -timeline < %s | FileCheck %s
 
 idiv %eax
 

Modified: llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-4.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-4.s?rev=329708&r1=329707&r2=329708&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-4.s (original)
+++ llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-4.s Tue Apr 10 07:55:14 2018
@@ -1,4 +1,4 @@
-# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=22 -verbose -register-file-stats -resource-pressure=false -timeline -timeline-max-iterations=3 < %s | FileCheck %s
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=22 -dispatch-stats -register-file-stats -resource-pressure=false -timeline -timeline-max-iterations=3 < %s | FileCheck %s
 
 idiv %eax
 

Modified: llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-5.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-5.s?rev=329708&r1=329707&r2=329708&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-5.s (original)
+++ llvm/trunk/test/tools/llvm-mca/X86/BtVer2/register-files-5.s Tue Apr 10 07:55:14 2018
@@ -1,4 +1,4 @@
-# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=1 -resource-pressure=false -instruction-info=false -verbose -register-file-stats -timeline < %s | FileCheck %s
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -iterations=1 -resource-pressure=false -instruction-info=false -dispatch-stats -register-file-stats -timeline < %s | FileCheck %s
 
   vdivps %ymm0, %ymm0, %ymm1
   vaddps %ymm0, %ymm0, %ymm2

Modified: llvm/trunk/tools/llvm-mca/BackendStatistics.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/BackendStatistics.cpp?rev=329708&r1=329707&r2=329708&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/BackendStatistics.cpp (original)
+++ llvm/trunk/tools/llvm-mca/BackendStatistics.cpp Tue Apr 10 07:55:14 2018
@@ -9,7 +9,7 @@
 /// \file
 ///
 /// Functionalities used by the BackendPrinter to print out histograms
-/// related to number of {dispatch/issue/retire} per number of cycles.
+/// related to number of {issue/retire} per number of cycles.
 ///
 //===----------------------------------------------------------------------===//
 
@@ -30,10 +30,6 @@ void BackendStatistics::onInstructionEve
   }
   case HWInstructionEvent::Issued:
     ++NumIssued;
-    break;
-  case HWInstructionEvent::Dispatched: {
-    ++NumDispatched;
-  }
   }
 }
 
@@ -82,24 +78,6 @@ void BackendStatistics::printRetireUnitS
   OS << Buffer;
 }
 
-void BackendStatistics::printDispatchUnitStatistics(
-    llvm::raw_ostream &OS) const {
-  std::string Buffer;
-  raw_string_ostream TempStream(Buffer);
-  TempStream << "\n\nDispatch Logic - "
-             << "number of cycles where we saw N instructions dispatched:\n";
-  TempStream << "[# dispatched], [# cycles]\n";
-  for (const std::pair<unsigned, unsigned> &Entry : DispatchGroupSizePerCycle) {
-    TempStream << " " << Entry.first << ",              " << Entry.second
-               << "  ("
-               << format("%.1f", ((double)Entry.second / NumCycles) * 100.0)
-               << "%)\n";
-  }
-
-  TempStream.flush();
-  OS << Buffer;
-}
-
 void BackendStatistics::printSchedulerStatistics(llvm::raw_ostream &OS) const {
   std::string Buffer;
   raw_string_ostream TempStream(Buffer);
@@ -115,27 +93,6 @@ void BackendStatistics::printSchedulerSt
   TempStream.flush();
   OS << Buffer;
 }
-
-void BackendStatistics::printDispatchStalls(raw_ostream &OS) const {
-  std::string Buffer;
-  raw_string_ostream TempStream(Buffer);
-  TempStream << "\n\nDynamic Dispatch Stall Cycles:\n";
-  TempStream << "RAT     - Register unavailable:                      "
-             << HWStalls[HWStallEvent::RegisterFileStall];
-  TempStream << "\nRCU     - Retire tokens unavailable:                 "
-             << HWStalls[HWStallEvent::RetireControlUnitStall];
-  TempStream << "\nSCHEDQ  - Scheduler full:                            "
-             << HWStalls[HWStallEvent::SchedulerQueueFull];
-  TempStream << "\nLQ      - Load queue full:                           "
-             << HWStalls[HWStallEvent::LoadQueueFull];
-  TempStream << "\nSQ      - Store queue full:                          "
-             << HWStalls[HWStallEvent::StoreQueueFull];
-  TempStream << "\nGROUP   - Static restrictions on the dispatch group: "
-             << HWStalls[HWStallEvent::DispatchGroupStall];
-  TempStream << '\n';
-  TempStream.flush();
-  OS << Buffer;
-}
 
 void BackendStatistics::printSchedulerUsage(raw_ostream &OS,
                                             const MCSchedModel &SM) const {

Modified: llvm/trunk/tools/llvm-mca/BackendStatistics.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/BackendStatistics.h?rev=329708&r1=329707&r2=329708&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/BackendStatistics.h (original)
+++ llvm/trunk/tools/llvm-mca/BackendStatistics.h Tue Apr 10 07:55:14 2018
@@ -9,25 +9,11 @@
 /// \file
 ///
 /// This file implements a printer class for printing generic Backend
-/// statistics related to the dispatch logic, scheduler and retire unit.
+/// statistics related to the scheduler and retire unit.
 ///
 /// Example:
 /// ========
 ///
-/// Dynamic Dispatch Stall Cycles:
-/// RAT     - Register unavailable:                      0
-/// RCU     - Retire tokens unavailable:                 0
-/// SCHEDQ  - Scheduler full:                            42
-/// LQ      - Load queue full:                           0
-/// SQ      - Store queue full:                          0
-/// GROUP   - Static restrictions on the dispatch group: 0
-///
-///
-/// Dispatch Logic - number of cycles where we saw N instructions dispatched:
-/// [# dispatched], [# cycles]
-///  0,              15  (11.5%)
-///  5,              4  (3.1%)
-///
 /// Schedulers - number of cycles where we saw N instructions issued:
 /// [# issued], [# cycles]
 ///  0,          7  (5.4%)
@@ -41,7 +27,6 @@
 ///  2,           1  (0.8%)
 ///  4,           3  (2.3%)
 ///
-///
 /// Scheduler's queue usage:
 /// JALU01,  0/20
 /// JFPU01,  18/18
@@ -63,19 +48,13 @@ class BackendStatistics : public View {
   const llvm::MCSubtargetInfo &STI;
 
   using Histogram = llvm::DenseMap<unsigned, unsigned>;
-  Histogram DispatchGroupSizePerCycle;
   Histogram RetiredPerCycle;
   Histogram IssuedPerCycle;
 
-  unsigned NumDispatched;
   unsigned NumIssued;
   unsigned NumRetired;
   unsigned NumCycles;
 
-  // Counts dispatch stall events caused by unavailability of resources.  There
-  // is one counter for every generic stall kind (see class HWStallEvent).
-  llvm::SmallVector<unsigned, 8> HWStalls;
-
   // Tracks the usage of a scheduler's queue.
   struct BufferUsage {
     unsigned SlotsInUse;
@@ -88,23 +67,17 @@ class BackendStatistics : public View {
   llvm::DenseMap<unsigned, BufferUsage> BufferedResources;
 
   void updateHistograms() {
-    DispatchGroupSizePerCycle[NumDispatched]++;
     IssuedPerCycle[NumIssued]++;
     RetiredPerCycle[NumRetired]++;
-    NumDispatched = 0;
     NumIssued = 0;
     NumRetired = 0;
   }
 
   void printRetireUnitStatistics(llvm::raw_ostream &OS) const;
-  void printDispatchUnitStatistics(llvm::raw_ostream &OS) const;
   void printSchedulerStatistics(llvm::raw_ostream &OS) const;
 
-  void printDispatchStalls(llvm::raw_ostream &OS) const;
   void printRCUStatistics(llvm::raw_ostream &OS, const Histogram &Histogram,
                           unsigned Cycles) const;
-  void printDispatchUnitUsage(llvm::raw_ostream &OS, const Histogram &Stats,
-                              unsigned Cycles) const;
   void printIssuePerCycle(const Histogram &IssuePerCycle,
                           unsigned TotalCycles) const;
   void printSchedulerUsage(llvm::raw_ostream &OS,
@@ -112,8 +85,7 @@ class BackendStatistics : public View {
 
 public:
   BackendStatistics(const llvm::MCSubtargetInfo &sti)
-      : STI(sti), NumDispatched(0), NumIssued(0), NumRetired(0), NumCycles(0),
-        HWStalls(HWStallEvent::LastGenericEvent) { }
+      : STI(sti), NumIssued(0), NumRetired(0), NumCycles(0) { }
 
   void onInstructionEvent(const HWInstructionEvent &Event) override;
 
@@ -121,11 +93,6 @@ public:
 
   void onCycleEnd(unsigned Cycle) override { updateHistograms(); }
 
-  void onStallEvent(const HWStallEvent &Event) override {
-    if (Event.Type < HWStallEvent::LastGenericEvent)
-      HWStalls[Event.Type]++;
-  }
-
   // Increases the number of used scheduler queue slots of every buffered
   // resource in the Buffers set.
   void onReservedBuffers(llvm::ArrayRef<unsigned> Buffers) override;
@@ -135,8 +102,6 @@ public:
   void onReleasedBuffers(llvm::ArrayRef<unsigned> Buffers) override;
 
   void printView(llvm::raw_ostream &OS) const override {
-    printDispatchStalls(OS);
-    printDispatchUnitStatistics(OS);
     printSchedulerStatistics(OS);
     printRetireUnitStatistics(OS);
     printSchedulerUsage(OS, STI.getSchedModel());

Modified: llvm/trunk/tools/llvm-mca/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/CMakeLists.txt?rev=329708&r1=329707&r2=329708&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-mca/CMakeLists.txt Tue Apr 10 07:55:14 2018
@@ -15,6 +15,7 @@ add_llvm_tool(llvm-mca
   BackendStatistics.cpp
   CodeRegion.cpp
   Dispatch.cpp
+  DispatchStatistics.cpp
   HWEventListener.cpp
   InstrBuilder.cpp
   Instruction.cpp

Added: llvm/trunk/tools/llvm-mca/DispatchStatistics.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/DispatchStatistics.cpp?rev=329708&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-mca/DispatchStatistics.cpp (added)
+++ llvm/trunk/tools/llvm-mca/DispatchStatistics.cpp Tue Apr 10 07:55:14 2018
@@ -0,0 +1,66 @@
+//===--------------------- DispatchStatistics.cpp ---------------------*- C++
+//-*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+/// \file
+///
+/// This file implements the DispatchStatistics interface.
+///
+//===----------------------------------------------------------------------===//
+
+#include "DispatchStatistics.h"
+#include "llvm/Support/Format.h"
+
+using namespace llvm;
+
+namespace mca {
+
+void DispatchStatistics::onInstructionEvent(const HWInstructionEvent &Event) {
+  if (Event.Type == HWInstructionEvent::Dispatched)
+    ++NumDispatched;
+}
+
+void DispatchStatistics::printDispatchHistogram(llvm::raw_ostream &OS) const {
+  std::string Buffer;
+  raw_string_ostream TempStream(Buffer);
+  TempStream << "\n\nDispatch Logic - "
+             << "number of cycles where we saw N instructions dispatched:\n";
+  TempStream << "[# dispatched], [# cycles]\n";
+  for (const std::pair<unsigned, unsigned> &Entry : DispatchGroupSizePerCycle) {
+    TempStream << " " << Entry.first << ",              " << Entry.second
+               << "  ("
+               << format("%.1f", ((double)Entry.second / NumCycles) * 100.0)
+               << "%)\n";
+  }
+
+  TempStream.flush();
+  OS << Buffer;
+}
+
+void DispatchStatistics::printDispatchStalls(raw_ostream &OS) const {
+  std::string Buffer;
+  raw_string_ostream TempStream(Buffer);
+  TempStream << "\n\nDynamic Dispatch Stall Cycles:\n";
+  TempStream << "RAT     - Register unavailable:                      "
+             << HWStalls[HWStallEvent::RegisterFileStall];
+  TempStream << "\nRCU     - Retire tokens unavailable:                 "
+             << HWStalls[HWStallEvent::RetireControlUnitStall];
+  TempStream << "\nSCHEDQ  - Scheduler full:                            "
+             << HWStalls[HWStallEvent::SchedulerQueueFull];
+  TempStream << "\nLQ      - Load queue full:                           "
+             << HWStalls[HWStallEvent::LoadQueueFull];
+  TempStream << "\nSQ      - Store queue full:                          "
+             << HWStalls[HWStallEvent::StoreQueueFull];
+  TempStream << "\nGROUP   - Static restrictions on the dispatch group: "
+             << HWStalls[HWStallEvent::DispatchGroupStall];
+  TempStream << '\n';
+  TempStream.flush();
+  OS << Buffer;
+}
+
+} // namespace mca

Added: llvm/trunk/tools/llvm-mca/DispatchStatistics.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/DispatchStatistics.h?rev=329708&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-mca/DispatchStatistics.h (added)
+++ llvm/trunk/tools/llvm-mca/DispatchStatistics.h Tue Apr 10 07:55:14 2018
@@ -0,0 +1,91 @@
+//===--------------------- DispatchStatistics.h -----------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+/// \file
+///
+/// This file implements a view that prints a few statistics related to the
+/// dispatch logic. It collects and analyzes instruction dispatch events as
+/// well as static/dynamic dispatch stall events.
+///
+/// Example:
+/// ========
+///
+/// Dynamic Dispatch Stall Cycles:
+/// RAT     - Register unavailable:                      0
+/// RCU     - Retire tokens unavailable:                 0
+/// SCHEDQ  - Scheduler full:                            42
+/// LQ      - Load queue full:                           0
+/// SQ      - Store queue full:                          0
+/// GROUP   - Static restrictions on the dispatch group: 0
+///
+///
+/// Dispatch Logic - number of cycles where we saw N instructions dispatched:
+/// [# dispatched], [# cycles]
+///  0,              15  (11.5%)
+///  2,              4  (3.1%)
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TOOLS_LLVM_MCA_DISPATCHVIEW_H
+#define LLVM_TOOLS_LLVM_MCA_DISPATCHVIEW_H
+
+#include "View.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/MC/MCSubtargetInfo.h"
+
+namespace mca {
+
+class DispatchStatistics : public View {
+  const llvm::MCSubtargetInfo &STI;
+
+  using Histogram = llvm::DenseMap<unsigned, unsigned>;
+  Histogram DispatchGroupSizePerCycle;
+
+  unsigned NumDispatched;
+  unsigned NumCycles;
+
+  // Counts dispatch stall events caused by unavailability of resources.  There
+  // is one counter for every generic stall kind (see class HWStallEvent).
+  llvm::SmallVector<unsigned, 8> HWStalls;
+
+  void updateHistograms() {
+    DispatchGroupSizePerCycle[NumDispatched]++;
+    NumDispatched = 0;
+  }
+
+  void printDispatchHistogram(llvm::raw_ostream &OS) const;
+
+  void printDispatchStalls(llvm::raw_ostream &OS) const;
+  void printDispatchUnitUsage(llvm::raw_ostream &OS, const Histogram &Stats,
+                              unsigned Cycles) const;
+
+public:
+  DispatchStatistics(const llvm::MCSubtargetInfo &sti)
+      : STI(sti), NumDispatched(0), NumCycles(0),
+        HWStalls(HWStallEvent::LastGenericEvent) {}
+
+  void onInstructionEvent(const HWInstructionEvent &Event) override;
+
+  void onCycleBegin(unsigned Cycle) override { NumCycles++; }
+
+  void onCycleEnd(unsigned Cycle) override { updateHistograms(); }
+
+  void onStallEvent(const HWStallEvent &Event) override {
+    if (Event.Type < HWStallEvent::LastGenericEvent)
+      HWStalls[Event.Type]++;
+  }
+
+  void printView(llvm::raw_ostream &OS) const override {
+    printDispatchStalls(OS);
+    printDispatchHistogram(OS);
+  }
+};
+} // namespace mca
+
+#endif

Modified: llvm/trunk/tools/llvm-mca/llvm-mca.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mca/llvm-mca.cpp?rev=329708&r1=329707&r2=329708&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/llvm-mca.cpp (original)
+++ llvm/trunk/tools/llvm-mca/llvm-mca.cpp Tue Apr 10 07:55:14 2018
@@ -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 @@ static cl::opt<bool>
                            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 @@ int main(int argc, char **argv) {
       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));
 




More information about the llvm-commits mailing list