From 798f57f9c9f3ab609f2ddabdc6f716035b0be8ba Mon Sep 17 00:00:00 2001 From: Jyotsna Verma Date: Thu, 8 May 2014 18:47:08 +0000 Subject: [PATCH] [Hexagon] Add new InstrItinClass to support timing classes. This patch doesn't introduce any functionality change. Test cases will be added later when v5 support is added. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208349 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Hexagon/Hexagon.td | 2 - lib/Target/Hexagon/HexagonInstrFormats.td | 105 +++++++------ lib/Target/Hexagon/HexagonInstrFormatsV4.td | 31 ++-- lib/Target/Hexagon/HexagonSchedule.td | 51 ------ lib/Target/Hexagon/HexagonScheduleV4.td | 165 +++++++++++++++++--- 5 files changed, 216 insertions(+), 138 deletions(-) diff --git a/lib/Target/Hexagon/Hexagon.td b/lib/Target/Hexagon/Hexagon.td index c1b6d45ce89..5f4a6c64f70 100644 --- a/lib/Target/Hexagon/Hexagon.td +++ b/lib/Target/Hexagon/Hexagon.td @@ -200,8 +200,6 @@ class Proc Features> : ProcessorModel; -def : Proc<"hexagonv2", HexagonModel, [ArchV2]>; -def : Proc<"hexagonv3", HexagonModel, [ArchV2, ArchV3]>; def : Proc<"hexagonv4", HexagonModelV4, [ArchV2, ArchV3, ArchV4]>; def : Proc<"hexagonv5", HexagonModelV4, [ArchV2, ArchV3, ArchV4, ArchV5]>; diff --git a/lib/Target/Hexagon/HexagonInstrFormats.td b/lib/Target/Hexagon/HexagonInstrFormats.td index 491d1d9b0de..10573434932 100644 --- a/lib/Target/Hexagon/HexagonInstrFormats.td +++ b/lib/Target/Hexagon/HexagonInstrFormats.td @@ -197,8 +197,8 @@ class InstHexagon pattern, // LD Instruction Class in V2/V3/V4. // Definition of the instruction class NOT CHANGED. class LDInst pattern = [], - string cstr = ""> - : InstHexagon; + string cstr = "", InstrItinClass itin = LD_tc_ld_SLOT01> + : InstHexagon; let mayLoad = 1 in class LDInst2 pattern = [], @@ -217,16 +217,16 @@ class LDInstPost pattern = [], let mayLoad = 1 in class LD0Inst pattern = [], - string cstr = ""> - : LDInst; + string cstr = "", InstrItinClass itin=LD_tc_ld_SLOT0> + : InstHexagon; // ST Instruction Class in V2/V3 can take SLOT0 only. // ST Instruction Class in V4 can take SLOT0 & SLOT1. // Definition of the instruction class CHANGED from V2/V3 to V4. let mayStore = 1 in class STInst pattern = [], - string cstr = ""> - : InstHexagon; + string cstr = "", InstrItinClass itin = ST_tc_st_SLOT01> + : InstHexagon; class STInst2 pattern = [], string cstr = ""> @@ -234,39 +234,39 @@ class STInst2 pattern = [], let mayStore = 1 in class ST0Inst pattern = [], - string cstr = ""> - : InstHexagon; + string cstr = "", InstrItinClass itin = ST_tc_ld_SLOT0> + : InstHexagon; // ST Instruction Class in V2/V3 can take SLOT0 only. // ST Instruction Class in V4 can take SLOT0 & SLOT1. // Definition of the instruction class CHANGED from V2/V3 to V4. class STInstPost pattern = [], - string cstr = ""> - : STInst; + string cstr = "", InstrItinClass itin = ST_tc_st_SLOT01> + : STInst; // SYSTEM Instruction Class in V4 can take SLOT0 only // In V2/V3 we used ST for this but in v4 ST can take SLOT0 or SLOT1. class SYSInst pattern = [], - string cstr = ""> - : InstHexagon; + string cstr = "", InstrItinClass itin = ST_tc_3stall_SLOT0> + : InstHexagon; // ALU32 Instruction Class in V2/V3/V4. // Definition of the instruction class NOT CHANGED. class ALU32Inst pattern = [], - string cstr = ""> - : InstHexagon; + string cstr = "", InstrItinClass itin = ALU32_2op_tc_1_SLOT0123> + : InstHexagon; // ALU64 Instruction Class in V2/V3. // XTYPE Instruction Class in V4. // Definition of the instruction class NOT CHANGED. // Name of the Instruction Class changed from ALU64 to XTYPE from V2/V3 to V4. class ALU64Inst pattern = [], - string cstr = ""> - : InstHexagon; + string cstr = "", InstrItinClass itin = ALU64_tc_2_SLOT23> + : InstHexagon; class ALU64_acc pattern = [], - string cstr = ""> - : ALU64Inst; + string cstr = "", InstrItinClass itin = ALU64_tc_2_SLOT23> + : ALU64Inst; // M Instruction Class in V2/V3. @@ -274,55 +274,55 @@ class ALU64_acc pattern = [], // Definition of the instruction class NOT CHANGED. // Name of the Instruction Class changed from M to XTYPE from V2/V3 to V4. class MInst pattern = [], - string cstr = ""> - : InstHexagon; + string cstr = "", InstrItinClass itin = M_tc_3x_SLOT23> + : InstHexagon; // M Instruction Class in V2/V3. // XTYPE Instruction Class in V4. // Definition of the instruction class NOT CHANGED. // Name of the Instruction Class changed from M to XTYPE from V2/V3 to V4. class MInst_acc pattern = [], - string cstr = ""> - : MInst; + string cstr = "", InstrItinClass itin = M_tc_2_SLOT23> + : MInst; // S Instruction Class in V2/V3. // XTYPE Instruction Class in V4. // Definition of the instruction class NOT CHANGED. // Name of the Instruction Class changed from S to XTYPE from V2/V3 to V4. class SInst pattern = [], - string cstr = ""> - : InstHexagon; + string cstr = "", InstrItinClass itin = S_2op_tc_1_SLOT23> + : InstHexagon; // S Instruction Class in V2/V3. // XTYPE Instruction Class in V4. // Definition of the instruction class NOT CHANGED. // Name of the Instruction Class changed from S to XTYPE from V2/V3 to V4. class SInst_acc pattern = [], - string cstr = ""> - : SInst; + string cstr = "", InstrItinClass itin = S_3op_tc_1_SLOT23> + : SInst; // J Instruction Class in V2/V3/V4. // Definition of the instruction class NOT CHANGED. class JInst pattern = [], - string cstr = ""> - : InstHexagon; + string cstr = "", InstrItinClass itin = J_tc_2early_SLOT23> + : InstHexagon; // JR Instruction Class in V2/V3/V4. // Definition of the instruction class NOT CHANGED. class JRInst pattern = [], - string cstr = ""> - : InstHexagon; + string cstr = "", InstrItinClass itin = J_tc_2early_SLOT2> + : InstHexagon; // CR Instruction Class in V2/V3/V4. // Definition of the instruction class NOT CHANGED. class CRInst pattern = [], - string cstr = ""> - : InstHexagon; + string cstr = "", InstrItinClass itin = CR_tc_2early_SLOT3> + : InstHexagon; let isCodeGenOnly = 1, isPseudo = 1 in class Endloop pattern = [], - string cstr = ""> - : InstHexagon; + string cstr = "", InstrItinClass itin = J_tc_2early_SLOT0123> + : InstHexagon; let isCodeGenOnly = 1, isPseudo = 1 in class Pseudo pattern = [], @@ -342,32 +342,33 @@ class PseudoM pattern = [], // // ALU32 patterns //. -class ALU32_rr pattern, - string cstr = ""> - : ALU32Inst; +class ALU32_rr pattern = [], + string cstr = "", InstrItinClass itin = ALU32_2op_tc_1_SLOT0123> + : ALU32Inst; -class ALU32_ir pattern, - string cstr = ""> - : ALU32Inst; +class ALU32_ir pattern = [], + string cstr = "", InstrItinClass itin = ALU32_2op_tc_1_SLOT0123> + : ALU32Inst; -class ALU32_ri pattern, - string cstr = ""> - : ALU32Inst; +class ALU32_ri pattern = [], + string cstr = "", InstrItinClass itin = ALU32_2op_tc_1_SLOT0123> + : ALU32Inst; + +class ALU32_ii pattern = [], + string cstr = "", InstrItinClass itin = ALU32_2op_tc_1_SLOT0123> + : ALU32Inst; -class ALU32_ii pattern, - string cstr = ""> - : ALU32Inst; // // ALU64 patterns. // -class ALU64_rr pattern, - string cstr = ""> - : ALU64Inst; +class ALU64_rr pattern = [], + string cstr = "", InstrItinClass itin = ALU64_tc_1_SLOT23> + : ALU64Inst; -class ALU64_ri pattern, - string cstr = ""> - : ALU64Inst; +class ALU64_ri pattern = [], + string cstr = "", InstrItinClass itin = ALU64_tc_1_SLOT23> + : ALU64Inst; // Post increment ST Instruction. class STInstPI pattern = [], diff --git a/lib/Target/Hexagon/HexagonInstrFormatsV4.td b/lib/Target/Hexagon/HexagonInstrFormatsV4.td index 9fda0da9161..d92f97b0dd2 100644 --- a/lib/Target/Hexagon/HexagonInstrFormatsV4.td +++ b/lib/Target/Hexagon/HexagonInstrFormatsV4.td @@ -12,7 +12,7 @@ //===----------------------------------------------------------------------===// //----------------------------------------------------------------------------// -// Hexagon Intruction Flags + +// Hexagon Instruction Flags // // *** Must match BaseInfo.h *** //----------------------------------------------------------------------------// @@ -22,30 +22,30 @@ def TypeNV : IType<10>; def TypePREFIX : IType<30>; //----------------------------------------------------------------------------// -// Intruction Classes Definitions + +// Instruction Classes Definitions //----------------------------------------------------------------------------// // // NV type instructions. // class NVInst pattern = [], - string cstr = ""> - : InstHexagon; + string cstr = "", InstrItinClass itin = NCJ_tc_3or4stall_SLOT0> + : InstHexagon; class NVInst_V4 pattern = [], - string cstr = ""> - : NVInst; + string cstr = "", InstrItinClass itin = NCJ_tc_3or4stall_SLOT0> + : NVInst; // Definition of Post increment new value store. class NVInstPost_V4 pattern = [], - string cstr = ""> - : NVInst; + string cstr = "", InstrItinClass itin = ST_tc_st_SLOT0> + : NVInst; // Post increment ST Instruction. let mayStore = 1 in class NVInstPI_V4 pattern = [], - string cstr = ""> - : NVInst; + string cstr = "", InstrItinClass itin = ST_tc_st_SLOT0> + : NVInst; // New-value conditional branch. class NCJInst pattern = [], @@ -54,13 +54,14 @@ class NCJInst pattern = [], let mayLoad = 1, mayStore = 1 in class MEMInst pattern = [], - string cstr = ""> - : InstHexagon; + string cstr = "", InstrItinClass itin = V4LDST_tc_st_SLOT0> + : InstHexagon; class MEMInst_V4 pattern = [], - string cstr = ""> - : MEMInst; + string cstr = "", InstrItinClass itin = V4LDST_tc_st_SLOT0> + : MEMInst; let isCodeGenOnly = 1 in class EXTENDERInst pattern = []> - : InstHexagon; + : InstHexagon; diff --git a/lib/Target/Hexagon/HexagonSchedule.td b/lib/Target/Hexagon/HexagonSchedule.td index c2cfbb9710a..528cafc2bfe 100644 --- a/lib/Target/Hexagon/HexagonSchedule.td +++ b/lib/Target/Hexagon/HexagonSchedule.td @@ -7,57 +7,6 @@ // //===----------------------------------------------------------------------===// -// Functional Units -def LSUNIT : FuncUnit; // SLOT0 -def LUNIT : FuncUnit; // SLOT1 -def MUNIT : FuncUnit; // SLOT2 -def SUNIT : FuncUnit; // SLOT3 -def LOOPUNIT : FuncUnit; - -// Itinerary classes -def ALU32 : InstrItinClass; -def ALU64 : InstrItinClass; -def CR : InstrItinClass; -def J : InstrItinClass; -def JR : InstrItinClass; -def LD : InstrItinClass; -def LD0 : InstrItinClass; -def M : InstrItinClass; -def ST : InstrItinClass; -def ST0 : InstrItinClass; -def S : InstrItinClass; -def SYS : InstrItinClass; -def ENDLOOP : InstrItinClass; -def PSEUDO : InstrItinClass; -def PSEUDOM : InstrItinClass; - -def HexagonItineraries : - ProcessorItineraries<[LSUNIT, LUNIT, MUNIT, SUNIT, LOOPUNIT], [], [ - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData, - InstrStage<1, [MUNIT, SUNIT]>]> - ]>; - -def HexagonModel : SchedMachineModel { - // Max issue per cycle == bundle width. - let IssueWidth = 4; - let Itineraries = HexagonItineraries; - let LoadLatency = 1; -} - //===----------------------------------------------------------------------===// // V4 Machine Info + //===----------------------------------------------------------------------===// diff --git a/lib/Target/Hexagon/HexagonScheduleV4.td b/lib/Target/Hexagon/HexagonScheduleV4.td index ef72cf4068b..a7d2d4724d0 100644 --- a/lib/Target/Hexagon/HexagonScheduleV4.td +++ b/lib/Target/Hexagon/HexagonScheduleV4.td @@ -34,29 +34,158 @@ def SLOT3 : FuncUnit; def SLOT_ENDLOOP: FuncUnit; // Itinerary classes. -def NV_V4 : InstrItinClass; -def MEM_V4 : InstrItinClass; +def PSEUDO : InstrItinClass; +def PSEUDOM : InstrItinClass; // ALU64/M/S Instruction classes of V2 are collectively knownn as XTYPE in V4. +def DUPLEX : InstrItinClass; def PREFIX : InstrItinClass; +def COMPOUND : InstrItinClass; + +def ALU32_2op_tc_1_SLOT0123 : InstrItinClass; +def ALU32_2op_tc_2early_SLOT0123 : InstrItinClass; +def ALU32_3op_tc_2early_SLOT0123 : InstrItinClass; +def ALU32_3op_tc_1_SLOT0123 : InstrItinClass; +def ALU32_3op_tc_2_SLOT0123 : InstrItinClass; +def ALU32_ADDI_tc_1_SLOT0123 : InstrItinClass; +def ALU64_tc_1_SLOT23 : InstrItinClass; +def ALU64_tc_1or2_SLOT23 : InstrItinClass; +def ALU64_tc_2_SLOT23 : InstrItinClass; +def ALU64_tc_2early_SLOT23 : InstrItinClass; +def ALU64_tc_3x_SLOT23 : InstrItinClass; +def CR_tc_2_SLOT3 : InstrItinClass; +def CR_tc_2early_SLOT23 : InstrItinClass; +def CR_tc_2early_SLOT3 : InstrItinClass; +def CR_tc_3x_SLOT23 : InstrItinClass; +def CR_tc_3x_SLOT3 : InstrItinClass; +def J_tc_2early_SLOT23 : InstrItinClass; +def J_tc_2early_SLOT2 : InstrItinClass; +def LD_tc_ld_SLOT01 : InstrItinClass; +def LD_tc_ld_SLOT0 : InstrItinClass; +def LD_tc_3or4stall_SLOT0 : InstrItinClass; +def M_tc_1_SLOT23 : InstrItinClass; +def M_tc_1or2_SLOT23 : InstrItinClass; +def M_tc_2_SLOT23 : InstrItinClass; +def M_tc_3_SLOT23 : InstrItinClass; +def M_tc_3x_SLOT23 : InstrItinClass; +def M_tc_3or4x_SLOT23 : InstrItinClass; +def ST_tc_st_SLOT01 : InstrItinClass; +def ST_tc_st_SLOT0 : InstrItinClass; +def ST_tc_ld_SLOT0 : InstrItinClass; +def ST_tc_3stall_SLOT0 : InstrItinClass; +def S_2op_tc_1_SLOT23 : InstrItinClass; +def S_2op_tc_2_SLOT23 : InstrItinClass; +def S_2op_tc_2early_SLOT23 : InstrItinClass; +def S_2op_tc_3or4x_SLOT23 : InstrItinClass; +def S_3op_tc_1_SLOT23 : InstrItinClass; +def S_3op_tc_1or2_SLOT23 : InstrItinClass; +def S_3op_tc_2_SLOT23 : InstrItinClass; +def S_3op_tc_2early_SLOT23 : InstrItinClass; +def S_3op_tc_3_SLOT23 : InstrItinClass; +def S_3op_tc_3x_SLOT23 : InstrItinClass; +def NCJ_tc_3or4stall_SLOT0 : InstrItinClass; +def V2LDST_tc_ld_SLOT01 : InstrItinClass; +def V2LDST_tc_st_SLOT0 : InstrItinClass; +def V2LDST_tc_st_SLOT01 : InstrItinClass; +def V4LDST_tc_ld_SLOT01 : InstrItinClass; +def V4LDST_tc_st_SLOT0 : InstrItinClass; +def V4LDST_tc_st_SLOT01 : InstrItinClass; +def J_tc_2early_SLOT0123 : InstrItinClass; +def EXTENDER_tc_1_SLOT0123 : InstrItinClass; + def HexagonItinerariesV4 : ProcessorItineraries<[SLOT0, SLOT1, SLOT2, SLOT3, SLOT_ENDLOOP], [], [ - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, - InstrItinData]>, + // ALU32 + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + + // ALU64 + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + + // CR -> System + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + + // Jump (conditional/unconditional/return etc) + // CR + InstrItinData]>, + InstrItinData]>, + // J + InstrItinData]>, + // JR + InstrItinData]>, + + //Load + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + + // M + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + + // Store + // ST + InstrItinData]>, + // ST0 + InstrItinData]>, + InstrItinData]>, + + // S + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + + // SYS + InstrItinData]>, + + // New Value Compare Jump + InstrItinData]>, + + // Mem ops - MEM_V4 + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + InstrItinData]>, + + InstrItinData]>, + + // ENDLOOP + InstrItinData]>, + + // Extender/PREFIX + InstrItinData]>, + + InstrItinData]>, InstrItinData]>, InstrItinData, InstrStage<1, [SLOT2, SLOT3]>]> -- 2.34.1