• 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,?,?,?,?};
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:      /* 0 */       MCD::OPC_ExtractField, 4, 4,  // Inst{7-4} ...
38// CHECK-NEXT: /* 3 */       MCD::OPC_FilterValue, 0, 14, 0, // Skip to: 21
39// CHECK-NEXT: /* 7 */       MCD::OPC_CheckField, 2, 2, 0, 5, 0, // Skip to: 18
40// CHECK-NEXT: /* 13 */      MCD::OPC_TryDecode, {{[0-9]+}}, 0, 0, 0, // Opcode: InstB, skip to: 18
41// CHECK-NEXT: /* 18 */      MCD::OPC_Decode, {{[0-9]+}}, 1, // Opcode: InstA
42// CHECK-NEXT: /* 21 */      MCD::OPC_Fail,
43
44// CHECK: if (DecodeInstBOp(MI, tmp, Address, Decoder) == MCDisassembler::Fail) { DecodeComplete = false; return MCDisassembler::Fail; }
45