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

llvm-svn: 328493
This commit is contained in:
Andrea Di Biagio 2018-03-26 13:44:54 +00:00
parent 1feccc2481
commit ff9c1092b7
3 changed files with 41 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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));