[llvm] r328493 - [llvm-mca] Add a flag -instruction-info to enable/disable the instruction info view.

Andrea Di Biagio via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 26 06:44:54 PDT 2018


Author: adibiagio
Date: Mon Mar 26 06:44:54 2018
New Revision: 328493

URL: http://llvm.org/viewvc/llvm-project?rev=328493&view=rev
Log:
[llvm-mca] Add a flag -instruction-info to enable/disable the instruction info view.

Added:
    llvm/trunk/test/tools/llvm-mca/X86/BtVer2/instruction-info-view.s
Modified:
    llvm/trunk/docs/CommandGuide/llvm-mca.rst
    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=328493&r1=328492&r2=328493&view=diff
==============================================================================
--- llvm/trunk/docs/CommandGuide/llvm-mca.rst (original)
+++ llvm/trunk/docs/CommandGuide/llvm-mca.rst Mon Mar 26 06:44:54 2018
@@ -128,6 +128,10 @@ option specifies "``-``", then the outpu
 
   Enable the resource pressure view. This is enabled by default.
 
+.. option:: -instruction-info
+
+  Enable the instruction info view. This is enabled by default.
+
 .. option:: -instruction-tables
 
   Prints resource pressure information based on the static information

Added: llvm/trunk/test/tools/llvm-mca/X86/BtVer2/instruction-info-view.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-mca/X86/BtVer2/instruction-info-view.s?rev=328493&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-mca/X86/BtVer2/instruction-info-view.s (added)
+++ llvm/trunk/test/tools/llvm-mca/X86/BtVer2/instruction-info-view.s Mon Mar 26 06:44:54 2018
@@ -0,0 +1,23 @@
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -resource-pressure=false -instruction-info=true < %s | FileCheck %s --check-prefix=ENABLED
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -resource-pressure=false -instruction-info=false < %s | FileCheck %s -check-prefix=DISABLED
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -resource-pressure=false -instruction-info < %s | FileCheck %s -check-prefix=ENABLED
+# RUN: llvm-mca -mtriple=x86_64-unknown-unknown -mcpu=btver2 -resource-pressure=false < %s | FileCheck %s -check-prefix=ENABLED
+
+vmulps   %xmm0, %xmm1, %xmm2
+vhaddps  %xmm2, %xmm2, %xmm3
+vhaddps  %xmm3, %xmm3, %xmm4
+
+# DISABLED-NOT: Instruction Info:
+
+# ENABLED:      Instruction Info:
+# ENABLED-NEXT: [1]: #uOps
+# ENABLED-NEXT: [2]: Latency
+# ENABLED-NEXT: [3]: RThroughput
+# ENABLED-NEXT: [4]: MayLoad
+# ENABLED-NEXT: [5]: MayStore
+# ENABLED-NEXT: [6]: HasSideEffects
+
+# ENABLED:      [1]    [2]    [3]    [4]    [5]    [6]	Instructions:
+# ENABLED-NEXT:  1      2     1.00                    	vmulps	%xmm0, %xmm1, %xmm2
+# ENABLED-NEXT:  1      3     1.00                    	vhaddps	%xmm2, %xmm2, %xmm3
+# ENABLED-NEXT:  1      3     1.00                    	vhaddps	%xmm3, %xmm3, %xmm4

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=328493&r1=328492&r2=328493&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mca/llvm-mca.cpp (original)
+++ llvm/trunk/tools/llvm-mca/llvm-mca.cpp Mon Mar 26 06:44:54 2018
@@ -131,6 +131,11 @@ static cl::opt<bool>
                            cl::desc("Print instruction tables"),
                            cl::init(false));
 
+static cl::opt<bool>
+    PrintInstructionInfoView("instruction-info",
+                             cl::desc("Print the instruction info view"),
+                             cl::init(true));
+
 static const Target *getTarget(const char *ProgName) {
   TripleName = Triple::normalize(TripleName);
   if (TripleName.empty())
@@ -336,9 +341,13 @@ int main(int argc, char **argv) {
 
   if (PrintInstructionTables) {
     mca::InstructionTables IT(STI->getSchedModel(), *IB, *S);
+
+    if (PrintInstructionInfoView) {
+      mca::InstructionInfoView IIV(*STI, *MCII, *S, *IP);
+      IT.addEventListener(&IIV);
+    }
+
     mca::ResourcePressureView RPV(*STI, *IP, *S);
-    mca::InstructionInfoView IIV(*STI, *MCII, *S, *IP);
-    IT.addEventListener(&IIV);
     IT.addEventListener(&RPV);
     IT.run();
     RPV.printView(TOF->os());
@@ -355,8 +364,9 @@ int main(int argc, char **argv) {
 
   Printer->addView(llvm::make_unique<mca::SummaryView>(*S, Width));
 
-  Printer->addView(
-      llvm::make_unique<mca::InstructionInfoView>(*STI, *MCII, *S, *IP));
+  if (PrintInstructionInfoView)
+    Printer->addView(
+        llvm::make_unique<mca::InstructionInfoView>(*STI, *MCII, *S, *IP));
 
   if (PrintModeVerbose)
     Printer->addView(llvm::make_unique<mca::BackendStatistics>(*STI));




More information about the llvm-commits mailing list