1 // RUN: llvm-tblgen -gen-instr-info -I %p/../../include %s | FileCheck %s
3 // Check that getOperandType has the expected info in it
5 include "llvm/Target/Target.td"
7 def archInstrInfo : InstrInfo { }
10 let InstructionSet = archInstrInfo;
13 def Reg : Register<"reg">;
14 def RegClass : RegisterClass<"foo", [i32], 0, (add Reg)>;
16 def OpA : Operand<i32>;
17 def OpB : Operand<i32>;
19 def RegOp : RegisterOperand<RegClass>;
21 def InstA : Instruction {
23 let OutOperandList = (outs OpA:$a);
24 let InOperandList = (ins OpB:$b, i32imm:$c);
26 field bits<8> SoftFail = 0;
27 let Namespace = "MyNamespace";
30 def InstB : Instruction {
32 let OutOperandList = (outs i32imm:$d);
33 let InOperandList = (ins unknown:$x);
35 field bits<8> SoftFail = 0;
36 let Namespace = "MyNamespace";
39 def InstC : Instruction {
41 let OutOperandList = (outs RegClass:$d);
42 let InOperandList = (ins RegOp:$x);
44 field bits<8> SoftFail = 0;
45 let Namespace = "MyNamespace";
48 // CHECK: #ifdef GET_INSTRINFO_OPERAND_TYPE
49 // CHECK: static const uint{{.*}}_t Offsets[] = {
50 // CHECK: static const {{.*}} OpcodeOperandTypes[] = {
52 // CHECK-NEXT: OpA, OpB, i32imm,
53 // CHECK-NEXT: /* InstB */
54 // CHECK-NEXT: i32imm, -1,
55 // CHECK-NEXT: /* InstC */
56 // CHECK-NEXT: RegClass, RegOp,
57 // CHECK: #endif // GET_INSTRINFO_OPERAND_TYPE