1// RUN: not llvm-tblgen -gen-disassembler -I %p/../../../include %s 2>&1 | FileCheck %s --implicit-check-not=error: 2 3include "llvm/Target/Target.td" 4 5def ArchInstrInfo : InstrInfo { } 6 7def Arch : Target { 8 let InstructionSet = ArchInstrInfo; 9} 10 11def Reg : Register<"reg">; 12 13def Regs : RegisterClass<"foo", [i32], 0, (add Reg)>; 14 15def complex_nodec : Operand<i32> { 16 let MIOperandInfo = (ops Regs, Regs); 17} 18 19def complex_withdec : Operand<i32> { 20 let MIOperandInfo = (ops Regs, Regs); 21 let DecoderMethod = "DecodeComplex"; 22} 23 24class ArchInstr : Instruction { 25 let Size = 1; 26 bits<8> Inst; 27} 28 29// This definition is broken in both directions: 30// 1. Uses a complex operand without a decoder, and without named sub-ops. 31// 2. Uses a complex operand with named sub-ops, but with a decoder as well. 32 33// CHECK: error: DecoderEmitter: operand "r1c" uses MIOperandInfo with multiple ops, but doesn't have a custom decoder! 34// CHECK: note: Dumping record for previous error: 35// CHECK: error: DecoderEmitter: operand "r1ab" has type "complex_withdec" with a custom DecoderMethod, but also named sub-operands. 36def foo1 : ArchInstr { 37 bits<2> r1a; 38 bits<2> r1b; 39 bits<2> r1c; 40 41 let Inst{1-0} = r1a; 42 let Inst{3-2} = r1b; 43 let Inst{5-4} = r1c; 44 let Inst{7-6} = 0b00; 45 46 let OutOperandList = (outs complex_nodec:$r1c); 47 let InOperandList = (ins (complex_withdec $r1a, $r1b):$r1ab); 48} 49 50// This definition has no errors. 51def foo2 : ArchInstr { 52 bits<2> r2a; 53 bits<2> r2b; 54 bits<2> r2c; 55 56 let Inst{1-0} = r2a; 57 let Inst{3-2} = r2b; 58 let Inst{5-4} = r2c; 59 let Inst{7-6} = 0b01; 60 61 let OutOperandList = (outs complex_withdec:$r2c); 62 let InOperandList = (ins (complex_nodec $r2a, $r2b):$r2ab); 63} 64