1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/TableGen/GICombinerEmitter/match-invalid.td
Daniel Sanders c57301aa25 Revert "Temporarily Revert "[gicombiner] Add the MatchDag structure and parse instruction DAG's from the input""
This reverts commit e62e760f29567fe0841af870c65a4f8ef685d217.

The issue @uweigand raised should have been fixed by iterating over the
vector that owns the operand list data instead of the FoldingSet.

The MSVC issue raised by @thakis should have been fixed by relaxing the
regexes a little. I don't have a Windows machine available to test that so
I tested it by using `perl -p -e 's/0x([0-9a-f]+)/\U\1\E/g' to convert the
output of %p to the windows style.

I've guessed at the issue @phosek raised as there wasn't enough information
to investigate it. What I think is happening on that bot is the -debug
option isn't available because the second stage build is a release build.
I'm not sure why other release-mode bots didn't report it though.
2019-12-18 11:37:12 +00:00

82 lines
2.7 KiB
TableGen

// RUN: not llvm-tblgen -I %p/../../../include -gen-global-isel-combiner \
// RUN: -combiners=MyCombiner %s 2>&1 | \
// RUN: FileCheck -implicit-check-not=error %s
include "llvm/Target/Target.td"
include "llvm/Target/GlobalISel/Combine.td"
def MyTargetISA : InstrInfo;
def MyTarget : Target { let InstructionSet = MyTargetISA; }
def dummy;
def R0 : Register<"r0"> { let Namespace = "MyTarget"; }
def GPR32 : RegisterClass<"MyTarget", [i32], 32, (add R0)>;
class I<dag OOps, dag IOps, list<dag> Pat>
: Instruction {
let Namespace = "MyTarget";
let OutOperandList = OOps;
let InOperandList = IOps;
let Pattern = Pat;
}
def MOV : I<(outs GPR32:$dst), (ins GPR32:$src1), []>;
def missing_match_node : GICombineRule<
(defs root:$a),
(dummy),
(dummy)>;
// CHECK: :[[@LINE-4]]:{{[0-9]+}}: error: Expected match operator
// CHECK-NEXT: def missing_match_node : GICombineRule<
// CHECK: :[[@LINE-6]]:{{[0-9]+}}: error: Failed to parse rule
def null_matcher : GICombineRule<
(defs root:$a),
(match),
(dummy)>;
// CHECK: :[[@LINE-4]]:{{[0-9]+}}: error: Matcher is empty
// CHECK-NEXT: def null_matcher : GICombineRule<
// CHECK: :[[@LINE-6]]:{{[0-9]+}}: error: Failed to parse rule
def unknown_kind1 : GICombineRule<
(defs root:$a),
(match 0),
(dummy)>;
// CHECK: :[[@LINE-4]]:{{[0-9]+}}: error: Expected a subclass of GIMatchKind or a sub-dag whose operator is either of a GIMatchKindWithArgs or Instruction
// CHECK-NEXT: def unknown_kind1 : GICombineRule<
// CHECK: :[[@LINE-6]]:{{[0-9]+}}: error: Failed to parse rule
def unknown_kind2 : GICombineRule<
(defs root:$a),
(match (dummy)),
(dummy)>;
// CHECK: :[[@LINE-4]]:{{[0-9]+}}: error: Expected a subclass of GIMatchKind or a sub-dag whose operator is either of a GIMatchKindWithArgs or Instruction
// CHECK-NEXT: def unknown_kind2 : GICombineRule<
// CHECK: :[[@LINE-6]]:{{[0-9]+}}: error: Failed to parse rule
def multidef : GICombineRule<
(defs root:$a),
(match (MOV $a, $b),
(MOV $a, $b)),
(dummy)>;
// CHECK: :[[@LINE-5]]:{{[0-9]+}}: error: Two different MachineInstrs cannot def the same vreg
// CHECK-NEXT: def multidef : GICombineRule<
// CHECK: :[[@LINE-7]]:{{[0-9]+}}: error: Failed to parse rule
def multidef_but_not_an_error: GICombineRule<
(defs root:$a),
(match (MOV $a, $b),
(MOV $a, $b)),
(dummy)>;
// CHECK-NOT: :[[@LINE-5]]:{{[0-9]+}}: error:
def MyCombiner: GICombinerHelper<"GenMyCombiner", [
// CHECK: :[[@LINE-1]]:{{[0-9]+}}: error: Failed to parse one or more rules
missing_match_node,
null_matcher,
unknown_kind1,
unknown_kind2,
multidef
// Rules omitted from a matcher can be as broken as you like. They will not be read.
// multidef_but_not_an_error
]>;