28static_assert(std::is_trivial_v<MCSchedModel>,
29 "MCSchedModel is required to be a trivial type");
31 DefaultMicroOpBufferSize,
32 DefaultLoopMicroOpBufferSize,
35 DefaultMispredictPenalty,
52 DefIdx != DefEnd; ++DefIdx) {
65 unsigned SchedClass)
const {
77 const MCInst &Inst)
const {
82 if (!SCDesc->isValid())
86 unsigned SchedClass = 0;
87 while (SCDesc->isVariant()) {
94 assert(
false &&
"unsupported variant scheduling class");
105 std::optional<double> MinThroughput;
109 for (;
I != E; ++
I) {
110 if (!
I->ReleaseAtCycle ||
I->ReleaseAtCycle ==
I->AcquireAtCycle)
112 assert(
I->ReleaseAtCycle >
I->AcquireAtCycle &&
"invalid resource segment");
115 double(NumUnits) / double(
I->ReleaseAtCycle -
I->AcquireAtCycle);
117 MinThroughput ? std::min(*MinThroughput, Throughput) : Throughput;
120 return 1.0 / *MinThroughput;
130 const MCInst &Inst)
const {
154 std::optional<double> Throughput;
157 for (;
I != E; ++
I) {
161 Throughput = Throughput ? std::min(*Throughput, Temp) : Temp;
164 return 1.0 / *Throughput;
173 unsigned WriteResourceID) {
179 if (E.WriteResourceID != WriteResourceID)
181 DelayCycles = std::min(DelayCycles, E.Cycles);
184 return std::abs(DelayCycles);
194 unsigned MaxLatency = 0;
195 unsigned WriteResourceID = 0;
198 for (
unsigned DefIdx = 0; DefIdx != DefEnd; ++DefIdx) {
206 if (Cycles > MaxLatency) {
213 if (E.WriteResourceID == WriteResourceID)
225 unsigned ProcResourceIdx,
float ReservationStationScaleFactor)
const {
240 APFloat Scale(ReservationStationScaleFactor);
245 APFloat Product(
static_cast<float>(BufferSize));
252 int Scaled =
static_cast<int>(Result.getExtValue());
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file declares a class to represent arbitrary precision floating point values and provide a varie...
This file implements the APSInt class, which is a simple class that represents an arbitrary sized int...
#define LLVM_LIKELY(EXPR)
static constexpr float DefaultReservationStationScaleFactor
static constexpr roundingMode rmTowardZero
opStatus multiply(const APFloat &RHS, roundingMode RM)
opStatus convertToInteger(MutableArrayRef< integerPart > Input, unsigned int Width, bool IsSigned, roundingMode RM, bool *IsExact) const
An arbitrary precision integer that knows its signedness.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
bool empty() const
Check if the array is empty.
const InstrStage * beginStage(unsigned ItinClassIndx) const
Return the first stage of the itinerary.
const InstrStage * endStage(unsigned ItinClassIndx) const
Return the last+1 stage of the itinerary.
Instances of this class represent a single low-level machine instruction.
unsigned getOpcode() const
unsigned getSchedClass() const
Return the scheduling class for this instruction.
Interface to description of machine instruction set.
const MCInstrDesc & get(unsigned Opcode) const
Return the machine instruction descriptor that corresponds to the specified instruction opcode.
Generic base class for all target subtargets.
const MCWriteProcResEntry * getWriteProcResEnd(const MCSchedClassDesc *SC) const
virtual unsigned resolveVariantSchedClass(unsigned SchedClass, const MCInst *MI, const MCInstrInfo *MCII, unsigned CPUID) const
Resolve a variant scheduling class for the given MCInst and CPU.
ArrayRef< MCReadAdvanceEntry > getReadAdvanceEntries(const MCSchedClassDesc &SC) const
Return the set of ReadAdvance entries declared by the scheduling class descriptor in input.
const MCWriteLatencyEntry * getWriteLatencyEntry(const MCSchedClassDesc *SC, unsigned DefIdx) const
const MCWriteProcResEntry * getWriteProcResBegin(const MCSchedClassDesc *SC) const
Return an iterator at the first process resource consumed by the given scheduling class.
const MCSchedModel & getSchedModel() const
Get the machine model for this subtarget's CPU.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
const MCCLOptions & getMCCLOptions(const MCTargetOptions &Options)
constexpr int popcount(T Value) noexcept
Count the number of set bits in a value.
These values represent a non-pipelined step in the execution of an instruction.
Specify the number of cycles allowed after instruction issue before a particular use operand reads it...
Summarize the scheduling resources required for an instruction of a particular scheduling class.
uint8_t NumWriteLatencyEntries
Machine model for scheduling, bundling, and heuristics.
static LLVM_ABI const MCSchedModel Default
Returns the default initialized model.
static LLVM_ABI unsigned getForwardingDelayCycles(ArrayRef< MCReadAdvanceEntry > Entries, unsigned WriteResourceIdx=0)
Returns the maximum forwarding delay for register reads dependent on writes of scheduling class Write...
const MCSchedClassDesc * getSchedClassDesc(unsigned SchedClassIdx) const
unsigned getProcessorID() const
static constexpr unsigned DefaultIssueWidth
static LLVM_ABI int computeInstrLatency(const MCSubtargetInfo &STI, const MCSchedClassDesc &SCDesc)
Returns the latency value for the scheduling class.
friend class InstrItineraryData
static LLVM_ABI float getReservationStationScaleFactor(const MCTargetOptions &Options)
Returns the -sched-model-reservation-station-scale-factor value.
const MCProcResourceDesc * getProcResource(unsigned ProcResourceIdx) const
static LLVM_ABI unsigned getBypassDelayCycles(const MCSubtargetInfo &STI, const MCSchedClassDesc &SCDesc)
Returns the bypass delay cycle for the maximum latency write cycle.
LLVM_ABI int getResourceBufferSize(unsigned ProcResourceIdx, float ReservationStationScaleFactor) const
Return the buffer size of the resource.
static LLVM_ABI double getReciprocalThroughput(const MCSubtargetInfo &STI, const MCSchedClassDesc &SCDesc)
Specify the latency in cpu cycles for a particular scheduling class and def index.
Identify one of the processor resource kinds consumed by a particular scheduling class for the specif...