Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 14 | pmbaty | 1 | //===- TargetItinerary.td - Target Itinerary Description --*- tablegen -*-====// |
| 2 | // |
||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
||
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
||
| 6 | // |
||
| 7 | //===----------------------------------------------------------------------===// |
||
| 8 | // |
||
| 9 | // This file defines the target-independent scheduling interfaces |
||
| 10 | // which should be implemented by each target that uses instruction |
||
| 11 | // itineraries for scheduling. Itineraries are detailed reservation |
||
| 12 | // tables for each instruction class. They are most appropriate for |
||
| 13 | // in-order machine with complicated scheduling or bundling constraints. |
||
| 14 | // |
||
| 15 | //===----------------------------------------------------------------------===// |
||
| 16 | |||
| 17 | //===----------------------------------------------------------------------===// |
||
| 18 | // Processor functional unit - These values represent the function units |
||
| 19 | // available across all chip sets for the target. Eg., IntUnit, FPUnit, ... |
||
| 20 | // These may be independent values for each chip set or may be shared across |
||
| 21 | // all chip sets of the target. Each functional unit is treated as a resource |
||
| 22 | // during scheduling and has an affect instruction order based on availability |
||
| 23 | // during a time interval. |
||
| 24 | // |
||
| 25 | class FuncUnit; |
||
| 26 | |||
| 27 | //===----------------------------------------------------------------------===// |
||
| 28 | // Pipeline bypass / forwarding - These values specifies the symbolic names of |
||
| 29 | // pipeline bypasses which can be used to forward results of instructions |
||
| 30 | // that are forwarded to uses. |
||
| 31 | class Bypass; |
||
| 32 | def NoBypass : Bypass; |
||
| 33 | |||
| 34 | class ReservationKind<bits<1> val> { |
||
| 35 | int Value = val; |
||
| 36 | } |
||
| 37 | |||
| 38 | def Required : ReservationKind<0>; |
||
| 39 | def Reserved : ReservationKind<1>; |
||
| 40 | |||
| 41 | //===----------------------------------------------------------------------===// |
||
| 42 | // Instruction stage - These values represent a non-pipelined step in |
||
| 43 | // the execution of an instruction. Cycles represents the number of |
||
| 44 | // discrete time slots needed to complete the stage. Units represent |
||
| 45 | // the choice of functional units that can be used to complete the |
||
| 46 | // stage. Eg. IntUnit1, IntUnit2. TimeInc indicates how many cycles |
||
| 47 | // should elapse from the start of this stage to the start of the next |
||
| 48 | // stage in the itinerary. For example: |
||
| 49 | // |
||
| 50 | // A stage is specified in one of two ways: |
||
| 51 | // |
||
| 52 | // InstrStage<1, [FU_x, FU_y]> - TimeInc defaults to Cycles |
||
| 53 | // InstrStage<1, [FU_x, FU_y], 0> - TimeInc explicit |
||
| 54 | // |
||
| 55 | |||
| 56 | class InstrStage<int cycles, list<FuncUnit> units, |
||
| 57 | int timeinc = -1, |
||
| 58 | ReservationKind kind = Required> { |
||
| 59 | int Cycles = cycles; // length of stage in machine cycles |
||
| 60 | list<FuncUnit> Units = units; // choice of functional units |
||
| 61 | int TimeInc = timeinc; // cycles till start of next stage |
||
| 62 | int Kind = kind.Value; // kind of FU reservation |
||
| 63 | } |
||
| 64 | |||
| 65 | //===----------------------------------------------------------------------===// |
||
| 66 | // Instruction itinerary - An itinerary represents a sequential series of steps |
||
| 67 | // required to complete an instruction. Itineraries are represented as lists of |
||
| 68 | // instruction stages. |
||
| 69 | // |
||
| 70 | |||
| 71 | //===----------------------------------------------------------------------===// |
||
| 72 | // Instruction itinerary classes - These values represent 'named' instruction |
||
| 73 | // itinerary. Using named itineraries simplifies managing groups of |
||
| 74 | // instructions across chip sets. An instruction uses the same itinerary class |
||
| 75 | // across all chip sets. Thus a new chip set can be added without modifying |
||
| 76 | // instruction information. |
||
| 77 | // |
||
| 78 | class InstrItinClass; |
||
| 79 | def NoItinerary : InstrItinClass; |
||
| 80 | |||
| 81 | //===----------------------------------------------------------------------===// |
||
| 82 | // Instruction itinerary data - These values provide a runtime map of an |
||
| 83 | // instruction itinerary class (name) to its itinerary data. |
||
| 84 | // |
||
| 85 | // NumMicroOps represents the number of micro-operations that each instruction |
||
| 86 | // in the class are decoded to. If the number is zero, then it means the |
||
| 87 | // instruction can decode into variable number of micro-ops and it must be |
||
| 88 | // determined dynamically. This directly relates to the itineraries |
||
| 89 | // global IssueWidth property, which constrains the number of microops |
||
| 90 | // that can issue per cycle. |
||
| 91 | // |
||
| 92 | // OperandCycles are optional "cycle counts". They specify the cycle after |
||
| 93 | // instruction issue the values which correspond to specific operand indices |
||
| 94 | // are defined or read. Bypasses are optional "pipeline forwarding paths", if |
||
| 95 | // a def by an instruction is available on a specific bypass and the use can |
||
| 96 | // read from the same bypass, then the operand use latency is reduced by one. |
||
| 97 | // |
||
| 98 | // InstrItinData<IIC_iLoad_i , [InstrStage<1, [A9_Pipe1]>, |
||
| 99 | // InstrStage<1, [A9_AGU]>], |
||
| 100 | // [3, 1], [A9_LdBypass]>, |
||
| 101 | // InstrItinData<IIC_iMVNr , [InstrStage<1, [A9_Pipe0, A9_Pipe1]>], |
||
| 102 | // [1, 1], [NoBypass, A9_LdBypass]>, |
||
| 103 | // |
||
| 104 | // In this example, the instruction of IIC_iLoadi reads its input on cycle 1 |
||
| 105 | // (after issue) and the result of the load is available on cycle 3. The result |
||
| 106 | // is available via forwarding path A9_LdBypass. If it's used by the first |
||
| 107 | // source operand of instructions of IIC_iMVNr class, then the operand latency |
||
| 108 | // is reduced by 1. |
||
| 109 | class InstrItinData<InstrItinClass Class, list<InstrStage> stages, |
||
| 110 | list<int> operandcycles = [], |
||
| 111 | list<Bypass> bypasses = [], int uops = 1> { |
||
| 112 | InstrItinClass TheClass = Class; |
||
| 113 | int NumMicroOps = uops; |
||
| 114 | list<InstrStage> Stages = stages; |
||
| 115 | list<int> OperandCycles = operandcycles; |
||
| 116 | list<Bypass> Bypasses = bypasses; |
||
| 117 | } |
||
| 118 | |||
| 119 | //===----------------------------------------------------------------------===// |
||
| 120 | // Processor itineraries - These values represent the set of all itinerary |
||
| 121 | // classes for a given chip set. |
||
| 122 | // |
||
| 123 | // Set property values to -1 to use the default. |
||
| 124 | // See InstrItineraryProps for comments and defaults. |
||
| 125 | class ProcessorItineraries<list<FuncUnit> fu, list<Bypass> bp, |
||
| 126 | list<InstrItinData> iid> { |
||
| 127 | list<FuncUnit> FU = fu; |
||
| 128 | list<Bypass> BP = bp; |
||
| 129 | list<InstrItinData> IID = iid; |
||
| 130 | // The packetizer automaton to use for this itinerary. By default all |
||
| 131 | // itineraries for a target are bundled up into the same automaton. This only |
||
| 132 | // works correctly when there are no conflicts in functional unit IDs between |
||
| 133 | // itineraries. For example, given two itineraries A<[SLOT_A]>, B<[SLOT_B]>, |
||
| 134 | // SLOT_A and SLOT_B will be assigned the same functional unit index, and |
||
| 135 | // the generated packetizer will confuse instructions referencing these slots. |
||
| 136 | // |
||
| 137 | // To avoid this, setting PacketizerNamespace to non-"" will cause this |
||
| 138 | // itinerary to be generated in a different automaton. The subtarget will need |
||
| 139 | // to declare a method "create##Namespace##DFAPacketizer()". |
||
| 140 | string PacketizerNamespace = ""; |
||
| 141 | } |
||
| 142 | |||
| 143 | // NoItineraries - A marker that can be used by processors without schedule |
||
| 144 | // info. Subtargets using NoItineraries can bypass the scheduler's |
||
| 145 | // expensive HazardRecognizer because no reservation table is needed. |
||
| 146 | def NoItineraries : ProcessorItineraries<[], [], []>; |
||
| 147 | |||
| 148 | //===----------------------------------------------------------------------===// |
||
| 149 | // Combo Function Unit data - This is a map of combo function unit names to |
||
| 150 | // the list of functional units that are included in the combination. |
||
| 151 | // |
||
| 152 | class ComboFuncData<FuncUnit ComboFunc, list<FuncUnit> funclist> { |
||
| 153 | FuncUnit TheComboFunc = ComboFunc; |
||
| 154 | list<FuncUnit> FuncList = funclist; |
||
| 155 | } |
||
| 156 | |||
| 157 | //===----------------------------------------------------------------------===// |
||
| 158 | // Combo Function Units - This is a list of all combo function unit data. |
||
| 159 | class ComboFuncUnits<list<ComboFuncData> cfd> { |
||
| 160 | list<ComboFuncData> CFD = cfd; |
||
| 161 | } |
||
| 162 |