Minor cleanup of defaultDefLatency API

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161470 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Andrew Trick
2012-08-08 02:44:11 +00:00
parent d598bd3aee
commit 3c417554ca
2 changed files with 10 additions and 7 deletions

View File

@@ -28,6 +28,7 @@ class MachineMemOperand;
class MachineRegisterInfo; class MachineRegisterInfo;
class MDNode; class MDNode;
class MCInst; class MCInst;
class MCSchedModel;
class SDNode; class SDNode;
class ScheduleHazardRecognizer; class ScheduleHazardRecognizer;
class SelectionDAG; class SelectionDAG;
@@ -790,7 +791,7 @@ public:
SDNode *Node) const = 0; SDNode *Node) const = 0;
/// Return the default expected latency for a def based on it's opcode. /// Return the default expected latency for a def based on it's opcode.
unsigned defaultDefLatency(const InstrItineraryData *ItinData, unsigned defaultDefLatency(const MCSchedModel *SchedModel,
const MachineInstr *DefMI) const; const MachineInstr *DefMI) const;
/// isHighLatencyDef - Return true if this opcode has high latency to its /// isHighLatencyDef - Return true if this opcode has high latency to its

View File

@@ -570,12 +570,12 @@ TargetInstrInfoImpl::getNumMicroOps(const InstrItineraryData *ItinData,
} }
/// Return the default expected latency for a def based on it's opcode. /// Return the default expected latency for a def based on it's opcode.
unsigned TargetInstrInfo::defaultDefLatency(const InstrItineraryData *ItinData, unsigned TargetInstrInfo::defaultDefLatency(const MCSchedModel *SchedModel,
const MachineInstr *DefMI) const { const MachineInstr *DefMI) const {
if (DefMI->mayLoad()) if (DefMI->mayLoad())
return ItinData->SchedModel->LoadLatency; return SchedModel->LoadLatency;
if (isHighLatencyDef(DefMI->getOpcode())) if (isHighLatencyDef(DefMI->getOpcode()))
return ItinData->SchedModel->HighLatency; return SchedModel->HighLatency;
return 1; return 1;
} }
@@ -638,7 +638,7 @@ static int computeDefOperandLatency(
return 1; return 1;
} }
else if(ItinData->isEmpty()) else if(ItinData->isEmpty())
return TII->defaultDefLatency(ItinData, DefMI); return TII->defaultDefLatency(ItinData->SchedModel, DefMI);
// ...operand lookup required // ...operand lookup required
return -1; return -1;
@@ -669,7 +669,8 @@ computeOperandLatency(const InstrItineraryData *ItinData,
// Expected latency is the max of the stage latency and itinerary props. // Expected latency is the max of the stage latency and itinerary props.
if (!FindMin) if (!FindMin)
InstrLatency = std::max(InstrLatency, defaultDefLatency(ItinData, DefMI)); InstrLatency = std::max(InstrLatency,
defaultDefLatency(ItinData->SchedModel, DefMI));
return InstrLatency; return InstrLatency;
} }
@@ -742,6 +743,7 @@ computeOperandLatency(const InstrItineraryData *ItinData,
// Expected latency is the max of the stage latency and itinerary props. // Expected latency is the max of the stage latency and itinerary props.
if (!FindMin) if (!FindMin)
InstrLatency = std::max(InstrLatency, defaultDefLatency(ItinData, DefMI)); InstrLatency = std::max(InstrLatency,
defaultDefLatency(ItinData->SchedModel, DefMI));
return InstrLatency; return InstrLatency;
} }