diff options
-rw-r--r-- | llvm/docs/CommandGuide/llvm-mca.rst | 4 | ||||
-rw-r--r-- | llvm/test/tools/llvm-mca/X86/BtVer2/instruction-info-view.s | 23 | ||||
-rw-r--r-- | llvm/tools/llvm-mca/llvm-mca.cpp | 18 |
3 files changed, 41 insertions, 4 deletions
diff --git a/llvm/docs/CommandGuide/llvm-mca.rst b/llvm/docs/CommandGuide/llvm-mca.rst index b4730cb1450..97a27f043c6 100644 --- a/llvm/docs/CommandGuide/llvm-mca.rst +++ b/llvm/docs/CommandGuide/llvm-mca.rst @@ -128,6 +128,10 @@ option specifies "``-``", then the output will also be sent to standard output. 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 diff --git a/llvm/test/tools/llvm-mca/X86/BtVer2/instruction-info-view.s b/llvm/test/tools/llvm-mca/X86/BtVer2/instruction-info-view.s new file mode 100644 index 00000000000..e039d29c783 --- /dev/null +++ b/llvm/test/tools/llvm-mca/X86/BtVer2/instruction-info-view.s @@ -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 diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp index 127b22f67f4..cae4c2741b1 100644 --- a/llvm/tools/llvm-mca/llvm-mca.cpp +++ b/llvm/tools/llvm-mca/llvm-mca.cpp @@ -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)); |