1 // RUN: llvm-tblgen -gen-disassembler -I %p/../../include %s | FileCheck %s 2 3 include "llvm/Target/Target.td" 4 5 def archInstrInfo : InstrInfo { } 6 7 def arch : Target { 8 let InstructionSet = archInstrInfo; 9 } 10 11 class 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 19 def InstA : TestInstruction { 20 let Inst = {0,0,0,0,0,0,?,?}; 21 let AsmString = "InstA"; 22 let DecoderMethod = "DecodeInstA"; 23 let hasCompleteDecoder = 0; 24 } 25 26 def InstB : TestInstruction { 27 let Inst = {0,0,0,?,?,0,1,1}; 28 let AsmString = "InstB"; 29 let DecoderMethod = "DecodeInstB"; 30 let hasCompleteDecoder = 0; 31 } 32 33 // CHECK: /* 0 */ MCD::OPC_ExtractField, 2, 1, // Inst{2} ... 34 // CHECK-NEXT: /* 3 */ MCD::OPC_FilterValue, 0, 34, 0, 0, // Skip to: 42 35 // CHECK-NEXT: /* 8 */ MCD::OPC_ExtractField, 5, 3, // Inst{7-5} ... 36 // CHECK-NEXT: /* 11 */ MCD::OPC_FilterValue, 0, 26, 0, 0, // Skip to: 42 37 // CHECK-NEXT: /* 16 */ MCD::OPC_CheckField, 0, 2, 3, 6, 0, 0, // Skip to: 29 38 // CHECK-NEXT: /* 23 */ MCD::OPC_TryDecode, {{[0-9]+}}, 0, 0, 0, 0, // Opcode: InstB, skip to: 29 39 // CHECK-NEXT: /* 29 */ MCD::OPC_CheckField, 3, 2, 0, 6, 0, 0, // Skip to: 42 40 // CHECK-NEXT: /* 36 */ MCD::OPC_TryDecode, {{[0-9]+}}, 1, 0, 0, 0, // Opcode: InstA, skip to: 42 41 // CHECK-NEXT: /* 42 */ MCD::OPC_Fail, 42 43 // CHECK: if (DecodeInstB(MI, insn, Address, Decoder) == MCDisassembler::Fail) { DecodeComplete = false; return MCDisassembler::Fail; } 44 // CHECK: if (DecodeInstA(MI, insn, Address, Decoder) == MCDisassembler::Fail) { DecodeComplete = false; return MCDisassembler::Fail; } 45