diff options
author | David Goodwin <david_goodwin@apple.com> | 2009-08-19 16:08:58 +0000 |
---|---|---|
committer | David Goodwin <david_goodwin@apple.com> | 2009-08-19 16:08:58 +0000 |
commit | dc4bdcdef1c8dd1a28b82deb08df039e5c0ffc5a (patch) | |
tree | 04180f2fa8fa18847ed96566e292e20b73099084 /include | |
parent | 774350a60694fee45403d87b5edfeff27ac54d58 (diff) |
Use the schedule itinerary operand use/def cycle information to adjust dependence edge latency for post-RA scheduling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79425 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/ScheduleDAG.h | 6 | ||||
-rw-r--r-- | include/llvm/Target/TargetInstrItineraries.h | 34 | ||||
-rw-r--r-- | include/llvm/Target/TargetSubtarget.h | 4 |
3 files changed, 32 insertions, 12 deletions
diff --git a/include/llvm/CodeGen/ScheduleDAG.h b/include/llvm/CodeGen/ScheduleDAG.h index ead3d3db26..f820200f99 100644 --- a/include/llvm/CodeGen/ScheduleDAG.h +++ b/include/llvm/CodeGen/ScheduleDAG.h @@ -495,6 +495,12 @@ namespace llvm { /// virtual void ComputeLatency(SUnit *SU) = 0; + /// ComputeOperandLatency - Override dependence edge latency using + /// operand use/def information + /// + virtual void ComputeOperandLatency(SUnit *Def, SUnit *Use, + SDep& dep) const { }; + /// Schedule - Order nodes according to selected style, filling /// in the Sequence member. /// diff --git a/include/llvm/Target/TargetInstrItineraries.h b/include/llvm/Target/TargetInstrItineraries.h index 9ba9cb61c5..0e4ca985dd 100644 --- a/include/llvm/Target/TargetInstrItineraries.h +++ b/include/llvm/Target/TargetInstrItineraries.h @@ -103,7 +103,7 @@ struct InstrItineraryData { /// isEmpty - Returns true if there are no itineraries. /// bool isEmpty() const { return Itineratries == 0; } - + /// beginStage - Return the first stage of the itinerary. /// const InstrStage *beginStage(unsigned ItinClassIndx) const { @@ -118,20 +118,17 @@ struct InstrItineraryData { return Stages + StageIdx; } - /// getLatency - Return the scheduling latency of the given class. A - /// simple latency value for an instruction is an over-simplification - /// for some architectures, but it's a reasonable first approximation. + /// getStageLatency - Return the total stage latency of the given + /// class. The latency is the maximum completion time for any stage + /// in the itinerary. /// - unsigned getLatency(unsigned ItinClassIndx) const { - // If the target doesn't provide latency information, use a simple - // non-zero default value for all instructions. + unsigned getStageLatency(unsigned ItinClassIndx) const { + // If the target doesn't provide itinerary information, use a + // simple non-zero default value for all instructions. if (isEmpty()) return 1; - // Caclulate the maximum completion time for any stage. The - // assumption is that all inputs are consumed at the start of the - // first stage and that all outputs are produced at the end of the - // latest completing last stage. + // Calculate the maximum completion time for any stage. unsigned Latency = 0, StartCycle = 0; for (const InstrStage *IS = beginStage(ItinClassIndx), *E = endStage(ItinClassIndx); IS != E; ++IS) { @@ -141,6 +138,21 @@ struct InstrItineraryData { return Latency; } + + /// getOperandCycle - Return the cycle for the given class and + /// operand. Return -1 if no cycle is specified for the operand. + /// + int getOperandCycle(unsigned ItinClassIndx, unsigned OperandIdx) const { + if (isEmpty()) + return -1; + + unsigned FirstIdx = Itineratries[ItinClassIndx].FirstOperandCycle; + unsigned LastIdx = Itineratries[ItinClassIndx].LastOperandCycle; + if ((FirstIdx + OperandIdx) >= LastIdx) + return -1; + + return (int)OperandCycles[FirstIdx + OperandIdx]; + } }; diff --git a/include/llvm/Target/TargetSubtarget.h b/include/llvm/Target/TargetSubtarget.h index c86e81554c..14f612af97 100644 --- a/include/llvm/Target/TargetSubtarget.h +++ b/include/llvm/Target/TargetSubtarget.h @@ -17,6 +17,7 @@ namespace llvm { class SDep; +class SUnit; //===----------------------------------------------------------------------===// /// @@ -40,7 +41,8 @@ public: // adjustSchedDependency - Perform target specific adjustments to // the latency of a schedule dependency. - virtual void adjustSchedDependency(SDep&) const { }; + virtual void adjustSchedDependency(SUnit *def, SUnit *use, + SDep& dep) const { }; }; } // End llvm namespace |