• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: llvm-tblgen -gen-disassembler -I %p/../../include %s | FileCheck %s
2
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,0,0,?,?};
21  let AsmString = "InstA";
22  let DecoderMethod = "DecodeInstA";
23  let hasCompleteDecoder = 0;
24}
25
26def 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, 36, 0, 0, // Skip to: 44
35// CHECK-NEXT: /* 8 */       MCD::OPC_ExtractField, 5, 3,  // Inst{7-5} ...
36// CHECK-NEXT: /* 11 */      MCD::OPC_FilterValue, 0, 28, 0, 0, // Skip to: 44
37// CHECK-NEXT: /* 16 */      MCD::OPC_CheckField, 0, 2, 3, 7, 0, 0, // Skip to: 30
38// CHECK-NEXT: /* 23 */      MCD::OPC_TryDecode, {{[0-9]+}}, 1, 0, 0, 0, 0, // Opcode: InstB, skip to: 30
39// CHECK-NEXT: /* 30 */      MCD::OPC_CheckField, 3, 2, 0, 7, 0, 0, // Skip to: 44
40// CHECK-NEXT: /* 37 */      MCD::OPC_TryDecode, {{[0-9]+}}, 1, 1, 0, 0, 0, // Opcode: InstA, skip to: 44
41// CHECK-NEXT: /* 44 */      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