1// RUN: not llvm-tblgen -I %p/../../../include -gen-global-isel-combiner \
2// RUN:     -combiners=MyCombiner %s 2>&1 | \
3// RUN:     FileCheck -implicit-check-not=error %s
4
5include "llvm/Target/Target.td"
6include "llvm/Target/GlobalISel/Combine.td"
7
8def MyTargetISA : InstrInfo;
9def MyTarget : Target { let InstructionSet = MyTargetISA; }
10
11def dummy;
12
13def missing_defs_node : GICombineRule<
14  (dummy),
15  (dummy),
16  (dummy)>;
17// CHECK: :[[@LINE-4]]:{{[0-9]+}}: error: Expected defs operator
18// CHECK-NEXT: def missing_defs_node : GICombineRule<
19// CHECK: :[[@LINE-6]]:{{[0-9]+}}: error: Failed to parse rule
20
21def no_roots : GICombineRule<
22  (defs),
23  (dummy),
24  (dummy)>;
25// CHECK: :[[@LINE-4]]:{{[0-9]+}}: error: Combine rules must have at least one root
26// CHECK-NEXT: def no_roots : GICombineRule<
27// CHECK: :[[@LINE-6]]:{{[0-9]+}}: error: Failed to parse rule
28
29def unknown_kind : GICombineRule<
30  (defs dummy:$a),
31  (dummy),
32  (dummy)>;
33// CHECK: :[[@LINE-4]]:{{[0-9]+}}: error: Expected a subclass of GIDefKind or a sub-dag whose operator is of type GIDefKindWithArgs
34// CHECK-NEXT: def unknown_kind : GICombineRule<
35// CHECK: :[[@LINE-6]]:{{[0-9]+}}: error: Failed to parse rule
36
37def MyCombiner: GICombinerHelper<"GenMyCombiner", [
38// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Failed to parse one or more rules
39  missing_defs_node,
40  no_roots,
41  unknown_kind
42]>;
43