xref: /llvm-project/llvm/test/TableGen/get-operand-type-no-expand.td (revision a97a79da027211bce150892d1eebf334e526c0d8)
1// Test -instr-info-expand-mi-operand-info=0 mode which keeps complex operands
2// that contain a DAG of basic operands unexpanded (the default is to expand).
3
4include "llvm/Target/Target.td"
5
6def archInstrInfo : InstrInfo { }
7
8def arch : Target {
9  let InstructionSet = archInstrInfo;
10}
11
12def Reg : Register<"reg">;
13def RegClass : RegisterClass<"foo", [i32], 0, (add Reg)>;
14
15class ComplexOperand<int size> : Operand<iPTR> {
16  let MIOperandInfo = (ops i8imm, i32imm);
17  int Size = size;
18}
19
20def i8complex : ComplexOperand<8>;
21def i512complex: ComplexOperand<512>;
22
23def InstA : Instruction {
24  let Size = 1;
25  let OutOperandList = (outs i512complex:$a);
26  let InOperandList = (ins i8complex:$b, i32imm:$c);
27  field bits<8> Inst;
28  field bits<8> SoftFail = 0;
29  let Namespace = "MyNamespace";
30}
31
32// RUN: llvm-tblgen -gen-instr-info -I %p/../../include %s \
33// RUN:   -instr-info-expand-mi-operand-info=1 \
34// RUN:   | FileCheck %s --check-prefix=CHECK-EXPAND
35// CHECK-EXPAND: #ifdef GET_INSTRINFO_OPERAND_TYPE
36// CHECK-EXPAND: OpcodeOperandTypes[] = {
37// CHECK-EXPAND:        /* InstA */
38// CHECK-EXPAND-NEXT:   i8imm, i32imm, i8imm, i32imm, i32imm,
39// CHECK-EXPAND: #endif // GET_INSTRINFO_OPERAND_TYPE
40
41// RUN: llvm-tblgen -gen-instr-info -I %p/../../include %s \
42// RUN:   -instr-info-expand-mi-operand-info=0 \
43// RUN:   | FileCheck %s --check-prefix=CHECK-NOEXPAND
44// CHECK-NOEXPAND: #ifdef GET_INSTRINFO_OPERAND_TYPE
45// CHECK-NOEXPAND: OpcodeOperandTypes[] = {
46// CHECK-NOEXPAND:        /* InstA */
47// CHECK-NOEXPAND-NEXT:   i512complex, i8complex, i32imm,
48// CHECK-NOEXPAND: #endif // GET_INSTRINFO_OPERAND_TYPE
49