diff options
author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-06-04 15:43:09 +0000 |
---|---|---|
committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-06-04 15:43:09 +0000 |
commit | 39e5a5695fd3e560565b40d1b60b4a1e78665875 (patch) | |
tree | 3945b3ad7cc4465a52e631ce891e42a057ddb79c /llvm/tools/llvm-mca/InstructionInfoView.cpp | |
parent | ab60a2823f1a6548c17c57abbbafdb4ddb3bb785 (diff) | |
download | bcm5719-llvm-39e5a5695fd3e560565b40d1b60b4a1e78665875.tar.gz bcm5719-llvm-39e5a5695fd3e560565b40d1b60b4a1e78665875.zip |
[RFC][patch 3/3] Add support for variant scheduling classes in llvm-mca.
This patch is the last of a sequence of three patches related to LLVM-dev RFC
"MC support for variant scheduling classes".
http://lists.llvm.org/pipermail/llvm-dev/2018-May/123181.html
This fixes PR36672.
The main goal of this patch is to teach llvm-mca how to solve variant scheduling
classes. This patch does that, plus it adds new variant scheduling classes to
the BtVer2 scheduling model to identify so-called zero-idioms (i.e. so-called
dependency breaking instructions that are known to generate zero, and that are
optimized out in hardware at register renaming stage).
Without the BtVer2 change, this patch would not have had any meaningful tests.
This patch is effectively the union of two changes:
1) a change that teaches llvm-mca how to resolve variant scheduling classes.
2) a change to the BtVer2 scheduling model that allows us to special-case
packed XOR zero-idioms (this partially fixes PR36671).
Differential Revision: https://reviews.llvm.org/D47374
llvm-svn: 333909
Diffstat (limited to 'llvm/tools/llvm-mca/InstructionInfoView.cpp')
-rw-r--r-- | llvm/tools/llvm-mca/InstructionInfoView.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/tools/llvm-mca/InstructionInfoView.cpp b/llvm/tools/llvm-mca/InstructionInfoView.cpp index 76d63d21cb2..3b1e4dc8188 100644 --- a/llvm/tools/llvm-mca/InstructionInfoView.cpp +++ b/llvm/tools/llvm-mca/InstructionInfoView.cpp @@ -36,9 +36,16 @@ void InstructionInfoView::printView(raw_ostream &OS) const { for (unsigned I = 0, E = Instructions; I < E; ++I) { const MCInst &Inst = Source.getMCInstFromIndex(I); const MCInstrDesc &MCDesc = MCII.get(Inst.getOpcode()); - const MCSchedClassDesc &SCDesc = - *SM.getSchedClassDesc(MCDesc.getSchedClass()); + // Obtain the scheduling class information from the instruction. + unsigned SchedClassID = MCDesc.getSchedClass(); + unsigned CPUID = SM.getProcessorID(); + + // Try to solve variant scheduling classes. + while (SchedClassID && SM.getSchedClassDesc(SchedClassID)->isVariant()) + SchedClassID = STI.resolveVariantSchedClass(SchedClassID, &Inst, CPUID); + + const MCSchedClassDesc &SCDesc = *SM.getSchedClassDesc(SchedClassID); unsigned NumMicroOpcodes = SCDesc.NumMicroOps; unsigned Latency = MCSchedModel::computeInstrLatency(STI, SCDesc); Optional<double> RThroughput = |