2005-10-18 16:23:40 +00:00
|
|
|
//===- TargetSchedule.td - Target Independent Scheduling ---*- tablegen -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-10-18 16:23:40 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines the target-independent scheduling interfaces which should
|
|
|
|
// be implemented by each target which is using TableGen based scheduling.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Processor functional unit - These values represent the function units
|
|
|
|
// available across all chip sets for the target. Eg., IntUnit, FPUnit, ...
|
|
|
|
// These may be independent values for each chip set or may be shared across
|
|
|
|
// all chip sets of the target. Each functional unit is treated as a resource
|
|
|
|
// during scheduling and has an affect instruction order based on availability
|
|
|
|
// during a time interval.
|
|
|
|
//
|
|
|
|
class FuncUnit;
|
|
|
|
|
2010-09-28 23:50:49 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Pipeline bypass / forwarding - These values specifies the symbolic names of
|
|
|
|
// pipeline bypasses which can be used to forward results of instructions
|
|
|
|
// that are forwarded to uses.
|
|
|
|
class Bypass;
|
|
|
|
def NoBypass : Bypass;
|
|
|
|
|
2010-04-07 18:19:32 +00:00
|
|
|
class ReservationKind<bits<1> val> {
|
2010-04-07 18:19:40 +00:00
|
|
|
int Value = val;
|
2010-04-07 18:19:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def Required : ReservationKind<0>;
|
|
|
|
def Reserved : ReservationKind<1>;
|
|
|
|
|
2005-10-18 16:23:40 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2009-08-12 18:31:53 +00:00
|
|
|
// Instruction stage - These values represent a non-pipelined step in
|
|
|
|
// the execution of an instruction. Cycles represents the number of
|
|
|
|
// discrete time slots needed to complete the stage. Units represent
|
|
|
|
// the choice of functional units that can be used to complete the
|
|
|
|
// stage. Eg. IntUnit1, IntUnit2. NextCycles indicates how many
|
|
|
|
// cycles should elapse from the start of this stage to the start of
|
|
|
|
// the next stage in the itinerary. For example:
|
2005-10-18 16:23:40 +00:00
|
|
|
//
|
2009-08-12 18:31:53 +00:00
|
|
|
// A stage is specified in one of two ways:
|
|
|
|
//
|
|
|
|
// InstrStage<1, [FU_x, FU_y]> - TimeInc defaults to Cycles
|
|
|
|
// InstrStage<1, [FU_x, FU_y], 0> - TimeInc explicit
|
|
|
|
//
|
2010-04-07 18:19:40 +00:00
|
|
|
|
2010-04-07 18:21:41 +00:00
|
|
|
class InstrStage<int cycles, list<FuncUnit> units,
|
|
|
|
int timeinc = -1,
|
|
|
|
ReservationKind kind = Required> {
|
2005-10-21 19:05:19 +00:00
|
|
|
int Cycles = cycles; // length of stage in machine cycles
|
2005-10-18 16:23:40 +00:00
|
|
|
list<FuncUnit> Units = units; // choice of functional units
|
2009-08-12 18:31:53 +00:00
|
|
|
int TimeInc = timeinc; // cycles till start of next stage
|
2010-04-07 18:19:32 +00:00
|
|
|
int Kind = kind.Value; // kind of FU reservation
|
2005-10-18 16:23:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instruction itinerary - An itinerary represents a sequential series of steps
|
|
|
|
// required to complete an instruction. Itineraries are represented as lists of
|
|
|
|
// instruction stages.
|
|
|
|
//
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instruction itinerary classes - These values represent 'named' instruction
|
|
|
|
// itinerary. Using named itineraries simplifies managing groups of
|
|
|
|
// instructions across chip sets. An instruction uses the same itinerary class
|
|
|
|
// across all chip sets. Thus a new chip set can be added without modifying
|
|
|
|
// instruction information.
|
|
|
|
//
|
2010-09-09 18:18:55 +00:00
|
|
|
// NumMicroOps represents the number of micro-operations that each instruction
|
|
|
|
// in the class are decoded to. If the number is zero, then it means the
|
|
|
|
// instruction can decode into variable number of micro-ops and it must be
|
|
|
|
// determined dynamically.
|
|
|
|
//
|
|
|
|
class InstrItinClass<int ops = 1> {
|
|
|
|
int NumMicroOps = ops;
|
|
|
|
}
|
2006-01-27 01:41:38 +00:00
|
|
|
def NoItinerary : InstrItinClass;
|
2005-10-18 16:23:40 +00:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Instruction itinerary data - These values provide a runtime map of an
|
2009-09-15 15:08:33 +00:00
|
|
|
// instruction itinerary class (name) to its itinerary data.
|
2005-10-18 16:23:40 +00:00
|
|
|
//
|
2010-09-30 22:01:50 +00:00
|
|
|
// OperandCycles are optional "cycle counts". They specify the cycle after
|
|
|
|
// instruction issue the values which correspond to specific operand indices
|
|
|
|
// are defined or read. Bypasses are optional "pipeline forwarding pathes", if
|
|
|
|
// a def by an instruction is available on a specific bypass and the use can
|
|
|
|
// read from the same bypass, then the operand use latency is reduced by one.
|
|
|
|
//
|
|
|
|
// InstrItinData<IIC_iLoad_i , [InstrStage<1, [A9_Pipe1]>,
|
|
|
|
// InstrStage<1, [A9_AGU]>],
|
|
|
|
// [3, 1], [A9_LdBypass]>,
|
|
|
|
// InstrItinData<IIC_iMVNr , [InstrStage<1, [A9_Pipe0, A9_Pipe1]>],
|
|
|
|
// [1, 1], [NoBypass, A9_LdBypass]>,
|
|
|
|
//
|
|
|
|
// In this example, the instruction of IIC_iLoadi reads its input on cycle 1
|
|
|
|
// (after issue) and the result of the load is available on cycle 3. The result
|
|
|
|
// is available via forwarding path A9_LdBypass. If it's used by the first
|
|
|
|
// source operand of instructions of IIC_iMVNr class, then the operand latency
|
|
|
|
// is reduced by 1.
|
2010-04-07 18:21:41 +00:00
|
|
|
class InstrItinData<InstrItinClass Class, list<InstrStage> stages,
|
2010-09-28 23:50:49 +00:00
|
|
|
list<int> operandcycles = [],
|
|
|
|
list<Bypass> bypasses = []> {
|
2005-10-18 16:23:40 +00:00
|
|
|
InstrItinClass TheClass = Class;
|
2010-04-07 18:21:41 +00:00
|
|
|
list<InstrStage> Stages = stages;
|
2009-08-17 16:02:57 +00:00
|
|
|
list<int> OperandCycles = operandcycles;
|
2010-09-28 23:50:49 +00:00
|
|
|
list<Bypass> Bypasses = bypasses;
|
2005-10-18 16:23:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Processor itineraries - These values represent the set of all itinerary
|
|
|
|
// classes for a given chip set.
|
|
|
|
//
|
2010-09-28 23:50:49 +00:00
|
|
|
class ProcessorItineraries<list<FuncUnit> fu, list<Bypass> bp,
|
|
|
|
list<InstrItinData> iid> {
|
2010-04-18 20:31:01 +00:00
|
|
|
list<FuncUnit> FU = fu;
|
2010-09-28 23:50:49 +00:00
|
|
|
list<Bypass> BP = bp;
|
2005-10-18 16:23:40 +00:00
|
|
|
list<InstrItinData> IID = iid;
|
|
|
|
}
|
2005-10-23 22:07:20 +00:00
|
|
|
|
|
|
|
// NoItineraries - A marker that can be used by processors without schedule
|
|
|
|
// info.
|
2010-09-28 23:50:49 +00:00
|
|
|
def NoItineraries : ProcessorItineraries<[], [], []>;
|
2005-10-23 22:07:20 +00:00
|
|
|
|