Warning, /include/llvm/Target/TargetItinerary.td is written in an unsupported language. File is not indexed.
0001 //===- TargetItinerary.td - Target Itinerary Description --*- 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
0010 // which should be implemented by each target that uses instruction
0011 // itineraries for scheduling. Itineraries are detailed reservation
0012 // tables for each instruction class. They are most appropriate for
0013 // in-order machine with complicated scheduling or bundling constraints.
0014 //
0015 //===----------------------------------------------------------------------===//
0016
0017 //===----------------------------------------------------------------------===//
0018 // Processor functional unit - These values represent the function units
0019 // available across all chip sets for the target. Eg., IntUnit, FPUnit, ...
0020 // These may be independent values for each chip set or may be shared across
0021 // all chip sets of the target. Each functional unit is treated as a resource
0022 // during scheduling and has an affect instruction order based on availability
0023 // during a time interval.
0024 //
0025 class FuncUnit;
0026
0027 //===----------------------------------------------------------------------===//
0028 // Pipeline bypass / forwarding - These values specifies the symbolic names of
0029 // pipeline bypasses which can be used to forward results of instructions
0030 // that are forwarded to uses.
0031 class Bypass;
0032 def NoBypass : Bypass;
0033
0034 class ReservationKind<bits<1> val> {
0035 int Value = val;
0036 }
0037
0038 def Required : ReservationKind<0>;
0039 def Reserved : ReservationKind<1>;
0040
0041 //===----------------------------------------------------------------------===//
0042 // Instruction stage - These values represent a non-pipelined step in
0043 // the execution of an instruction. Cycles represents the number of
0044 // discrete time slots needed to complete the stage. Units represent
0045 // the choice of functional units that can be used to complete the
0046 // stage. Eg. IntUnit1, IntUnit2. TimeInc indicates how many cycles
0047 // should elapse from the start of this stage to the start of the next
0048 // stage in the itinerary. For example:
0049 //
0050 // A stage is specified in one of two ways:
0051 //
0052 // InstrStage<1, [FU_x, FU_y]> - TimeInc defaults to Cycles
0053 // InstrStage<1, [FU_x, FU_y], 0> - TimeInc explicit
0054 //
0055
0056 class InstrStage<int cycles, list<FuncUnit> units,
0057 int timeinc = -1,
0058 ReservationKind kind = Required> {
0059 int Cycles = cycles; // length of stage in machine cycles
0060 list<FuncUnit> Units = units; // choice of functional units
0061 int TimeInc = timeinc; // cycles till start of next stage
0062 int Kind = kind.Value; // kind of FU reservation
0063 }
0064
0065 //===----------------------------------------------------------------------===//
0066 // Instruction itinerary - An itinerary represents a sequential series of steps
0067 // required to complete an instruction. Itineraries are represented as lists of
0068 // instruction stages.
0069 //
0070
0071 //===----------------------------------------------------------------------===//
0072 // Instruction itinerary classes - These values represent 'named' instruction
0073 // itinerary. Using named itineraries simplifies managing groups of
0074 // instructions across chip sets. An instruction uses the same itinerary class
0075 // across all chip sets. Thus a new chip set can be added without modifying
0076 // instruction information.
0077 //
0078 class InstrItinClass;
0079 def NoItinerary : InstrItinClass;
0080
0081 //===----------------------------------------------------------------------===//
0082 // Instruction itinerary data - These values provide a runtime map of an
0083 // instruction itinerary class (name) to its itinerary data.
0084 //
0085 // NumMicroOps represents the number of micro-operations that each instruction
0086 // in the class are decoded to. If the number is zero, then it means the
0087 // instruction can decode into variable number of micro-ops and it must be
0088 // determined dynamically. This directly relates to the itineraries
0089 // global IssueWidth property, which constrains the number of microops
0090 // that can issue per cycle.
0091 //
0092 // OperandCycles are optional "cycle counts". They specify the cycle after
0093 // instruction issue the values which correspond to specific operand indices
0094 // are defined or read. Bypasses are optional "pipeline forwarding paths", if
0095 // a def by an instruction is available on a specific bypass and the use can
0096 // read from the same bypass, then the operand use latency is reduced by one.
0097 //
0098 // InstrItinData<IIC_iLoad_i , [InstrStage<1, [A9_Pipe1]>,
0099 // InstrStage<1, [A9_AGU]>],
0100 // [3, 1], [A9_LdBypass]>,
0101 // InstrItinData<IIC_iMVNr , [InstrStage<1, [A9_Pipe0, A9_Pipe1]>],
0102 // [1, 1], [NoBypass, A9_LdBypass]>,
0103 //
0104 // In this example, the instruction of IIC_iLoadi reads its input on cycle 1
0105 // (after issue) and the result of the load is available on cycle 3. The result
0106 // is available via forwarding path A9_LdBypass. If it's used by the first
0107 // source operand of instructions of IIC_iMVNr class, then the operand latency
0108 // is reduced by 1.
0109 class InstrItinData<InstrItinClass Class, list<InstrStage> stages,
0110 list<int> operandcycles = [],
0111 list<Bypass> bypasses = [], int uops = 1> {
0112 InstrItinClass TheClass = Class;
0113 int NumMicroOps = uops;
0114 list<InstrStage> Stages = stages;
0115 list<int> OperandCycles = operandcycles;
0116 list<Bypass> Bypasses = bypasses;
0117 }
0118
0119 //===----------------------------------------------------------------------===//
0120 // Processor itineraries - These values represent the set of all itinerary
0121 // classes for a given chip set.
0122 //
0123 // Set property values to -1 to use the default.
0124 // See InstrItineraryProps for comments and defaults.
0125 class ProcessorItineraries<list<FuncUnit> fu, list<Bypass> bp,
0126 list<InstrItinData> iid> {
0127 list<FuncUnit> FU = fu;
0128 list<Bypass> BP = bp;
0129 list<InstrItinData> IID = iid;
0130 // The packetizer automaton to use for this itinerary. By default all
0131 // itineraries for a target are bundled up into the same automaton. This only
0132 // works correctly when there are no conflicts in functional unit IDs between
0133 // itineraries. For example, given two itineraries A<[SLOT_A]>, B<[SLOT_B]>,
0134 // SLOT_A and SLOT_B will be assigned the same functional unit index, and
0135 // the generated packetizer will confuse instructions referencing these slots.
0136 //
0137 // To avoid this, setting PacketizerNamespace to non-"" will cause this
0138 // itinerary to be generated in a different automaton. The subtarget will need
0139 // to declare a method "create##Namespace##DFAPacketizer()".
0140 string PacketizerNamespace = "";
0141 }
0142
0143 // NoItineraries - A marker that can be used by processors without schedule
0144 // info. Subtargets using NoItineraries can bypass the scheduler's
0145 // expensive HazardRecognizer because no reservation table is needed.
0146 def NoItineraries : ProcessorItineraries<[], [], []>;
0147
0148 //===----------------------------------------------------------------------===//
0149 // Combo Function Unit data - This is a map of combo function unit names to
0150 // the list of functional units that are included in the combination.
0151 //
0152 class ComboFuncData<FuncUnit ComboFunc, list<FuncUnit> funclist> {
0153 FuncUnit TheComboFunc = ComboFunc;
0154 list<FuncUnit> FuncList = funclist;
0155 }
0156
0157 //===----------------------------------------------------------------------===//
0158 // Combo Function Units - This is a list of all combo function unit data.
0159 class ComboFuncUnits<list<ComboFuncData> cfd> {
0160 list<ComboFuncData> CFD = cfd;
0161 }
0162