diff options
Diffstat (limited to 'include/llvm/CodeGen/TargetSchedule.h')
-rw-r--r-- | include/llvm/CodeGen/TargetSchedule.h | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/include/llvm/CodeGen/TargetSchedule.h b/include/llvm/CodeGen/TargetSchedule.h index 81054aba066f..1992412120aa 100644 --- a/include/llvm/CodeGen/TargetSchedule.h +++ b/include/llvm/CodeGen/TargetSchedule.h @@ -1,4 +1,4 @@ -//===-- llvm/CodeGen/TargetSchedule.h - Sched Machine Model -----*- C++ -*-===// +//===- llvm/CodeGen/TargetSchedule.h - Sched Machine Model ------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -23,10 +23,8 @@ namespace llvm { -class TargetRegisterInfo; -class TargetSubtargetInfo; -class TargetInstrInfo; class MachineInstr; +class TargetInstrInfo; /// Provide an instruction scheduling machine model to CodeGen passes. class TargetSchedModel { @@ -34,8 +32,8 @@ class TargetSchedModel { // processor. MCSchedModel SchedModel; InstrItineraryData InstrItins; - const TargetSubtargetInfo *STI; - const TargetInstrInfo *TII; + const TargetSubtargetInfo *STI = nullptr; + const TargetInstrInfo *TII = nullptr; SmallVector<unsigned, 16> ResourceFactors; unsigned MicroOpFactor; // Multiply to normalize microops to resource units. @@ -44,7 +42,7 @@ class TargetSchedModel { unsigned computeInstrLatency(const MCSchedClassDesc &SCDesc) const; public: - TargetSchedModel(): SchedModel(MCSchedModel::GetDefaultSchedModel()), STI(nullptr), TII(nullptr) {} + TargetSchedModel() : SchedModel(MCSchedModel::GetDefaultSchedModel()) {} /// \brief Initialize the machine model for instruction scheduling. /// @@ -93,6 +91,13 @@ public: /// \brief Maximum number of micro-ops that may be scheduled per cycle. unsigned getIssueWidth() const { return SchedModel.IssueWidth; } + /// \brief Return true if new group must begin. + bool mustBeginGroup(const MachineInstr *MI, + const MCSchedClassDesc *SC = nullptr) const; + /// \brief Return true if current group must end. + bool mustEndGroup(const MachineInstr *MI, + const MCSchedClassDesc *SC = nullptr) const; + /// \brief Return the number of issue slots required for this MI. unsigned getNumMicroOps(const MachineInstr *MI, const MCSchedClassDesc *SC = nullptr) const; @@ -178,13 +183,18 @@ public: bool UseDefaultDefLatency = true) const; unsigned computeInstrLatency(unsigned Opcode) const; + /// \brief Output dependency latency of a pair of defs of the same register. /// /// This is typically one cycle. unsigned computeOutputLatency(const MachineInstr *DefMI, unsigned DefIdx, const MachineInstr *DepMI) const; + + /// \brief Compute the reciprocal throughput of the given instruction. + Optional<double> computeInstrRThroughput(const MachineInstr *MI) const; + Optional<double> computeInstrRThroughput(unsigned Opcode) const; }; -} // namespace llvm +} // end namespace llvm -#endif +#endif // LLVM_CODEGEN_TARGETSCHEDULE_H |