[Hexagon] Adding DuplexInst instruction format and duplex class defs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231828 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Colin LeMahieu 2015-03-10 19:53:14 +00:00
parent 1f9ea3a230
commit f41bfa16eb
3 changed files with 116 additions and 3 deletions

View File

@ -17,10 +17,88 @@
// *** Must match BaseInfo.h ***
//----------------------------------------------------------------------------//
def TypeMEMOP : IType<9>;
def TypeNV : IType<10>;
def TypeMEMOP : IType<9>;
def TypeNV : IType<10>;
def TypeDUPLEX : IType<11>;
def TypeCOMPOUND : IType<12>;
def TypePREFIX : IType<30>;
def TypeAG_VX : IType<28>;
def TypeAG_VM : IType<29>;
def TypePREFIX : IType<30>;
// Duplex Instruction Class Declaration
//===----------------------------------------------------------------------===//
class OpcodeDuplex {
field bits<32> Inst = ?; // Default to an invalid insn.
bits<4> IClass = 0; // ICLASS
bits<13> ISubHi = 0; // Low sub-insn
bits<13> ISubLo = 0; // High sub-insn
let Inst{31-29} = IClass{3-1};
let Inst{13} = IClass{0};
let Inst{15-14} = 0;
let Inst{28-16} = ISubHi;
let Inst{12-0} = ISubLo;
}
class InstDuplex<bits<4> iClass, list<dag> pattern = [],
string cstr = "">
: Instruction, OpcodeDuplex {
let Namespace = "Hexagon";
IType Type = TypeDUPLEX; // uses slot 0,1
let isCodeGenOnly = 1;
let hasSideEffects = 0;
dag OutOperandList = (outs);
dag InOperandList = (ins);
let IClass = iClass;
let Constraints = cstr;
let Itinerary = DUPLEX;
let Size = 4;
// SoftFail is a field the disassembler can use to provide a way for
// instructions to not match without killing the whole decode process. It is
// mainly used for ARM, but Tablegen expects this field to exist or it fails
// to build the decode table.
field bits<32> SoftFail = 0;
// *** Must match MCTargetDesc/HexagonBaseInfo.h ***
let TSFlags{4-0} = Type.Value;
// Predicated instructions.
bits<1> isPredicated = 0;
let TSFlags{6} = isPredicated;
bits<1> isPredicatedFalse = 0;
let TSFlags{7} = isPredicatedFalse;
bits<1> isPredicatedNew = 0;
let TSFlags{8} = isPredicatedNew;
// New-value insn helper fields.
bits<1> isNewValue = 0;
let TSFlags{9} = isNewValue; // New-value consumer insn.
bits<1> hasNewValue = 0;
let TSFlags{10} = hasNewValue; // New-value producer insn.
bits<3> opNewValue = 0;
let TSFlags{13-11} = opNewValue; // New-value produced operand.
bits<1> isNVStorable = 0;
let TSFlags{14} = isNVStorable; // Store that can become new-value store.
bits<1> isNVStore = 0;
let TSFlags{15} = isNVStore; // New-value store insn.
// Immediate extender helper fields.
bits<1> isExtendable = 0;
let TSFlags{16} = isExtendable; // Insn may be extended.
bits<1> isExtended = 0;
let TSFlags{17} = isExtended; // Insn must be extended.
bits<3> opExtendable = 0;
let TSFlags{20-18} = opExtendable; // Which operand may be extended.
bits<1> isExtentSigned = 0;
let TSFlags{21} = isExtentSigned; // Signed or unsigned range.
bits<5> opExtentBits = 0;
let TSFlags{26-22} = opExtentBits; //Number of bits of range before extending.
bits<2> opExtentAlign = 0;
let TSFlags{28-27} = opExtentAlign; // Alignment exponent before extending.
}
//----------------------------------------------------------------------------//
// Instruction Classes Definitions

View File

@ -5741,6 +5741,22 @@ def S2_tableidxh : tableidxRaw<"tableidxh", 0b01>;
def S2_tableidxw : tableidxRaw<"tableidxw", 0b10>;
def S2_tableidxd : tableidxRaw<"tableidxd", 0b11>;
//===----------------------------------------------------------------------===//
// Template class for 'table index' instructions which are assembler mapped
// to their :raw format.
//===----------------------------------------------------------------------===//
let isPseudo = 1 in
class tableidx_goodsyntax <string mnemonic>
: SInst <(outs IntRegs:$Rx),
(ins IntRegs:$_dst_, IntRegs:$Rs, u4Imm:$u4, u5Imm:$u5),
"$Rx = "#mnemonic#"($Rs, #$u4, #$u5)",
[], "$Rx = $_dst_" >;
def S2_tableidxb_goodsyntax : tableidx_goodsyntax<"tableidxb">;
def S2_tableidxh_goodsyntax : tableidx_goodsyntax<"tableidxh">;
def S2_tableidxw_goodsyntax : tableidx_goodsyntax<"tableidxw">;
def S2_tableidxd_goodsyntax : tableidx_goodsyntax<"tableidxd">;
//===----------------------------------------------------------------------===//
// V3 Instructions +
//===----------------------------------------------------------------------===//

View File

@ -11,6 +11,25 @@
//
//===----------------------------------------------------------------------===//
def DuplexIClass0: InstDuplex < 0 >;
def DuplexIClass1: InstDuplex < 1 >;
def DuplexIClass2: InstDuplex < 2 >;
let isExtendable = 1 in {
def DuplexIClass3: InstDuplex < 3 >;
def DuplexIClass4: InstDuplex < 4 >;
def DuplexIClass5: InstDuplex < 5 >;
def DuplexIClass6: InstDuplex < 6 >;
def DuplexIClass7: InstDuplex < 7 >;
}
def DuplexIClass8: InstDuplex < 8 >;
def DuplexIClass9: InstDuplex < 9 >;
def DuplexIClassA: InstDuplex < 0xA >;
def DuplexIClassB: InstDuplex < 0xB >;
def DuplexIClassC: InstDuplex < 0xC >;
def DuplexIClassD: InstDuplex < 0xD >;
def DuplexIClassE: InstDuplex < 0xE >;
def DuplexIClassF: InstDuplex < 0xF >;
def addrga: PatLeaf<(i32 AddrGA:$Addr)>;
def addrgp: PatLeaf<(i32 AddrGP:$Addr)>;