aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/TableGen/SDNodeInfoEmitter/namespace.td
blob: 217fb7c9fd475cca7edbf61772c2b5e2a4366f1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// RUN: llvm-tblgen -gen-sd-node-info -I %p/../../../include %s -sdnode-namespace=EmptyISD \
// RUN:   | FileCheck %s -check-prefix=EMPTY

// RUN: llvm-tblgen -gen-sd-node-info -I %p/../../../include %s \
// RUN:   | FileCheck %s --check-prefixes=COMMON,TARGET -DNS=MyTargetISD
// RUN: llvm-tblgen -gen-sd-node-info -I %p/../../../include %s -sdnode-namespace=MyCustomISD \
// RUN:   | FileCheck %s -check-prefixes=COMMON,CUSTOM -DNS=MyCustomISD

include "llvm/Target/Target.td"

def MyTarget : Target;

def node_1 : SDNode<"MyTargetISD::NODE", SDTypeProfile<1, 0, [SDTCisVT<0, i1>]>>;
def node_2 : SDNode<"MyCustomISD::NODE", SDTypeProfile<0, 1, [SDTCisVT<0, i2>]>>;

// EMPTY:        namespace llvm::EmptyISD {
// EMPTY-EMPTY:
// EMPTY-NEXT:   static constexpr unsigned GENERATED_OPCODE_END = ISD::BUILTIN_OP_END;
// EMPTY-EMPTY:
// EMPTY-NEXT:   } // namespace llvm::EmptyISD

// EMPTY:        static constexpr char MyTargetSDNodeNamesStorage[] =
// EMPTY-NEXT:     "\0"
// EMPTY-NEXT:     ;

// EMPTY:        static const SDTypeConstraint MyTargetSDTypeConstraints[] = {
// EMPTY-NEXT:     /* dummy */ {SDTCisVT, 0, 0, MVT::INVALID_SIMPLE_VALUE_TYPE}
// EMPTY-NEXT:   };
// EMPTY-EMPTY:
// EMPTY-NEXT:   static const SDNodeDesc MyTargetSDNodeDescs[] = {
// EMPTY-NEXT:   };
// EMPTY-EMPTY:
// EMPTY-NEXT:   static const SDNodeInfo MyTargetGenSDNodeInfo(
// EMPTY-NEXT:       /*NumOpcodes=*/0, MyTargetSDNodeDescs,
// EMPTY-NEXT:       MyTargetSDNodeNames, MyTargetSDTypeConstraints);

// COMMON:       namespace llvm::[[NS]] {
// COMMON-EMPTY:
// COMMON-NEXT:  enum GenNodeType : unsigned {
// COMMON-NEXT:    NODE = ISD::BUILTIN_OP_END,
// COMMON-NEXT:  };
// COMMON-EMPTY:
// COMMON-NEXT:  static constexpr unsigned GENERATED_OPCODE_END = NODE + 1;
// COMMON-EMPTY:
// COMMON-NEXT:  } // namespace llvm::[[NS]]

// COMMON:       static constexpr char MyTargetSDNodeNamesStorage[] =
// COMMON-NEXT:    "\0"
// COMMON-NEXT:    "[[NS]]::NODE\0"
// COMMON-NEXT:    ;

// COMMON:       static const SDTypeConstraint MyTargetSDTypeConstraints[] = {
// TARGET-NEXT:    /* 0 */ {SDTCisVT, 0, 0, MVT::i1},
// CUSTOM-NEXT:    /* 0 */ {SDTCisVT, 0, 0, MVT::i2},
// COMMON-NEXT:  };
// COMMON-EMPTY:
// COMMON-NEXT:  static const SDNodeDesc MyTargetSDNodeDescs[] = {
// TARGET-NEXT:      {1, 0, 0, 0, 0, 1, 0, 1}, // NODE
// CUSTOM-NEXT:      {0, 1, 0, 0, 0, 1, 0, 1}, // NODE
// COMMON-NEXT:  };
// COMMON-EMPTY:
// COMMON-NEXT:  static const SDNodeInfo MyTargetGenSDNodeInfo(
// COMMON-NEXT:      /*NumOpcodes=*/1, MyTargetSDNodeDescs,
// COMMON-NEXT:      MyTargetSDNodeNames, MyTargetSDTypeConstraints);