TargetItinerary.td 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. //===- TargetItinerary.td - Target Itinierary Description --*- tablegen -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file defines the target-independent scheduling interfaces
  11. // which should be implemented by each target that uses instruction
  12. // itineraries for scheduling. Itineraries are details reservation
  13. // tables for each instruction class. They are most appropriate for
  14. // in-order machine with complicated scheduling or bundling constraints.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. class FuncUnit;
  18. //===----------------------------------------------------------------------===//
  19. // Pipeline bypass / forwarding - These values specifies the symbolic names of
  20. // pipeline bypasses which can be used to forward results of instructions
  21. // that are forwarded to uses.
  22. class Bypass;
  23. def NoBypass : Bypass;
  24. class ReservationKind<bits<1> val> {
  25. int Value = val;
  26. }
  27. def Required : ReservationKind<0>;
  28. def Reserved : ReservationKind<1>;
  29. //===----------------------------------------------------------------------===//
  30. // Instruction stage - These values represent a non-pipelined step in
  31. // the execution of an instruction. Cycles represents the number of
  32. // discrete time slots needed to complete the stage. Units represent
  33. // the choice of functional units that can be used to complete the
  34. // stage. Eg. IntUnit1, IntUnit2. NextCycles indicates how many
  35. // cycles should elapse from the start of this stage to the start of
  36. // the next stage in the itinerary. For example:
  37. //
  38. // A stage is specified in one of two ways:
  39. //
  40. // InstrStage<1, [FU_x, FU_y]> - TimeInc defaults to Cycles
  41. // InstrStage<1, [FU_x, FU_y], 0> - TimeInc explicit
  42. //
  43. class InstrStage<int cycles, list<FuncUnit> units,
  44. int timeinc = -1,
  45. ReservationKind kind = Required> {
  46. int Cycles = cycles; // length of stage in machine cycles
  47. list<FuncUnit> Units = units; // choice of functional units
  48. int TimeInc = timeinc; // cycles till start of next stage
  49. int Kind = kind.Value; // kind of FU reservation
  50. }
  51. //===----------------------------------------------------------------------===//
  52. // Instruction itinerary - An itinerary represents a sequential series of steps
  53. // required to complete an instruction. Itineraries are represented as lists of
  54. // instruction stages.
  55. //
  56. //===----------------------------------------------------------------------===//
  57. // Instruction itinerary classes - These values represent 'named' instruction
  58. // itinerary. Using named itineraries simplifies managing groups of
  59. // instructions across chip sets. An instruction uses the same itinerary class
  60. // across all chip sets. Thus a new chip set can be added without modifying
  61. // instruction information.
  62. //
  63. class InstrItinClass;
  64. def NoItinerary : InstrItinClass;
  65. //===----------------------------------------------------------------------===//
  66. // Instruction itinerary data - These values provide a runtime map of an
  67. // instruction itinerary class (name) to its itinerary data.
  68. //
  69. // NumMicroOps represents the number of micro-operations that each instruction
  70. // in the class are decoded to. If the number is zero, then it means the
  71. // instruction can decode into variable number of micro-ops and it must be
  72. // determined dynamically. This directly relates to the itineraries
  73. // global IssueWidth property, which constrains the number of microops
  74. // that can issue per cycle.
  75. //
  76. // OperandCycles are optional "cycle counts". They specify the cycle after
  77. // instruction issue the values which correspond to specific operand indices
  78. // are defined or read. Bypasses are optional "pipeline forwarding pathes", if
  79. // a def by an instruction is available on a specific bypass and the use can
  80. // read from the same bypass, then the operand use latency is reduced by one.
  81. //
  82. // InstrItinData<IIC_iLoad_i , [InstrStage<1, [A9_Pipe1]>,
  83. // InstrStage<1, [A9_AGU]>],
  84. // [3, 1], [A9_LdBypass]>,
  85. // InstrItinData<IIC_iMVNr , [InstrStage<1, [A9_Pipe0, A9_Pipe1]>],
  86. // [1, 1], [NoBypass, A9_LdBypass]>,
  87. //
  88. // In this example, the instruction of IIC_iLoadi reads its input on cycle 1
  89. // (after issue) and the result of the load is available on cycle 3. The result
  90. // is available via forwarding path A9_LdBypass. If it's used by the first
  91. // source operand of instructions of IIC_iMVNr class, then the operand latency
  92. // is reduced by 1.
  93. class InstrItinData<InstrItinClass Class, list<InstrStage> stages,
  94. list<int> operandcycles = [],
  95. list<Bypass> bypasses = [], int uops = 1> {
  96. InstrItinClass TheClass = Class;
  97. int NumMicroOps = uops;
  98. list<InstrStage> Stages = stages;
  99. list<int> OperandCycles = operandcycles;
  100. list<Bypass> Bypasses = bypasses;
  101. }
  102. //===----------------------------------------------------------------------===//
  103. // Processor itineraries - These values represent the set of all itinerary
  104. // classes for a given chip set.
  105. //
  106. // Set property values to -1 to use the default.
  107. // See InstrItineraryProps for comments and defaults.
  108. class ProcessorItineraries<list<FuncUnit> fu, list<Bypass> bp,
  109. list<InstrItinData> iid> {
  110. list<FuncUnit> FU = fu;
  111. list<Bypass> BP = bp;
  112. list<InstrItinData> IID = iid;
  113. }
  114. // NoItineraries - A marker that can be used by processors without schedule
  115. // info. Subtargets using NoItineraries can bypass the scheduler's
  116. // expensive HazardRecognizer because no reservation table is needed.
  117. def NoItineraries : ProcessorItineraries<[], [], []>;