29 "sched-model-reservation-station-scale-factor",
cl::Hidden,
31 cl::desc(
"Scale the buffer size of all reservation stations by a positive "
32 "factor. Buffer sizes of -1/0/1 (unlimited/unbuffered/in-order) "
33 "are preserved. Likewise, if the scaled result is <= 1, the "
34 "original size is kept. Computed sizes "
35 "are truncated towards zero."));
37static_assert(std::is_trivial_v<MCSchedModel>,
38 "MCSchedModel is required to be a trivial type");
40 DefaultMicroOpBufferSize,
41 DefaultLoopMicroOpBufferSize,
44 DefaultMispredictPenalty,
61 DefIdx != DefEnd; ++DefIdx) {
74 unsigned SchedClass)
const {
86 const MCInst &Inst)
const {
91 if (!SCDesc->isValid())
95 unsigned SchedClass = 0;
96 while (SCDesc->isVariant()) {
103 assert(
false &&
"unsupported variant scheduling class");
114 std::optional<double> MinThroughput;
118 for (;
I != E; ++
I) {
119 if (!
I->ReleaseAtCycle ||
I->ReleaseAtCycle ==
I->AcquireAtCycle)
121 assert(
I->ReleaseAtCycle >
I->AcquireAtCycle &&
"invalid resource segment");
122 unsigned NumUnits =
SM.getProcResource(
I->ProcResourceIdx)->NumUnits;
124 double(NumUnits) / double(
I->ReleaseAtCycle -
I->AcquireAtCycle);
126 MinThroughput ? std::min(*MinThroughput, Throughput) : Throughput;
129 return 1.0 / *MinThroughput;
139 const MCInst &Inst)
const {
163 std::optional<double> Throughput;
166 for (;
I != E; ++
I) {
170 Throughput = Throughput ? std::min(*Throughput, Temp) : Temp;
173 return 1.0 / *Throughput;
182 unsigned WriteResourceID) {
188 if (E.WriteResourceID != WriteResourceID)
190 DelayCycles = std::min(DelayCycles, E.Cycles);
193 return std::abs(DelayCycles);
203 unsigned MaxLatency = 0;
204 unsigned WriteResourceID = 0;
207 for (
unsigned DefIdx = 0; DefIdx != DefEnd; ++DefIdx) {
215 if (Cycles > MaxLatency) {
222 if (E.WriteResourceID == WriteResourceID)
253 APFloat Product(
static_cast<float>(BufferSize));
260 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 cl::opt< float > ReservationStationScaleFactor("sched-model-reservation-station-scale-factor", cl::Hidden, cl::init(DefaultReservationStationScaleFactor), cl::desc("Scale the buffer size of all reservation stations by a positive " "factor. Buffer sizes of -1/0/1 (unlimited/unbuffered/in-order) " "are preserved. Likewise, if the scaled result is <= 1, the " "original size is kept. Computed sizes " "are truncated towards zero."))
static constexpr unsigned SM(unsigned Version)
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.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
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.
uint16_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 LLVM_ABI int computeInstrLatency(const MCSubtargetInfo &STI, const MCSchedClassDesc &SCDesc)
Returns the latency value for the scheduling class.
friend class InstrItineraryData
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.
static LLVM_ABI double getReciprocalThroughput(const MCSubtargetInfo &STI, const MCSchedClassDesc &SCDesc)
LLVM_ABI int getResourceBufferSize(unsigned ProcResourceIdx) const
Return the buffer size of the resource.
static const unsigned DefaultIssueWidth
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...