|
| 1 | +// RUN: llvm-tblgen -gen-sd-node-info -I %p/../../../include %s 2> %t.warn | FileCheck %s |
| 2 | +// RUN: FileCheck --check-prefix=WARN --implicit-check-not=warning %s < %t.warn |
| 3 | + |
| 4 | +// RUN: llvm-tblgen -gen-sd-node-info -warn-on-skipped-nodes=false \ |
| 5 | +// RUN: -I %p/../../../include %s 2> %t.nowarn | FileCheck %s |
| 6 | +// RUN: not test -s %t.nowarn |
| 7 | + |
| 8 | +include "llvm/Target/Target.td" |
| 9 | + |
| 10 | +def MyTarget : Target; |
| 11 | + |
| 12 | +// WARN: [[#@LINE+1]]:5: warning: skipped node: invalid enum name |
| 13 | +def bad_name_1 : SDNode<"", SDTypeProfile<0, 0, []>>; |
| 14 | + |
| 15 | +// WARN: [[#@LINE+1]]:5: warning: skipped node: invalid enum name |
| 16 | +def bad_name_2 : SDNode<"NODE", SDTypeProfile<0, 0, []>>; |
| 17 | + |
| 18 | +// WARN: [[#@LINE+1]]:5: warning: skipped node: invalid enum name |
| 19 | +def bad_name_3 : SDNode<"MyTargetISD::", SDTypeProfile<0, 0, []>>; |
| 20 | + |
| 21 | +// WARN: [[#@LINE+1]]:5: warning: skipped node: invalid enum name |
| 22 | +def bad_name_4 : SDNode<"MyISD::", SDTypeProfile<0, 0, []>>; |
| 23 | + |
| 24 | +// WARN: [[#@LINE+1]]:5: warning: skipped node: invalid enum name |
| 25 | +def bad_name_5 : SDNode<"::NODE", SDTypeProfile<0, 0, []>>; |
| 26 | + |
| 27 | + |
| 28 | +// Standard namespace. |
| 29 | +def silent_1 : SDNode<"ISD::SILENT", SDTypeProfile<0, 0, []>>; |
| 30 | + |
| 31 | +// Different namespace. |
| 32 | +def silent_2 : SDNode<"MyISD::SILENT", SDTypeProfile<0, 0, []>>; |
| 33 | + |
| 34 | + |
| 35 | +// Different number of results. |
| 36 | +// WARN: [[#@LINE+2]]:5: warning: skipped node: incompatible description |
| 37 | +// WARN: [[#@LINE+2]]:5: warning: skipped node: incompatible description |
| 38 | +def node_1a : SDNode<"MyTargetISD::NODE_1", SDTypeProfile<0, 0, []>>; |
| 39 | +def node_1b : SDNode<"MyTargetISD::NODE_1", SDTypeProfile<1, 0, []>>; |
| 40 | + |
| 41 | +// Different number of operands. |
| 42 | +// WARN: [[#@LINE+2]]:5: warning: skipped node: incompatible description |
| 43 | +// WARN: [[#@LINE+2]]:5: warning: skipped node: incompatible description |
| 44 | +def node_2a : SDNode<"MyTargetISD::NODE_2", SDTypeProfile<0, 0, []>>; |
| 45 | +def node_2b : SDNode<"MyTargetISD::NODE_2", SDTypeProfile<0, 1, []>>; |
| 46 | + |
| 47 | +// Different value of IsStrictFP. |
| 48 | +// WARN: [[#@LINE+3]]:5: warning: skipped node: incompatible description |
| 49 | +// WARN: [[#@LINE+3]]:5: warning: skipped node: incompatible description |
| 50 | +let IsStrictFP = true in |
| 51 | +def node_3a : SDNode<"MyTargetISD::NODE_3", SDTypeProfile<0, 0, []>>; |
| 52 | +def node_3b : SDNode<"MyTargetISD::NODE_3", SDTypeProfile<0, 0, []>>; |
| 53 | + |
| 54 | +// Different value of TSFlags. |
| 55 | +// WARN: [[#@LINE+3]]:5: warning: skipped node: incompatible description |
| 56 | +// WARN: [[#@LINE+3]]:5: warning: skipped node: incompatible description |
| 57 | +let TSFlags = 1 in |
| 58 | +def node_4a : SDNode<"MyTargetISD::NODE_4", SDTypeProfile<0, 0, []>>; |
| 59 | +def node_4b : SDNode<"MyTargetISD::NODE_4", SDTypeProfile<0, 0, []>>; |
| 60 | + |
| 61 | +// Different properties. |
| 62 | +// WARN: [[#@LINE+2]]:5: warning: skipped node: incompatible description |
| 63 | +// WARN: [[#@LINE+2]]:5: warning: skipped node: incompatible description |
| 64 | +def node_5a : SDNode<"MyTargetISD::NODE_5", SDTypeProfile<0, 0, []>>; |
| 65 | +def node_5b : SDNode<"MyTargetISD::NODE_5", SDTypeProfile<0, 0, []>, [SDNPHasChain]>; |
| 66 | + |
| 67 | + |
| 68 | +// CHECK: enum GenNodeType : unsigned { |
| 69 | +// CHECK-NEXT: COMPAT = ISD::BUILTIN_OP_END, |
| 70 | +// CHECK-NEXT: }; |
| 71 | + |
| 72 | +// CHECK: static const char MyTargetSDNodeNames[] = |
| 73 | +// CHECK-NEXT: "MyTargetISD::COMPAT\0" |
| 74 | +// CHECK-NEXT: "\0"; |
| 75 | + |
| 76 | +// CHECK: static const SDTypeConstraint MyTargetSDTypeConstraints[] = { |
| 77 | +// CHECK-NEXT: /* dummy */ {SDTCisVT, 0, 0, MVT::INVALID_SIMPLE_VALUE_TYPE} |
| 78 | +// CHECK-NEXT: }; |
| 79 | +// CHECK-EMPTY: |
| 80 | +// CHECK-NEXT: static const SDNodeDesc MyTargetSDNodeDescs[] = { |
| 81 | +// CHECK-NEXT: {1, -1, 0, 0, 0, 0, 0, 0}, // COMPAT |
| 82 | +// CHECK-NEXT: }; |
| 83 | +// CHECK-EMPTY: |
| 84 | +// CHECK-NEXT: static const SDNodeInfo MyTargetGenSDNodeInfo( |
| 85 | +// CHECK-NEXT: /*NumOpcodes=*/1, MyTargetSDNodeDescs, |
| 86 | +// CHECK-NEXT: MyTargetSDNodeNames, MyTargetSDTypeConstraints); |
| 87 | + |
| 88 | +def compat_a : SDNode<"MyTargetISD::COMPAT", SDTypeProfile<1, -1, []>>; |
| 89 | +def compat_b : SDNode<"MyTargetISD::COMPAT", SDTypeProfile<1, -1, [SDTCisVT<0, untyped>]>>; |
| 90 | +def compat_c : SDNode<"MyTargetISD::COMPAT", SDTypeProfile<1, -1, [SDTCisVT<0, untyped>]>, |
| 91 | + [SDNPCommutative, SDNPAssociative, SDNPMayStore, SDNPMayLoad, SDNPSideEffect]>; |
0 commit comments