31static_assert(std::is_trivial_v<MCSchedModel>,
32 "MCSchedModel is required to be a trivial type");
34 DefaultMicroOpBufferSize,
35 DefaultLoopMicroOpBufferSize,
38 DefaultMispredictPenalty,
55 DefIdx != DefEnd; ++DefIdx) {
68 unsigned SchedClass)
const {
80 const MCInst &Inst)
const {
85 if (!SCDesc->isValid())
89 unsigned SchedClass = 0;
90 while (SCDesc->isVariant()) {
97 assert(
false &&
"unsupported variant scheduling class");
108 std::optional<double> MinThroughput;
112 for (;
I != E; ++
I) {
113 if (!
I->ReleaseAtCycle ||
I->ReleaseAtCycle ==
I->AcquireAtCycle)
115 assert(
I->ReleaseAtCycle >
I->AcquireAtCycle &&
"invalid resource segment");
118 double(NumUnits) / double(
I->ReleaseAtCycle -
I->AcquireAtCycle);
120 MinThroughput ? std::min(*MinThroughput, Throughput) : Throughput;
123 return 1.0 / *MinThroughput;
133 const MCInst &Inst)
const {
157 std::optional<double> Throughput;
160 for (;
I != E; ++
I) {
164 Throughput = Throughput ? std::min(*Throughput, Temp) : Temp;
167 return 1.0 / *Throughput;
176 unsigned WriteResourceID) {
182 if (E.WriteResourceID != WriteResourceID)
184 DelayCycles = std::min(DelayCycles, E.Cycles);
187 return std::abs(DelayCycles);
197 unsigned MaxLatency = 0;
198 unsigned WriteResourceID = 0;
201 for (
unsigned DefIdx = 0; DefIdx != DefEnd; ++DefIdx) {
209 if (Cycles > MaxLatency) {
216 if (E.WriteResourceID == WriteResourceID)
228 unsigned ProcResourceIdx,
float ReservationStationScaleFactor)
const {
243 APFloat Scale(ReservationStationScaleFactor);
248 APFloat Product(
static_cast<float>(BufferSize));
255 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.
LLVM_ABI cl::OptionCategory MCScheduleOptions
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...