1 // RUN: split-file %s %t
4 // RUN: llvm-tblgen -gen-sd-node-info -I %p/../../../include %t/test1.td | FileCheck %t/test1.td
6 include "llvm/Target/Target.td"
10 def my_node_a : SDNode<"MyTargetISD::NODE", SDTypeProfile<1, 0, [SDTCisVT<0, i32>]>>;
11 def my_node_b : SDNode<"MyTargetISD::NODE", SDTypeProfile<1, 0, [SDTCisVT<0, f32>]>>;
13 // CHECK: enum GenNodeType : unsigned {
14 // CHECK-NEXT: NODE = ISD::BUILTIN_OP_END,
17 // CHECK: static const char MyTargetSDNodeNames[] =
18 // CHECK-NEXT: "MyTargetISD::NODE\0"
21 // CHECK: static const SDTypeConstraint MyTargetSDTypeConstraints[] = {
22 // CHECK-NEXT: /* dummy */ {SDTCisVT, 0, 0, MVT::INVALID_SIMPLE_VALUE_TYPE}
25 // CHECK-NEXT: static const SDNodeDesc MyTargetSDNodeDescs[] = {
26 // CHECK-NEXT: {1, 0, 0, 0, 0, 0, 0, 0}, // NODE
29 // CHECK-NEXT: static const SDNodeInfo MyTargetGenSDNodeInfo(
30 // CHECK-NEXT: /*NumOpcodes=*/1, MyTargetSDNodeDescs,
31 // CHECK-NEXT: MyTargetSDNodeNames, MyTargetSDTypeConstraints);
35 // RUN: llvm-tblgen -gen-sd-node-info -I %p/../../../include %t/test2.td | FileCheck %t/test2.td
37 include "llvm/Target/Target.td"
39 def MyTarget : Target;
41 def my_node_1a : SDNode<"MyTargetISD::NODE_1", SDTypeProfile<1, 0, [SDTCisVT<0, i32>]>>;
42 def my_node_1b : SDNode<"MyTargetISD::NODE_1", SDTypeProfile<1, 0, [SDTCisVT<0, i32>]>>;
43 def my_node_2a : SDNode<"MyTargetISD::NODE_2", SDTypeProfile<1, 0, [SDTCisVT<0, i32>]>>;
44 def my_node_2b : SDNode<"MyTargetISD::NODE_2", SDTypeProfile<1, 0, [SDTCisVT<0, untyped>]>>;
46 // CHECK: namespace llvm::MyTargetISD {
48 // CHECK-NEXT: enum GenNodeType : unsigned {
49 // CHECK-NEXT: NODE_1 = ISD::BUILTIN_OP_END,
50 // CHECK-NEXT: NODE_2,
53 // CHECK-NEXT: static constexpr unsigned GENERATED_OPCODE_END = NODE_2 + 1;
55 // CHECK-NEXT: } // namespace llvm::MyTargetISD
57 // CHECK: static const char MyTargetSDNodeNames[] =
58 // CHECK-NEXT: "MyTargetISD::NODE_1\0"
59 // CHECK-NEXT: "MyTargetISD::NODE_2\0"
62 // CHECK: static const SDTypeConstraint MyTargetSDTypeConstraints[] = {
63 // CHECK-NEXT: /* 0 */ {SDTCisVT, 0, 0, MVT::i32},
66 // CHECK-NEXT: static const SDNodeDesc MyTargetSDNodeDescs[] = {
67 // CHECK-NEXT: {1, 0, 0, 0, 0, 0, 0, 1}, // NODE_1
68 // CHECK-NEXT: {1, 0, 0, 0, 0, 20, 0, 0}, // NODE_2
71 // CHECK-NEXT: static const SDNodeInfo MyTargetGenSDNodeInfo(
72 // CHECK-NEXT: /*NumOpcodes=*/2, MyTargetSDNodeDescs,
73 // CHECK-NEXT: MyTargetSDNodeNames, MyTargetSDTypeConstraints);