diff options
author | Andrew Trick <atrick@apple.com> | 2012-10-09 23:44:26 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2012-10-09 23:44:26 +0000 |
commit | 42bb106118db51393c2524c8b0c7f7ba6674cfd7 (patch) | |
tree | 4db8fd8567db1de98c4e5e5b6761152b52e94c77 /lib/CodeGen/TargetSchedule.cpp | |
parent | 714973e459d6611dd3e67f77968aba55528664b4 (diff) |
misched: Allow flags to disable hasInstrSchedModel/hasInstrItineraries for external users of TargetSchedule.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165564 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TargetSchedule.cpp')
-rw-r--r-- | lib/CodeGen/TargetSchedule.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/CodeGen/TargetSchedule.cpp b/lib/CodeGen/TargetSchedule.cpp index 2c98982ee2..6e7cccce42 100644 --- a/lib/CodeGen/TargetSchedule.cpp +++ b/lib/CodeGen/TargetSchedule.cpp @@ -27,6 +27,14 @@ static cl::opt<bool> EnableSchedModel("schedmodel", cl::Hidden, cl::init(true), static cl::opt<bool> EnableSchedItins("scheditins", cl::Hidden, cl::init(true), cl::desc("Use InstrItineraryData for latency lookup")); +bool TargetSchedModel::hasInstrSchedModel() const { + return EnableSchedModel && SchedModel.hasInstrSchedModel(); +} + +bool TargetSchedModel::hasInstrItineraries() const { + return EnableSchedItins && !InstrItins.isEmpty(); +} + void TargetSchedModel::init(const MCSchedModel &sm, const TargetSubtargetInfo *sti, const TargetInstrInfo *tii) { @@ -47,14 +55,12 @@ int TargetSchedModel::getDefLatency(const MachineInstr *DefMI, if (FindMin) { // If MinLatency is invalid, then use the itinerary for MinLatency. If no // itinerary exists either, then use single cycle latency. - if (SchedModel.MinLatency < 0 - && !(EnableSchedItins && hasInstrItineraries())) { + if (SchedModel.MinLatency < 0 && !hasInstrItineraries()) { return 1; } return SchedModel.MinLatency; } - else if (!(EnableSchedModel && hasInstrSchedModel()) - && !(EnableSchedItins && hasInstrItineraries())) { + else if (!hasInstrSchedModel() && !hasInstrItineraries()) { return TII->defaultDefLatency(&SchedModel, DefMI); } // ...operand lookup required @@ -123,7 +129,7 @@ unsigned TargetSchedModel::computeOperandLatency( if (DefLatency >= 0) return DefLatency; - if (EnableSchedItins && hasInstrItineraries()) { + if (hasInstrItineraries()) { int OperLatency = 0; if (UseMI) { OperLatency = @@ -145,7 +151,7 @@ unsigned TargetSchedModel::computeOperandLatency( TII->defaultDefLatency(&SchedModel, DefMI)); return InstrLatency; } - assert(!FindMin && EnableSchedModel && hasInstrSchedModel() && + assert(!FindMin && hasInstrSchedModel() && "Expected a SchedModel for this cpu"); const MCSchedClassDesc *SCDesc = resolveSchedClass(DefMI); unsigned DefIdx = findDefIdx(DefMI, DefOperIdx); |