• 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, 29, 0, // Skip to: 36
35// CHECK-NEXT: /* 7 */       MCD::OPC_ExtractField, 5, 3,  // Inst{7-5} ...
36// CHECK-NEXT: /* 10 */      MCD::OPC_FilterValue, 0, 22, 0, // Skip to: 36
37// CHECK-NEXT: /* 14 */      MCD::OPC_CheckField, 0, 2, 3, 5, 0, // Skip to: 25
38// CHECK-NEXT: /* 20 */      MCD::OPC_TryDecode, {{[0-9]+}}, 0, 0, 0, // Opcode: InstB, skip to: 25
39// CHECK-NEXT: /* 25 */      MCD::OPC_CheckField, 3, 2, 0, 5, 0, // Skip to: 36
40// CHECK-NEXT: /* 31 */      MCD::OPC_TryDecode, {{[0-9]+}}, 1, 0, 0, // Opcode: InstA, skip to: 36
41// CHECK-NEXT: /* 36 */      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