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
5 include "llvm/Target/Target.td"
6 include "llvm/Target/GlobalISel/Combine.td"
8 def MyTargetISA : InstrInfo;
9 def MyTarget : Target { let InstructionSet = MyTargetISA; }
13 def R0 : Register<"r0"> { let Namespace = "MyTarget"; }
14 def GPR32 : RegisterClass<"MyTarget", [i32], 32, (add R0)>;
15 class I<dag OOps, dag IOps, list<dag> Pat>
17 let Namespace = "MyTarget";
18 let OutOperandList = OOps;
19 let InOperandList = IOps;
22 def MOV : I<(outs GPR32:$dst), (ins GPR32:$src1), []>;
24 def missing_match_node : GICombineRule<
28 // CHECK: :[[@LINE-4]]:{{[0-9]+}}: error: Expected match operator
29 // CHECK-NEXT: def missing_match_node : GICombineRule<
30 // CHECK: :[[@LINE-6]]:{{[0-9]+}}: error: Failed to parse rule
32 def null_matcher : GICombineRule<
36 // CHECK: :[[@LINE-4]]:{{[0-9]+}}: error: Matcher is empty
37 // CHECK-NEXT: def null_matcher : GICombineRule<
38 // CHECK: :[[@LINE-6]]:{{[0-9]+}}: error: Failed to parse rule
40 def unknown_kind1 : GICombineRule<
44 // CHECK: :[[@LINE-4]]:{{[0-9]+}}: error: Expected a subclass of GIMatchKind or a sub-dag whose operator is either of a GIMatchKindWithArgs or Instruction
45 // CHECK-NEXT: def unknown_kind1 : GICombineRule<
46 // CHECK: :[[@LINE-6]]:{{[0-9]+}}: error: Failed to parse rule
48 def unknown_kind2 : GICombineRule<
52 // CHECK: :[[@LINE-4]]:{{[0-9]+}}: error: Expected a subclass of GIMatchKind or a sub-dag whose operator is either of a GIMatchKindWithArgs or Instruction
53 // CHECK-NEXT: def unknown_kind2 : GICombineRule<
54 // CHECK: :[[@LINE-6]]:{{[0-9]+}}: error: Failed to parse rule
56 def multidef : GICombineRule<
61 // CHECK: :[[@LINE-5]]:{{[0-9]+}}: error: Two different MachineInstrs cannot def the same vreg
62 // CHECK-NEXT: def multidef : GICombineRule<
63 // CHECK: :[[@LINE-7]]:{{[0-9]+}}: error: Failed to parse rule
65 def multidef_but_not_an_error: GICombineRule<
70 // CHECK-NOT: :[[@LINE-5]]:{{[0-9]+}}: error:
72 def MyCombiner: GICombinerHelper<"GenMyCombiner", [
73 // CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Failed to parse one or more rules
79 // Rules omitted from a matcher can be as broken as you like. They will not be read.
80 // multidef_but_not_an_error