47 lines · plain
1// RUN: llvm-tblgen -gen-disassembler -I %p/../../../include %s | FileCheck %s2 3// Check that if decoding of an instruction fails and the instruction does not4// have a complete decoder method that can determine if the bitpattern is valid5// or not then the decoder tries to find a more general instruction that6// matches the bitpattern too.7 8include "llvm/Target/Target.td"9 10def archInstrInfo : InstrInfo { }11 12def arch : Target {13 let InstructionSet = archInstrInfo;14}15 16class TestInstruction : Instruction {17 let Size = 1;18 let OutOperandList = (outs);19 let InOperandList = (ins);20 field bits<8> Inst;21 field bits<8> SoftFail = 0;22}23 24def InstA : TestInstruction {25 let Inst = {0,0,0,0,?,?,?,?};26 let AsmString = "InstA";27}28 29def InstB : TestInstruction {30 let Inst = {0,0,0,0,0,0,?,?};31 let AsmString = "InstB";32 let DecoderMethod = "DecodeInstB";33 let hasCompleteDecoder = 0;34}35 36// CHECK-LABEL: static const uint8_t DecoderTable8[18] = {37// CHECK-NEXT: OPC_CheckField, 4, 4, 0, // 0: check Inst[7:4] == 0x038// CHECK-NEXT: OPC_Scope, 8, // 4: try {39// CHECK-NEXT: OPC_CheckField, 2, 2, 0, // 6: check Inst[3:2] == 0x040// CHECK-NEXT: OPC_Decode, {{[0-9, ]+}}, 0, // 10: decode to InstB using decoder 041// CHECK-NEXT: // 10: } else try {42// CHECK-NEXT: OPC_Decode, {{[0-9, ]+}}, 1, // 14: decode to InstA using decoder 143// CHECK-NEXT: // 14: }44// CHECK-NEXT: };45 46// CHECK: if (!Check(S, DecodeInstB(MI, insn, Address, Decoder))) { DecodeComplete = false; return MCDisassembler::Fail; }47