diff options
author | Andrew V. Tischenko <andrew.v.tischenko@gmail.com> | 2017-08-01 09:15:43 +0000 |
---|---|---|
committer | Andrew V. Tischenko <andrew.v.tischenko@gmail.com> | 2017-08-01 09:15:43 +0000 |
commit | d56595184b5c5edc138c6ae677a1ac38a9a31581 (patch) | |
tree | 1f20e3e0bde6be77018bdd4228f13a132aa5d1eb /llvm/lib/CodeGen/TargetSubtargetInfo.cpp | |
parent | 2ae1edd139003aced9fcfc9aa6edef8a6a4fd693 (diff) | |
download | bcm5719-llvm-d56595184b5c5edc138c6ae677a1ac38a9a31581.tar.gz bcm5719-llvm-d56595184b5c5edc138c6ae677a1ac38a9a31581.zip |
Support itineraries in TargetSubtargetInfo::getSchedInfoStr - Now if the given instr does not have sched model then we try to calculate the latecy/throughput with help of itineraries.
Differential Revision https://reviews.llvm.org/D35997
llvm-svn: 309666
Diffstat (limited to 'llvm/lib/CodeGen/TargetSubtargetInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetSubtargetInfo.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/TargetSubtargetInfo.cpp b/llvm/lib/CodeGen/TargetSubtargetInfo.cpp index f6d5bc80ddf..859fac3cd63 100644 --- a/llvm/lib/CodeGen/TargetSubtargetInfo.cpp +++ b/llvm/lib/CodeGen/TargetSubtargetInfo.cpp @@ -11,13 +11,14 @@ // //===----------------------------------------------------------------------===// +#include "llvm/Target/TargetSubtargetInfo.h" #include "llvm/ADT/Optional.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/TargetSchedule.h" #include "llvm/MC/MCInst.h" -#include "llvm/Target/TargetSubtargetInfo.h" #include "llvm/Support/Format.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Target/TargetInstrInfo.h" #include <string> using namespace llvm; @@ -93,9 +94,15 @@ std::string TargetSubtargetInfo::getSchedInfoStr(MCInst const &MCI) const { // that could be changed during the compilation TargetSchedModel TSchedModel; TSchedModel.init(getSchedModel(), this, getInstrInfo()); - if (!TSchedModel.hasInstrSchedModel()) + unsigned Latency; + if (TSchedModel.hasInstrSchedModel()) + Latency = TSchedModel.computeInstrLatency(MCI.getOpcode()); + else if (TSchedModel.hasInstrItineraries()) { + auto *ItinData = TSchedModel.getInstrItineraries(); + Latency = ItinData->getStageLatency( + getInstrInfo()->get(MCI.getOpcode()).getSchedClass()); + } else return std::string(); - unsigned Latency = TSchedModel.computeInstrLatency(MCI.getOpcode()); Optional<double> RThroughput = TSchedModel.computeInstrRThroughput(MCI.getOpcode()); return createSchedInfoStr(Latency, RThroughput); |