48 lines · plain
1// RUN: llvm-tblgen -gen-disassembler -I %p/../../../include %s | FileCheck %s2 3include "llvm/Target/Target.td"4 5def archInstrInfo : InstrInfo { }6 7def arch : Target {8 let InstructionSet = archInstrInfo;9}10 11class TestInstruction : Instruction {12 let Size = 1;13 let OutOperandList = (outs);14 let InOperandList = (ins);15 field bits<8> Inst;16 field bits<8> SoftFail = 0;17}18 19def InstA : TestInstruction {20 let Inst = {0,0,0,0,?,?,?,?};21 let AsmString = "InstA";22}23 24def InstBOp : Operand<i32> {25 let DecoderMethod = "DecodeInstBOp";26 let hasCompleteDecoder = 0;27}28 29def InstB : TestInstruction {30 bits<2> op;31 let Inst{7...2} = {0,0,0,0,0,0};32 let Inst{1...0} = op;33 let OutOperandList = (outs InstBOp:$op);34 let AsmString = "InstB";35}36 37// CHECK-LABEL: static const uint8_t DecoderTable8[18] = {38// CHECK-NEXT: OPC_CheckField, 4, 4, 0, // 0: check Inst[7:4] == 0x039// CHECK-NEXT: OPC_Scope, 8, // 4: try {40// CHECK-NEXT: OPC_CheckField, 2, 2, 0, // 6: check Inst[3:2] == 0x041// CHECK-NEXT: OPC_Decode, {{[0-9, ]+}}, 0, // 10: decode to InstB using decoder 042// CHECK-NEXT: // 10: } else try {43// CHECK-NEXT: OPC_Decode, {{[0-9, ]+}}, 1, // 14: decode to InstA using decoder 144// CHECK-NEXT: // 14: }45// CHECK-NEXT: };46 47// CHECK: if (!Check(S, DecodeInstBOp(MI, tmp, Address, Decoder))) { DecodeComplete = false; return MCDisassembler::Fail; }48