aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/TableGen/RegisterInfoEmitter-errors.td
blob: cb1a1e9136e957b7fa32826b4cb5ba1b397c5505 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// RUN: not llvm-tblgen -gen-register-info -I %p/../../include %s -DERROR0 2>&1 | FileCheck %s --check-prefix=ERROR0
// RUN: not llvm-tblgen -gen-register-info -I %p/../../include %s -DERROR1 2>&1 | FileCheck %s --check-prefix=ERROR1
// RUN: not llvm-tblgen -gen-register-info -I %p/../../include %s -DERROR2 2>&1 | FileCheck %s --check-prefix=ERROR2
// RUN: not llvm-tblgen -gen-register-info -I %p/../../include %s -DERROR3 2>&1 | FileCheck %s --check-prefix=ERROR3
// RUN: not llvm-tblgen -gen-register-info -I %p/../../include %s -DERROR4 2>&1 | FileCheck %s --check-prefix=ERROR4
// RUN: not llvm-tblgen -gen-register-bank -I %p/../../include %s -DERROR5 2>&1 | FileCheck %s --check-prefix=ERROR5

include "llvm/Target/Target.td"

def MyTarget : Target;

foreach Index = 0-15 in {
  def R#Index : Register <"r"#Index>;
}

def GPR32 : RegisterClass<"MyTarget", [i32], 32, (sequence "R%u", 0, 15)>;

def sub0 : SubRegIndex<32, 0>;
def sub1 : SubRegIndex<32, 32>;

#ifdef ERROR0
// ERROR0: error: assertion failed: RegTypes list must not be empty
// ERROR0: [[@LINE+1]]:5: error: assertion failed in this record
def ClassA : RegisterClass<"MyTarget", [], 32, (add R0)>;
#endif

#ifdef ERROR1
// ERROR1: error: assertion failed: SubRegs and SubRegIndices must have the same size
// ERROR1: error: assertion failed: Tuples must have at least 2 sub-registers
// ERROR1: [[@LINE+1]]:5: error: assertion failed in this record
def Tuple0 : RegisterTuples<[sub0, sub1], [(shl GPR32, 0)]>;
#endif

#ifdef ERROR2
// ERROR2: error: assertion failed: SubRegs and SubRegIndices must have the same size
// ERROR2: [[@LINE+1]]:5: error: assertion failed in this record
def Tuple1 : RegisterTuples<[sub0], [(shl GPR32, 0), (shl GPR32, 1)]>;
#endif

#ifdef ERROR3
// ERROR3: error: assertion failed: SubRegs and SubRegIndices must have the same size
// ERROR3: [[@LINE+1]]:5: error: assertion failed in this record
def R0_R1 : RegisterWithSubRegs<"r0_r1", [R0, R1]>;
#endif

#ifdef ERROR4
// ERROR4: error: assertion failed: SubRegs and SubRegIndices must have the same size
// ERROR4: [[@LINE+1]]:5: error: assertion failed in this record
def R0_R1 : RegisterWithSubRegs<"r0_r1", [R0]> {
    let SubRegIndices = [sub0, sub1];
}
#endif

#ifdef ERROR5
// ERROR5: error: No register banks defined
#endif