brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 40d6806 Raw
47 lines · plain
1// RUN: llvm-tblgen -gen-disassembler -I %p/../../../include %s | FileCheck %s2 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-LABEL: static const uint8_t DecoderTable8[26] = {34// CHECK-NEXT:    OPC_CheckField, 2, 1, 0,     //  0: check Inst[2] == 0x035// CHECK-NEXT:    OPC_CheckField, 5, 3, 0,     //  4: check Inst[7:5] == 0x036// CHECK-NEXT:    OPC_Scope, 8,                //  8: try {37// CHECK-NEXT:    OPC_CheckField, 0, 2, 3,     // 10:  check Inst[1:0] == 0x338// CHECK-NEXT:    OPC_Decode, {{[0-9, ]+}}, 0, // 14:  decode to InstB using decoder 039// CHECK-NEXT:                                 // 14: } else try {40// CHECK-NEXT:    OPC_CheckField, 3, 2, 0,     // 18:  check Inst[4:3] == 0x041// CHECK-NEXT:    OPC_Decode, {{[0-9, ]+}}, 1, // 22:  decode to InstA using decoder 142// CHECK-NEXT:                                 // 22: }43// CHECK-NEXT: };44 45// CHECK: if (!Check(S, DecodeInstB(MI, insn, Address, Decoder))) { DecodeComplete = false; return MCDisassembler::Fail; }46// CHECK: if (!Check(S, DecodeInstA(MI, insn, Address, Decoder))) { DecodeComplete = false; return MCDisassembler::Fail; }47