diff options
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/TargetSchedule.cpp | 16 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/TargetSubtargetInfo.cpp | 4 | 
2 files changed, 17 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/TargetSchedule.cpp b/llvm/lib/CodeGen/TargetSchedule.cpp index 5b6f72fbb35..2709df5697b 100644 --- a/llvm/lib/CodeGen/TargetSchedule.cpp +++ b/llvm/lib/CodeGen/TargetSchedule.cpp @@ -261,7 +261,13 @@ TargetSchedModel::computeInstrLatency(const MCSchedClassDesc &SCDesc) const {  unsigned TargetSchedModel::computeInstrLatency(unsigned Opcode) const {    assert(hasInstrSchedModel() && "Only call this function with a SchedModel");    unsigned SCIdx = TII->get(Opcode).getSchedClass(); -  return SchedModel.computeInstrLatency(*STI, SCIdx); +  return capLatency(SchedModel.computeInstrLatency(*STI, SCIdx)); +} + +unsigned TargetSchedModel::computeInstrLatency(const MCInst &Inst) const { +  if (hasInstrSchedModel()) +    return capLatency(SchedModel.computeInstrLatency(*STI, *TII, Inst)); +  return computeInstrLatency(Inst.getOpcode());  }  unsigned @@ -342,3 +348,11 @@ TargetSchedModel::computeReciprocalThroughput(unsigned Opcode) const {    }    return Optional<double>();  } + +Optional<double> +TargetSchedModel::computeReciprocalThroughput(const MCInst &MI) const { +  if (hasInstrSchedModel()) +    return SchedModel.getReciprocalThroughput(*STI, *TII, MI); +  return computeReciprocalThroughput(MI.getOpcode()); +} + diff --git a/llvm/lib/CodeGen/TargetSubtargetInfo.cpp b/llvm/lib/CodeGen/TargetSubtargetInfo.cpp index 6231402f043..97ca707a738 100644 --- a/llvm/lib/CodeGen/TargetSubtargetInfo.cpp +++ b/llvm/lib/CodeGen/TargetSubtargetInfo.cpp @@ -102,7 +102,7 @@ std::string TargetSubtargetInfo::getSchedInfoStr(MCInst const &MCI) const {    TSchedModel.init(this);    unsigned Latency;    if (TSchedModel.hasInstrSchedModel()) -    Latency = TSchedModel.computeInstrLatency(MCI.getOpcode()); +    Latency = TSchedModel.computeInstrLatency(MCI);    else if (TSchedModel.hasInstrItineraries()) {      auto *ItinData = TSchedModel.getInstrItineraries();      Latency = ItinData->getStageLatency( @@ -110,7 +110,7 @@ std::string TargetSubtargetInfo::getSchedInfoStr(MCInst const &MCI) const {    } else      return std::string();    Optional<double> RThroughput = -      TSchedModel.computeReciprocalThroughput(MCI.getOpcode()); +      TSchedModel.computeReciprocalThroughput(MCI);    return createSchedInfoStr(Latency, RThroughput);  }  | 

