1 // RUN: llvm-tblgen -gen-sd-node-info -I %p/../../../include %s -sdnode-namespace=EmptyISD \
2 // RUN: | FileCheck %s -check-prefix=EMPTY
4 // RUN: llvm-tblgen -gen-sd-node-info -I %p/../../../include %s \
5 // RUN: | FileCheck %s --check-prefixes=COMMON,TARGET -DNS=MyTargetISD
6 // RUN: llvm-tblgen -gen-sd-node-info -I %p/../../../include %s -sdnode-namespace=MyCustomISD \
7 // RUN: | FileCheck %s -check-prefixes=COMMON,CUSTOM -DNS=MyCustomISD
9 include "llvm/Target/Target.td"
11 def MyTarget : Target;
13 def node_1 : SDNode<"MyTargetISD::NODE", SDTypeProfile<1, 0, [SDTCisVT<0, i1>]>>;
14 def node_2 : SDNode<"MyCustomISD::NODE", SDTypeProfile<0, 1, [SDTCisVT<0, i2>]>>;
16 // EMPTY: namespace llvm::EmptyISD {
18 // EMPTY-NEXT: static constexpr unsigned GENERATED_OPCODE_END = ISD::BUILTIN_OP_END;
20 // EMPTY-NEXT: } // namespace llvm::EmptyISD
22 // EMPTY: static const char MyTargetSDNodeNames[] =
25 // EMPTY: static const SDTypeConstraint MyTargetSDTypeConstraints[] = {
26 // EMPTY-NEXT: /* dummy */ {SDTCisVT, 0, 0, MVT::INVALID_SIMPLE_VALUE_TYPE}
29 // EMPTY-NEXT: static const SDNodeDesc MyTargetSDNodeDescs[] = {
32 // EMPTY-NEXT: static const SDNodeInfo MyTargetGenSDNodeInfo(
33 // EMPTY-NEXT: /*NumOpcodes=*/0, MyTargetSDNodeDescs,
34 // EMPTY-NEXT: MyTargetSDNodeNames, MyTargetSDTypeConstraints);
36 // COMMON: namespace llvm::[[NS]] {
38 // COMMON-NEXT: enum GenNodeType : unsigned {
39 // COMMON-NEXT: NODE = ISD::BUILTIN_OP_END,
42 // COMMON-NEXT: static constexpr unsigned GENERATED_OPCODE_END = NODE + 1;
44 // COMMON-NEXT: } // namespace llvm::[[NS]]
46 // COMMON: static const char MyTargetSDNodeNames[] =
47 // COMMON-NEXT: "[[NS]]::NODE\0"
50 // COMMON: static const SDTypeConstraint MyTargetSDTypeConstraints[] = {
51 // TARGET-NEXT: /* 0 */ {SDTCisVT, 0, 0, MVT::i1},
52 // CUSTOM-NEXT: /* 0 */ {SDTCisVT, 0, 0, MVT::i2},
55 // COMMON-NEXT: static const SDNodeDesc MyTargetSDNodeDescs[] = {
56 // TARGET-NEXT: {1, 0, 0, 0, 0, 0, 0, 1}, // NODE
57 // CUSTOM-NEXT: {0, 1, 0, 0, 0, 0, 0, 1}, // NODE
60 // COMMON-NEXT: static const SDNodeInfo MyTargetGenSDNodeInfo(
61 // COMMON-NEXT: /*NumOpcodes=*/1, MyTargetSDNodeDescs,
62 // COMMON-NEXT: MyTargetSDNodeNames, MyTargetSDTypeConstraints);