X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FHexagon%2FHexagonInstrFormats.td;h=e472d490e0a0492d7dca046a1ff3741ea1e3416d;hb=fef904d0e824a2c587f8c1063b6c4fbf47fec898;hp=7e9277655bcc2a7a01db8dc40320adcff1ee46cb;hpb=b4b54153ad760c69a00a08531abef4ed434a5092;p=oota-llvm.git diff --git a/lib/Target/Hexagon/HexagonInstrFormats.td b/lib/Target/Hexagon/HexagonInstrFormats.td index 7e9277655bc..e472d490e0a 100644 --- a/lib/Target/Hexagon/HexagonInstrFormats.td +++ b/lib/Target/Hexagon/HexagonInstrFormats.td @@ -7,43 +7,84 @@ // //===----------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// +// Hexagon Intruction Flags + +// +// *** Must match HexagonBaseInfo.h *** +//===----------------------------------------------------------------------===// + +class Type t> { + bits<5> Value = t; +} +def TypePSEUDO : Type<0>; +def TypeALU32 : Type<1>; +def TypeCR : Type<2>; +def TypeJR : Type<3>; +def TypeJ : Type<4>; +def TypeLD : Type<5>; +def TypeST : Type<6>; +def TypeSYSTEM : Type<7>; +def TypeXTYPE : Type<8>; +def TypeMARKER : Type<31>; + +//===----------------------------------------------------------------------===// +// Intruction Class Declaration + +//===----------------------------------------------------------------------===// + class InstHexagon pattern, - string cstr, - InstrItinClass itin> : Instruction { + string cstr, InstrItinClass itin, Type type> : Instruction { field bits<32> Inst; let Namespace = "Hexagon"; -/* Commented out for Hexagon - bits<2> op; - let Inst{31-30} = op; */ // Top two bits are the 'op' field - dag OutOperandList = outs; dag InOperandList = ins; - let AsmString = asmstr; + let AsmString = asmstr; let Pattern = pattern; let Constraints = cstr; - let Itinerary = itin; + let Itinerary = itin; + let Size = 4; + + // *** Must match HexagonBaseInfo.h *** + // Instruction type according to the ISA. + Type HexagonType = type; + let TSFlags{4-0} = HexagonType.Value; + // Solo instructions, i.e., those that cannot be in a packet with others. + bits<1> isHexagonSolo = 0; + let TSFlags{5} = isHexagonSolo; + // Predicated instructions. + bits<1> isPredicated = 0; + let TSFlags{6} = isPredicated; + + // *** The code above must match HexagonBaseInfo.h *** } -//----------------------------------------------------------------------------// +//===----------------------------------------------------------------------===// // Intruction Classes Definitions + -//----------------------------------------------------------------------------// +//===----------------------------------------------------------------------===// // LD Instruction Class in V2/V3/V4. // Definition of the instruction class NOT CHANGED. class LDInst pattern> - : InstHexagon { + : InstHexagon { + bits<5> rd; + bits<5> rs; + bits<13> imm13; +} + +class LDInst2 pattern> + : InstHexagon { bits<5> rd; bits<5> rs; bits<13> imm13; + let mayLoad = 1; } // LD Instruction Class in V2/V3/V4. // Definition of the instruction class NOT CHANGED. class LDInstPost pattern, string cstr> - : InstHexagon { + : InstHexagon { bits<5> rd; bits<5> rs; bits<5> rt; @@ -54,7 +95,24 @@ class LDInstPost pattern, // ST Instruction Class in V4 can take SLOT0 & SLOT1. // Definition of the instruction class CHANGED from V2/V3 to V4. class STInst pattern> - : InstHexagon { + : InstHexagon { + bits<5> rd; + bits<5> rs; + bits<13> imm13; +} + +class STInst2 pattern> + : InstHexagon { + bits<5> rd; + bits<5> rs; + bits<13> imm13; + let mayStore = 1; +} + +// 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> + : InstHexagon { bits<5> rd; bits<5> rs; bits<13> imm13; @@ -65,7 +123,7 @@ class STInst pattern> // Definition of the instruction class CHANGED from V2/V3 to V4. class STInstPost pattern, string cstr> - : InstHexagon { + : InstHexagon { bits<5> rd; bits<5> rs; bits<5> rt; @@ -75,7 +133,7 @@ class STInstPost pattern, // ALU32 Instruction Class in V2/V3/V4. // Definition of the instruction class NOT CHANGED. class ALU32Type pattern> - : InstHexagon { + : InstHexagon { bits<5> rd; bits<5> rs; bits<5> rt; @@ -88,7 +146,17 @@ class ALU32Type pattern> // Definition of the instruction class NOT CHANGED. // Name of the Instruction Class changed from ALU64 to XTYPE from V2/V3 to V4. class ALU64Type pattern> - : InstHexagon { + : InstHexagon { + bits<5> rd; + bits<5> rs; + bits<5> rt; + bits<16> imm16; + bits<16> imm16_2; +} + +class ALU64_acc pattern, + string cstr> + : InstHexagon { bits<5> rd; bits<5> rs; bits<5> rt; @@ -101,7 +169,7 @@ class ALU64Type 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> - : InstHexagon { + : InstHexagon { bits<5> rd; bits<5> rs; bits<5> rt; @@ -112,8 +180,8 @@ class MInst 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_acc pattern, - string cstr> - : InstHexagon { + string cstr> + : InstHexagon { bits<5> rd; bits<5> rs; bits<5> rt; @@ -124,9 +192,7 @@ class MInst_acc pattern, // 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> -//: InstHexagon { - : InstHexagon { -// : InstHexagon { + : InstHexagon { bits<5> rd; bits<5> rs; bits<5> rt; @@ -137,8 +203,8 @@ class SInst pattern> // 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> - : InstHexagon { + string cstr> + : InstHexagon { // : InstHexagon { // : InstHexagon { bits<5> rd; @@ -149,14 +215,14 @@ class SInst_acc pattern, // J Instruction Class in V2/V3/V4. // Definition of the instruction class NOT CHANGED. class JType pattern> - : InstHexagon { + : InstHexagon { bits<16> imm16; } // JR Instruction Class in V2/V3/V4. // Definition of the instruction class NOT CHANGED. class JRType pattern> - : InstHexagon { + : InstHexagon { bits<5> rs; bits<5> pu; // Predicate register } @@ -164,19 +230,26 @@ class JRType pattern> // CR Instruction Class in V2/V3/V4. // Definition of the instruction class NOT CHANGED. class CRInst pattern> - : InstHexagon { + : InstHexagon { bits<5> rs; bits<10> imm10; } +class Marker pattern> + : InstHexagon { + let isCodeGenOnly = 1; + let isPseudo = 1; +} class Pseudo pattern> - : InstHexagon; - + : InstHexagon { + let isCodeGenOnly = 1; + let isPseudo = 1; +} -//----------------------------------------------------------------------------// +//===----------------------------------------------------------------------===// // Intruction Classes Definitions - -//----------------------------------------------------------------------------// +//===----------------------------------------------------------------------===// // @@ -208,6 +281,11 @@ class ALU64_rr pattern> : ALU64Type { } +class ALU64_ri pattern> + : ALU64Type { + let rt{0-4} = 0; +} + // J Type Instructions. class JInst pattern> : JType { @@ -220,15 +298,31 @@ class JRInst pattern> // Post increment ST Instruction. -class STInstPI pattern, string cstr> +class STInstPI pattern, + string cstr> : STInstPost { let rt{0-4} = 0; } +class STInst2PI pattern, + string cstr> + : STInstPost { + let rt{0-4} = 0; + let mayStore = 1; +} + // Post increment LD Instruction. -class LDInstPI pattern, string cstr> +class LDInstPI pattern, + string cstr> + : LDInstPost { + let rt{0-4} = 0; +} + +class LDInst2PI pattern, + string cstr> : LDInstPost { let rt{0-4} = 0; + let mayLoad = 1; } //===----------------------------------------------------------------------===//