llvm-project
126 строк · 5.0 Кб
1// RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR1 %s 2>&1 | FileCheck --check-prefix=ERROR1 %s
2// RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR2 %s 2>&1 | FileCheck --check-prefix=ERROR2 %s
3// RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR3 %s 2>&1 | FileCheck --check-prefix=ERROR3 %s
4// RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR4 %s 2>&1 | FileCheck --check-prefix=ERROR4 %s
5// RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR5 %s 2>&1 | FileCheck --check-prefix=ERROR5 %s
6// RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR6 %s 2>&1 | FileCheck --check-prefix=ERROR6 %s
7// RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR7 %s 2>&1 | FileCheck --check-prefix=ERROR7 %s
8// RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR8 %s 2>&1 | FileCheck --check-prefix=ERROR8 %s
9// RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR9 %s 2>&1 | FileCheck --check-prefix=ERROR9 %s
10// RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR10 %s 2>&1 | FileCheck --check-prefix=ERROR10 %s
11// RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR11 %s 2>&1 | FileCheck --check-prefix=ERROR11 %s
12// RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR12 %s 2>&1 | FileCheck --check-prefix=ERROR12 %s
13// RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR13 %s 2>&1 | FileCheck --check-prefix=ERROR13 %s
14
15include "mlir/IR/OpBase.td"
16
17def Test_Dialect : Dialect {
18let name = "test_dialect";
19}
20
21#ifdef ERROR1
22// ERROR1: error: expected 'ins'
23def OpInsMissing : Op<Test_Dialect, "ins_missing"> {
24let builders = [
25OpBuilder<(outs)>
26];
27}
28#endif
29
30#ifdef ERROR2
31// ERROR2: error: expected an argument with default value after other arguments with default values
32def OpDefaultValueNotTrailing : Op<Test_Dialect, "default_value"> {
33let builders = [
34OpBuilder<(ins CArg<"int", "42">, "int")>
35];
36}
37#endif
38
39#ifdef ERROR3
40// ERROR3: error: expected an argument with default value after other arguments with default values
41def OpDefaultValueNotTrailing : Op<Test_Dialect, "default_value"> {
42let builders = [
43OpBuilder<(ins CArg<"int", "42">, CArg<"int">)>
44];
45}
46#endif
47
48#ifdef ERROR4
49// ERROR4: error: op has a conflict with two operands having the same name 'tensor'
50def OpWithDuplicatedArgNames : Op<Test_Dialect, "default_value"> {
51let arguments = (ins AnyTensor:$tensor, AnyTensor:$tensor);
52}
53#endif
54
55#ifdef ERROR5
56// ERROR5: error: op has a conflict with two results having the same name 'tensor'
57def OpWithDuplicatedResultNames : Op<Test_Dialect, "default_value"> {
58let results = (outs AnyTensor:$tensor, AnyTensor:$tensor);
59}
60#endif
61
62#ifdef ERROR6
63// ERROR6: error: op has a conflict with operands and results both having an entry with the name 'tensor'
64def OpWithDuplicatedArgResultNames : Op<Test_Dialect, "default_value"> {
65let arguments = (ins AnyTensor:$tensor);
66let results = (outs AnyTensor:$tensor);
67}
68#endif
69
70#ifdef ERROR7
71// ERROR7: error: op has a conflict with operands and regions both having an entry with the name 'tensor'
72def OpWithDuplicatedArgResultNames : Op<Test_Dialect, "default_value"> {
73let arguments = (ins AnyTensor:$tensor);
74let regions = (region AnyRegion:$tensor);
75}
76#endif
77
78#ifdef ERROR8
79// ERROR8: error: op has a conflict with results and regions both having an entry with the name 'tensor'
80def OpWithDuplicatedArgResultNames : Op<Test_Dialect, "default_value"> {
81let results = (outs AnyTensor:$tensor);
82let regions = (region AnyRegion:$tensor);
83}
84#endif
85
86#ifdef ERROR9
87// ERROR9: error: op has a conflict with operands and successors both having an entry with the name 'target'
88def OpWithDuplicatedArgResultNames : Op<Test_Dialect, "default_value"> {
89let successors = (successor AnySuccessor:$target);
90let arguments = (ins AnyTensor:$target);
91}
92#endif
93
94#ifdef ERROR10
95// ERROR10: error: op has a conflict with results and successors both having an entry with the name 'target'
96def OpWithDuplicatedArgResultNames : Op<Test_Dialect, "default_value"> {
97let successors = (successor AnySuccessor:$target);
98let results = (outs AnyTensor:$target);
99}
100#endif
101
102#ifdef ERROR11
103// ERROR11: error: op has a conflict with regions and successors both having an entry with the name 'target'
104def OpWithDuplicatedArgResultNames : Op<Test_Dialect, "default_value"> {
105let successors = (successor AnySuccessor:$target);
106let regions = (region AnyRegion:$target);
107}
108#endif
109
110#ifdef ERROR12
111def OpTraitA : NativeOpTrait<"OpTraitA"> {}
112def OpTraitB : NativeOpTrait<"OpTraitB", [OpTraitA]> {}
113
114// ERROR12: error: OpTraitB requires OpTraitA to precede it in traits list
115def OpTraitWithoutDependentTrait : Op<Test_Dialect, "default_value", [OpTraitB]> {}
116#endif
117
118#ifdef ERROR13
119def OpTraitA : NativeOpTrait<"OpTraitA"> {}
120def OpInterfaceB : OpInterface<"OpInterfaceB"> {
121let dependentTraits = [OpTraitA];
122}
123
124// ERROR13: error: OpInterfaceB::Trait requires OpTraitA to precede it in traits list
125def OpInterfaceWithoutDependentTrait : Op<Test_Dialect, "default_value", [OpInterfaceB]> {}
126#endif
127