Skip to content

Commit ad38450

Browse files
committed
[TableGen] Add test for DAGISelShouldIgnore
This test ensures no .inc code is generated in the MatcherTable for the corresponding marked .td record.
1 parent f4e7c49 commit ad38450

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// RUN: llvm-tblgen --gen-dag-isel -I %p/../../include %s -DIGNORE | FileCheck %s
2+
// RUN: llvm-tblgen --gen-dag-isel -I %p/../../include %s --match-prefix=CHECK_LOOK | FileCheck --check-prefix=CHECK_LOOK %s
3+
4+
include "llvm/Target/Target.td"
5+
def ISA : InstrInfo;
6+
def Tgt : Target { let InstructionSet = ISA; }
7+
def R0 : Register<"r0"> { let Namespace = "Tgt"; }
8+
def RC : RegisterClass<"Tgt", [i32], 32, (add R0)>;
9+
def Op : RegisterOperand<RC>;
10+
11+
class I<dag OOps, dag IOps, list<dag> Pat> : Instruction {
12+
let Namespace = "Tgt";
13+
let OutOperandList = OOps;
14+
let InOperandList = IOps;
15+
let Pattern = Pat;
16+
}
17+
18+
#ifdef IGNORE
19+
let DAGISelShouldIgnore = 1 in
20+
def ADD : I<(outs Op:$rd), (ins Op:$rs, Op:$rt), []>;
21+
// CHECK: static const unsigned char MatcherTable[] = {
22+
// CHECK-NEXT: 0
23+
// CHECK-NEXT: }; // Total Array size is 1 bytes
24+
#else
25+
def ADD : I<(outs Op:$rd), (ins Op:$rs, Op:$rt),
26+
[(set Op:$rd, (add Op:$rs, Op:$rt))]>;
27+
// CHECK_LOOK:static const unsigned char MatcherTable[] = {
28+
// CHECK_LOOK-NEXT:/* 0*/ OPC_CheckOpcode, TARGET_VAL(ISD::ADD),
29+
// CHECK_LOOK-NEXT:/* 3*/ OPC_RecordChild0, // #0 = $rs
30+
// CHECK_LOOK-NEXT:/* 4*/ OPC_RecordChild1, // #1 = $rt
31+
// CHECK_LOOK-NEXT:/* 5*/ OPC_MorphNodeTo1None, TARGET_VAL(Tgt::ADD),
32+
// CHECK_LOOK-NEXT: MVT::i32, 2/*#Ops*/, 0, 1,
33+
// CHECK_LOOK-NEXT:// Src: (add:{ *:[i32] } Op:{ *:[i32] }:$rs, Op:{ *:[i32] }:$rt) - Complexity = {{[0-9]+}}
34+
// CHECK_LOOK-NEXT:// Dst: (ADD:{ *:[i32] } Op:{ *:[i32] }:$rs, Op:{ *:[i32] }:$rt)
35+
// CHECK_LOOK-NEXT: 0
36+
// CHECK_LOOK-NEXT:}; // Total Array size is 13 bytes
37+
#endif

0 commit comments

Comments
 (0)