Warning, /include/llvm/Target/TargetSchedule.td is written in an unsupported language. File is not indexed.
0001 //===- TargetSchedule.td - Target Independent Scheduling ---*- tablegen -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file defines the target-independent scheduling interfaces which should
0010 // be implemented by each target which is using TableGen based scheduling.
0011 //
0012 // The SchedMachineModel is defined by subtargets for three categories of data:
0013 // 1. Basic properties for coarse grained instruction cost model.
0014 // 2. Scheduler Read/Write resources for simple per-opcode cost model.
0015 // 3. Instruction itineraries for detailed reservation tables.
0016 //
0017 // (1) Basic properties are defined by the SchedMachineModel
0018 // class. Target hooks allow subtargets to associate opcodes with
0019 // those properties.
0020 //
0021 // (2) A per-operand machine model can be implemented in any
0022 // combination of the following ways:
0023 //
0024 // A. Associate per-operand SchedReadWrite types with Instructions by
0025 // modifying the Instruction definition to inherit from Sched. For
0026 // each subtarget, define WriteRes and ReadAdvance to associate
0027 // processor resources and latency with each SchedReadWrite type.
0028 //
0029 // B. In each instruction definition, name an ItineraryClass. For each
0030 // subtarget, define ItinRW entries to map ItineraryClass to
0031 // per-operand SchedReadWrite types. Unlike method A, these types may
0032 // be subtarget specific and can be directly associated with resources
0033 // by defining SchedWriteRes and SchedReadAdvance.
0034 //
0035 // C. In the subtarget, map SchedReadWrite types to specific
0036 // opcodes. This overrides any SchedReadWrite types or
0037 // ItineraryClasses defined by the Instruction. As in method B, the
0038 // subtarget can directly associate resources with SchedReadWrite
0039 // types by defining SchedWriteRes and SchedReadAdvance.
0040 //
0041 // D. In either the target or subtarget, define SchedWriteVariant or
0042 // SchedReadVariant to map one SchedReadWrite type onto another
0043 // sequence of SchedReadWrite types. This allows dynamic selection of
0044 // an instruction's machine model via custom C++ code. It also allows
0045 // a machine-independent SchedReadWrite type to map to a sequence of
0046 // machine-dependent types.
0047 //
0048 // (3) A per-pipeline-stage machine model can be implemented by providing
0049 // Itineraries in addition to mapping instructions to ItineraryClasses.
0050 //===----------------------------------------------------------------------===//
0051
0052 // Include legacy support for instruction itineraries.
0053 include "llvm/Target/TargetItinerary.td"
0054
0055 class Predicate; // Forward def
0056
0057 // DAG operator that interprets the DAG args as Instruction defs.
0058 def instrs;
0059
0060 // DAG operator that interprets each DAG arg as a regex pattern for
0061 // matching Instruction opcode names.
0062 // The regex must match the beginning of the opcode (as in Python re.match).
0063 // To avoid matching prefixes, append '$' to the pattern.
0064 def instregex;
0065
0066 // Define the SchedMachineModel and provide basic properties for
0067 // coarse grained instruction cost model. Default values for the
0068 // properties are defined in MCSchedModel. A value of "-1" in the
0069 // target description's SchedMachineModel indicates that the property
0070 // is not overriden by the target.
0071 //
0072 // Target hooks allow subtargets to associate LoadLatency and
0073 // HighLatency with groups of opcodes.
0074 //
0075 // See MCSchedule.h for detailed comments.
0076 class SchedMachineModel {
0077 int IssueWidth = -1; // Max micro-ops that may be scheduled per cycle.
0078 int MicroOpBufferSize = -1; // Max micro-ops that can be buffered.
0079 int LoopMicroOpBufferSize = -1; // Max micro-ops that can be buffered for
0080 // optimized loop dispatch/execution.
0081 int LoadLatency = -1; // Cycles for loads to access the cache.
0082 int HighLatency = -1; // Approximation of cycles for "high latency" ops.
0083 int MispredictPenalty = -1; // Extra cycles for a mispredicted branch.
0084
0085 // Per-cycle resources tables.
0086 ProcessorItineraries Itineraries = NoItineraries;
0087
0088 bit PostRAScheduler = false; // Enable Post RegAlloc Scheduler pass.
0089
0090 // Subtargets that define a model for only a subset of instructions
0091 // that have a scheduling class (itinerary class or SchedRW list)
0092 // and may actually be generated for that subtarget must clear this
0093 // bit. Otherwise, the scheduler considers an unmodelled opcode to
0094 // be an error. This should only be set during initial bringup,
0095 // or there will be no way to catch simple errors in the model
0096 // resulting from changes to the instruction definitions.
0097 bit CompleteModel = true;
0098
0099 // Indicates that we should do full overlap checking for multiple InstrRWs
0100 // defining the same instructions within the same SchedMachineModel.
0101 // FIXME: Remove when all in tree targets are clean with the full check
0102 // enabled.
0103 bit FullInstRWOverlapCheck = true;
0104
0105 // A processor may only implement part of published ISA, due to either new ISA
0106 // extensions, (e.g. Pentium 4 doesn't have AVX) or implementation
0107 // (ARM/MIPS/PowerPC/SPARC soft float cores).
0108 //
0109 // For a processor which doesn't support some feature(s), the schedule model
0110 // can use:
0111 //
0112 // let<Predicate> UnsupportedFeatures = [HaveA,..,HaveY];
0113 //
0114 // to skip the checks for scheduling information when building LLVM for
0115 // instructions which have any of the listed predicates in their Predicates
0116 // field.
0117 list<Predicate> UnsupportedFeatures = [];
0118
0119 bit NoModel = false; // Special tag to indicate missing machine model.
0120
0121 // Tells the MachineScheduler whether or not to track resource usage
0122 // using intervals via ResourceSegments (see
0123 // llvm/include/llvm/CodeGen/MachineScheduler.h).
0124 bit EnableIntervals = false;
0125 }
0126
0127 def NoSchedModel : SchedMachineModel {
0128 let NoModel = true;
0129 let CompleteModel = false;
0130 }
0131
0132 // Define a kind of processor resource that may be common across
0133 // similar subtargets.
0134 class ProcResourceKind;
0135
0136 // Define a number of interchangeable processor resources. NumUnits
0137 // determines the throughput of instructions that require the resource.
0138 //
0139 // An optional Super resource may be given to model these resources as
0140 // a subset of the more general super resources. Using one of these
0141 // resources implies using one of the super resources.
0142 //
0143 // ProcResourceUnits normally model a few buffered resources within an
0144 // out-of-order engine. Buffered resources may be held for multiple
0145 // clock cycles, but the scheduler does not pin them to a particular
0146 // clock cycle relative to instruction dispatch. Setting BufferSize=0
0147 // changes this to an in-order issue/dispatch resource. In this case,
0148 // the scheduler counts down from the cycle that the instruction
0149 // issues in-order, forcing a stall whenever a subsequent instruction
0150 // requires the same resource until the number of ReleaseAtCycles
0151 // specified in WriteRes expire. Setting BufferSize=1 changes this to
0152 // an in-order latency resource. In this case, the scheduler models
0153 // producer/consumer stalls between instructions that use the
0154 // resource.
0155 //
0156 // Examples (all assume an out-of-order engine):
0157 //
0158 // Use BufferSize = -1 for "issue ports" fed by a unified reservation
0159 // station. Here the size of the reservation station is modeled by
0160 // MicroOpBufferSize, which should be the minimum size of either the
0161 // register rename pool, unified reservation station, or reorder
0162 // buffer.
0163 //
0164 // Use BufferSize = 0 for resources that force "dispatch/issue
0165 // groups". (Different processors define dispath/issue
0166 // differently. Here we refer to stage between decoding into micro-ops
0167 // and moving them into a reservation station.) Normally NumMicroOps
0168 // is sufficient to limit dispatch/issue groups. However, some
0169 // processors can form groups of with only certain combinations of
0170 // instruction types. e.g. POWER7.
0171 //
0172 // Use BufferSize = 1 for in-order execution units. This is used for
0173 // an in-order pipeline within an out-of-order core where scheduling
0174 // dependent operations back-to-back is guaranteed to cause a
0175 // bubble. e.g. Cortex-a9 floating-point.
0176 //
0177 // Use BufferSize > 1 for out-of-order executions units with a
0178 // separate reservation station. This simply models the size of the
0179 // reservation station.
0180 //
0181 // To model both dispatch/issue groups and in-order execution units,
0182 // create two types of units, one with BufferSize=0 and one with
0183 // BufferSize=1.
0184 //
0185 // SchedModel ties these units to a processor for any stand-alone defs
0186 // of this class.
0187 class ProcResourceUnits<ProcResourceKind kind, int num> {
0188 ProcResourceKind Kind = kind;
0189 int NumUnits = num;
0190 ProcResourceKind Super = ?;
0191 int BufferSize = -1;
0192 SchedMachineModel SchedModel = ?;
0193 }
0194
0195 // Subtargets typically define processor resource kind and number of
0196 // units in one place.
0197 class ProcResource<int num> : ProcResourceKind,
0198 ProcResourceUnits<!cast<ProcResourceKind>(NAME), num>;
0199
0200 class ProcResGroup<list<ProcResource> resources> : ProcResourceKind {
0201 list<ProcResource> Resources = resources;
0202 SchedMachineModel SchedModel = ?;
0203 int BufferSize = -1;
0204 }
0205
0206 // A target architecture may define SchedReadWrite types and associate
0207 // them with instruction operands.
0208 class SchedReadWrite;
0209
0210 // List the per-operand types that map to the machine model of an
0211 // instruction. One SchedWrite type must be listed for each explicit
0212 // def operand in order. Additional SchedWrite types may optionally be
0213 // listed for implicit def operands. SchedRead types may optionally
0214 // be listed for use operands in order. The order of defs relative to
0215 // uses is insignificant. This way, the same SchedReadWrite list may
0216 // be used for multiple forms of an operation. For example, a
0217 // two-address instruction could have two tied operands or single
0218 // operand that both reads and writes a reg. In both cases we have a
0219 // single SchedWrite and single SchedRead in any order.
0220 class Sched<list<SchedReadWrite> schedrw> {
0221 list<SchedReadWrite> SchedRW = schedrw;
0222 }
0223
0224 // Define a scheduler resource associated with a def operand.
0225 class SchedWrite : SchedReadWrite;
0226 def NoWrite : SchedWrite;
0227
0228 // Define a scheduler resource associated with a use operand.
0229 class SchedRead : SchedReadWrite;
0230
0231 // Define a SchedWrite that is modeled as a sequence of other
0232 // SchedWrites with additive latency. This allows a single operand to
0233 // be mapped the resources composed from a set of previously defined
0234 // SchedWrites.
0235 //
0236 // If the final write in this sequence is a SchedWriteVariant marked
0237 // Variadic, then the list of prior writes are distributed across all
0238 // operands after resolving the predicate for the final write.
0239 //
0240 // SchedModel silences warnings but is ignored.
0241 class WriteSequence<list<SchedWrite> writes, int rep = 1> : SchedWrite {
0242 list<SchedWrite> Writes = writes;
0243 int Repeat = rep;
0244 SchedMachineModel SchedModel = ?;
0245 }
0246
0247 // Define values common to WriteRes and SchedWriteRes.
0248 //
0249 // SchedModel ties these resources to a processor.
0250 class ProcWriteResources<list<ProcResourceKind> resources> {
0251 list<ProcResourceKind> ProcResources = resources;
0252 /// Cycle at which the resource will be released by an instruction,
0253 /// relatively to the cycle in which the instruction is issued
0254 /// (assuming no stalls inbetween).
0255 list<int> ReleaseAtCycles = [];
0256 /// Cycle at which the resource will be aquired by an instruction,
0257 /// relatively to the cycle in which the instruction is issued
0258 /// (assuming no stalls inbetween).
0259 list<int> AcquireAtCycles = [];
0260 int Latency = 1;
0261 int NumMicroOps = 1;
0262 bit BeginGroup = false;
0263 bit EndGroup = false;
0264 // Allow a processor to mark some scheduling classes as unsupported
0265 // for stronger verification.
0266 bit Unsupported = false;
0267 // Allow a processor to mark some scheduling classes as single-issue.
0268 // SingleIssue is an alias for Begin/End Group.
0269 bit SingleIssue = false;
0270 // An instruction is allowed to retire out-of-order if RetireOOO is
0271 // true for at least one of its writes. This field is only used by
0272 // MCA for in-order subtargets, and is ignored for other targets.
0273 bit RetireOOO = false;
0274 SchedMachineModel SchedModel = ?;
0275 }
0276
0277 // Define the resources and latency of a SchedWrite. This will be used
0278 // directly by targets that have no itinerary classes. In this case,
0279 // SchedWrite is defined by the target, while WriteResources is
0280 // defined by the subtarget, and maps the SchedWrite to processor
0281 // resources.
0282 //
0283 // If a target already has itinerary classes, SchedWriteResources can
0284 // be used instead to define subtarget specific SchedWrites and map
0285 // them to processor resources in one place. Then ItinRW can map
0286 // itinerary classes to the subtarget's SchedWrites.
0287 //
0288 // ProcResources indicates the set of resources consumed by the write.
0289 // Optionally, ReleaseAtCycles indicates the number of cycles the
0290 // resource is consumed. Each ReleaseAtCycles item is paired with the
0291 // ProcResource item at the same position in its list. ReleaseAtCycles
0292 // can be `[]`: in that case, all resources are consumed for a single
0293 // cycle, regardless of latency, which models a fully pipelined processing
0294 // unit. A value of 0 for ReleaseAtCycles means that the resource must
0295 // be available but is not consumed, which is only relevant for
0296 // unbuffered resources.
0297 //
0298 // By default, each SchedWrite takes one micro-op, which is counted
0299 // against the processor's IssueWidth limit. If an instruction can
0300 // write multiple registers with a single micro-op, the subtarget
0301 // should define one of the writes to be zero micro-ops. If a
0302 // subtarget requires multiple micro-ops to write a single result, it
0303 // should either override the write's NumMicroOps to be greater than 1
0304 // or require additional writes. Extra writes can be required either
0305 // by defining a WriteSequence, or simply listing extra writes in the
0306 // instruction's list of writers beyond the number of "def"
0307 // operands. The scheduler assumes that all micro-ops must be
0308 // dispatched in the same cycle. These micro-ops may be required to
0309 // begin or end the current dispatch group.
0310 class WriteRes<SchedWrite write, list<ProcResourceKind> resources>
0311 : ProcWriteResources<resources> {
0312 SchedWrite WriteType = write;
0313 }
0314
0315 // Directly name a set of WriteResources defining a new SchedWrite
0316 // type at the same time. This class is unaware of its SchedModel so
0317 // must be referenced by InstRW or ItinRW.
0318 class SchedWriteRes<list<ProcResourceKind> resources> : SchedWrite,
0319 ProcWriteResources<resources>;
0320
0321 // Define values common to ReadAdvance and SchedReadAdvance.
0322 //
0323 // SchedModel ties these resources to a processor.
0324 class ProcReadAdvance<int cycles, list<SchedWrite> writes = []> {
0325 int Cycles = cycles;
0326 list<SchedWrite> ValidWrites = writes;
0327 // Allow a processor to mark some scheduling classes as unsupported
0328 // for stronger verification.
0329 bit Unsupported = false;
0330 SchedMachineModel SchedModel = ?;
0331 }
0332
0333 // A processor may define a ReadAdvance associated with a SchedRead
0334 // to reduce latency of a prior write by N cycles. A negative advance
0335 // effectively increases latency, which may be used for cross-domain
0336 // stalls.
0337 //
0338 // A ReadAdvance may be associated with a list of SchedWrites
0339 // to implement pipeline bypass. The Writes list may be empty to
0340 // indicate operands that are always read this number of Cycles later
0341 // than a normal register read, allowing the read's parent instruction
0342 // to issue earlier relative to the writer.
0343 class ReadAdvance<SchedRead read, int cycles, list<SchedWrite> writes = []>
0344 : ProcReadAdvance<cycles, writes> {
0345 SchedRead ReadType = read;
0346 }
0347
0348 // Directly associate a new SchedRead type with a delay and optional
0349 // pipeline bypass. For use with InstRW or ItinRW.
0350 class SchedReadAdvance<int cycles, list<SchedWrite> writes = []> : SchedRead,
0351 ProcReadAdvance<cycles, writes>;
0352
0353 // Define SchedRead defaults. Reads seldom need special treatment.
0354 def ReadDefault : SchedRead;
0355 def NoReadAdvance : SchedReadAdvance<0>;
0356
0357 // Define shared code that will be in the same scope as all
0358 // SchedPredicates. Available variables are:
0359 // (const MachineInstr *MI, const TargetSchedModel *SchedModel)
0360 class PredicateProlog<code c> {
0361 code Code = c;
0362 }
0363
0364 // Base class for scheduling predicates.
0365 class SchedPredicateBase;
0366
0367 // A scheduling predicate whose logic is defined by a MCInstPredicate.
0368 // This can directly be used by SchedWriteVariant definitions.
0369 class MCSchedPredicate<MCInstPredicate P> : SchedPredicateBase {
0370 MCInstPredicate Pred = P;
0371 SchedMachineModel SchedModel = ?;
0372 }
0373
0374 // Define a predicate to determine which SchedVariant applies to a
0375 // particular MachineInstr. The code snippet is used as an
0376 // if-statement's expression. Available variables are MI, SchedModel,
0377 // and anything defined in a PredicateProlog.
0378 //
0379 // SchedModel silences warnings but is ignored.
0380 class SchedPredicate<code pred> : SchedPredicateBase {
0381 SchedMachineModel SchedModel = ?;
0382 code Predicate = pred;
0383 }
0384
0385 // Define a predicate to be typically used as the default case in a
0386 // SchedVariant. It the SchedVariant does not use any other predicate based on
0387 // MCSchedPredicate, this is the default scheduling case used by llvm-mca.
0388 def NoSchedPred : MCSchedPredicate<TruePred>;
0389
0390 // Associate a predicate with a list of SchedReadWrites. By default,
0391 // the selected SchedReadWrites are still associated with a single
0392 // operand and assumed to execute sequentially with additive
0393 // latency. However, if the parent SchedWriteVariant or
0394 // SchedReadVariant is marked "Variadic", then each Selected
0395 // SchedReadWrite is mapped in place to the instruction's variadic
0396 // operands. In this case, latency is not additive. If the current Variant
0397 // is already part of a Sequence, then that entire chain leading up to
0398 // the Variant is distributed over the variadic operands.
0399 class SchedVar<SchedPredicateBase pred, list<SchedReadWrite> selected> {
0400 SchedPredicateBase Predicate = pred;
0401 list<SchedReadWrite> Selected = selected;
0402 // SchedModel silences warnings but is ignored.
0403 SchedMachineModel SchedModel = ?;
0404 }
0405
0406 // SchedModel silences warnings but is ignored.
0407 class SchedVariant<list<SchedVar> variants> {
0408 list<SchedVar> Variants = variants;
0409 bit Variadic = false;
0410 SchedMachineModel SchedModel = ?;
0411 }
0412
0413 // A SchedWriteVariant is a single SchedWrite type that maps to a list
0414 // of SchedWrite types under the conditions defined by its predicates.
0415 //
0416 // A Variadic write is expanded to cover multiple "def" operands. The
0417 // SchedVariant's Expansion list is then interpreted as one write
0418 // per-operand instead of the usual sequential writes feeding a single
0419 // operand.
0420 class SchedWriteVariant<list<SchedVar> variants> : SchedWrite,
0421 SchedVariant<variants> {
0422 }
0423
0424 // A SchedReadVariant is a single SchedRead type that maps to a list
0425 // of SchedRead types under the conditions defined by its predicates.
0426 //
0427 // A Variadic write is expanded to cover multiple "readsReg" operands as
0428 // explained above.
0429 class SchedReadVariant<list<SchedVar> variants> : SchedRead,
0430 SchedVariant<variants> {
0431 }
0432
0433 // Map a set of opcodes to a list of SchedReadWrite types. This allows
0434 // the subtarget to easily override specific operations.
0435 //
0436 // SchedModel ties this opcode mapping to a processor.
0437 class InstRW<list<SchedReadWrite> rw, dag instrlist> {
0438 list<SchedReadWrite> OperandReadWrites = rw;
0439 dag Instrs = instrlist;
0440 SchedMachineModel SchedModel = ?;
0441 // Allow a subtarget to mark some instructions as unsupported.
0442 bit Unsupported = false;
0443 }
0444
0445 // Map a set of itinerary classes to SchedReadWrite resources. This is
0446 // used to bootstrap a target (e.g. ARM) when itineraries already
0447 // exist and changing InstrInfo is undesirable.
0448 //
0449 // SchedModel ties this ItineraryClass mapping to a processor.
0450 class ItinRW<list<SchedReadWrite> rw, list<InstrItinClass> iic> {
0451 list<InstrItinClass> MatchedItinClasses = iic;
0452 list<SchedReadWrite> OperandReadWrites = rw;
0453 SchedMachineModel SchedModel = ?;
0454 }
0455
0456 // Alias a target-defined SchedReadWrite to a processor specific
0457 // SchedReadWrite. This allows a subtarget to easily map a
0458 // SchedReadWrite type onto a WriteSequence, SchedWriteVariant, or
0459 // SchedReadVariant.
0460 //
0461 // SchedModel will usually be provided by surrounding let statement
0462 // and ties this SchedAlias mapping to a processor.
0463 class SchedAlias<SchedReadWrite match, SchedReadWrite alias> {
0464 SchedReadWrite MatchRW = match;
0465 SchedReadWrite AliasRW = alias;
0466 SchedMachineModel SchedModel = ?;
0467 }
0468
0469 // Allow the definition of processor register files for register renaming
0470 // purposes.
0471 //
0472 // Each processor register file declares:
0473 // - The set of registers that can be renamed.
0474 // - The number of physical registers which can be used for register renaming
0475 // purpose.
0476 // - The cost of a register rename.
0477 // - The set of registers that allow move elimination.
0478 // - The maximum number of moves that can be eliminated every cycle.
0479 // - Whether move elimination is limited to register moves whose input
0480 // is known to be zero.
0481 //
0482 // The cost of a rename is the number of physical registers allocated by the
0483 // register alias table to map the new definition. By default, register can be
0484 // renamed at the cost of a single physical register. Note that register costs
0485 // are defined at register class granularity (see field `Costs`).
0486 //
0487 // The set of registers that are subject to register renaming is declared using
0488 // a list of register classes (see field `RegClasses`). An empty list of
0489 // register classes means: all the logical registers defined by the target can
0490 // be fully renamed.
0491 //
0492 // A register R can be renamed if its register class appears in the `RegClasses`
0493 // set. When R is written, a new alias is allocated at the cost of one or more
0494 // physical registers; as a result, false dependencies on R are removed.
0495 //
0496 // A sub-register V of register R is implicitly part of the same register file.
0497 // However, V is only renamed if its register class is part of `RegClasses`.
0498 // Otherwise, the processor keeps it (as well as any other different part
0499 // of R) together with R, and a write of V always causes a compulsory read of R.
0500 //
0501 // This is what happens for example on AMD processors (at least from Bulldozer
0502 // onwards), where AL and AH are not treated as independent from AX, and AX is
0503 // not treated as independent from EAX. A write to AL has an implicity false
0504 // dependency on the last write to EAX (or a portion of EAX). As a consequence,
0505 // a write to AL cannot go in parallel with a write to AH.
0506 //
0507 // There is no false dependency if the partial register write belongs to a
0508 // register class that is in `RegClasses`.
0509 // There is also no penalty for writes that "clear the content a super-register"
0510 // (see MC/MCInstrAnalysis.h - method MCInstrAnalysis::clearsSuperRegisters()).
0511 // On x86-64, 32-bit GPR writes implicitly zero the upper half of the underlying
0512 // physical register, effectively removing any false dependencies with the
0513 // previous register definition.
0514 //
0515 // TODO: This implementation assumes that there is no limit in the number of
0516 // renames per cycle, which might not be true for all hardware or register
0517 // classes. Also, there is no limit to how many times the same logical register
0518 // can be renamed during the same cycle.
0519 //
0520 // TODO: we don't currently model merge penalties for the case where a write to
0521 // a part of a register is followed by a read from a larger part of the same
0522 // register. On some Intel chips, different parts of a GPR can be stored in
0523 // different physical registers. However, there is a cost to pay for when the
0524 // partial write is combined with the previous super-register definition. We
0525 // should add support for these cases, and correctly model merge problems with
0526 // partial register accesses.
0527 //
0528 // Field MaxMovesEliminatedPerCycle specifies how many moves can be eliminated
0529 // every cycle. A default value of zero for that field means: there is no limit
0530 // to the number of moves that can be eliminated by this register file.
0531 //
0532 // An instruction MI is a candidate for move elimination if a call to
0533 // method TargetSubtargetInfo::isOptimizableRegisterMove(MI) returns true (see
0534 // llvm/CodeGen/TargetSubtargetInfo.h, and llvm/MC/MCInstrAnalysis.h).
0535 //
0536 // Subtargets can instantiate tablegen class IsOptimizableRegisterMove (see
0537 // llvm/Target/TargetInstrPredicate.td) to customize the set of move elimination
0538 // candidates. By default, no instruction is a valid move elimination candidate.
0539 //
0540 // A register move MI is eliminated only if:
0541 // - MI is a move elimination candidate.
0542 // - The destination register is from a register class that allows move
0543 // elimination (see field `AllowMoveElimination` below).
0544 // - Constraints on the move kind, and the maximum number of moves that can be
0545 // eliminated per cycle are all met.
0546
0547 class RegisterFile<int numPhysRegs, list<RegisterClass> Classes = [],
0548 list<int> Costs = [], list<bit> AllowMoveElim = [],
0549 int MaxMoveElimPerCy = 0, bit AllowZeroMoveElimOnly = false> {
0550 list<RegisterClass> RegClasses = Classes;
0551 list<int> RegCosts = Costs;
0552 list<bit> AllowMoveElimination = AllowMoveElim;
0553 int NumPhysRegs = numPhysRegs;
0554 int MaxMovesEliminatedPerCycle = MaxMoveElimPerCy;
0555 bit AllowZeroMoveEliminationOnly = AllowZeroMoveElimOnly;
0556 SchedMachineModel SchedModel = ?;
0557 }
0558
0559 // Describe the retire control unit.
0560 // A retire control unit specifies the size of the reorder buffer, as well as
0561 // the maximum number of opcodes that can be retired every cycle.
0562 // A value less-than-or-equal-to zero for field 'ReorderBufferSize' means: "the
0563 // size is unknown". The idea is that external tools can fall-back to using
0564 // field MicroOpBufferSize in SchedModel if the reorder buffer size is unknown.
0565 // A zero or negative value for field 'MaxRetirePerCycle' means "no
0566 // restrictions on the number of instructions retired per cycle".
0567 // Models can optionally specify up to one instance of RetireControlUnit per
0568 // scheduling model.
0569 class RetireControlUnit<int bufferSize, int retirePerCycle> {
0570 int ReorderBufferSize = bufferSize;
0571 int MaxRetirePerCycle = retirePerCycle;
0572 SchedMachineModel SchedModel = ?;
0573 }
0574
0575 // Base class for Load/StoreQueue. It is used to identify processor resources
0576 // which describe load/store queues in the LS unit.
0577 class MemoryQueue<ProcResourceKind PR> {
0578 ProcResourceKind QueueDescriptor = PR;
0579 SchedMachineModel SchedModel = ?;
0580 }
0581
0582 class LoadQueue<ProcResourceKind LDQueue> : MemoryQueue<LDQueue>;
0583 class StoreQueue<ProcResourceKind STQueue> : MemoryQueue<STQueue>;