1 // RUN: llvm-tblgen %s -o - 2>&1 >/dev/null | FileCheck %s -DFILE=%s
3 // CHECK: [[FILE]]:[[@LINE+1]]:1: note: Debug message
8 string A = "some text";
12 // CHECK: [[FILE]]:[[@LINE+5]]:1: note: The Value of A is:
13 // CHECK-NEXT: a { // A
14 // CHECK-NEXT: string A = "some text";
15 // CHECK-NEXT: dag X = (op op);
17 dump "The Value of A is: \n" # !repr(a);
20 // CHECK: [[FILE]]:[[@LINE+4]]:1: note: b { // A
21 // CHECK-NEXT: string A = "some text";
22 // CHECK-NEXT: dag X = (op op);
26 defvar value_A = "some other text";
27 // CHECK: [[FILE]]:[[@LINE+1]]:1: note: some other text
32 // CHECK: [[FILE]]:[[@LINE+3]]:1: note: got a pair of values ["some other text" : 12], and an empty record:
35 dump "got a pair of values [" # !repr(value_A) # " : " # !repr(value_B) # "], " # "and an empty record:\n" # !repr(X);
37 multiclass MC<dag s> {
38 // CHECK: [[FILE]]:[[@LINE+1]]:3: note: s = (op a)
39 dump "s = " # !repr(s);
40 // CHECK: [[FILE]]:[[@LINE+4]]:3: note: args[0] = a { // A
41 // CHECK-NEXT: string A = "some text";
42 // CHECK-NEXT: dag X = (op op);
44 dump "args[0] = " # !repr(!getdagarg<A>(s,0));
49 multiclass MMC<dag s> {
50 // CHECK: [[FILE]]:[[@LINE+1]]:3: note: the operand of s is op
51 dump "the operand of s is " # !getdagop(s);
52 // CHECK: [[FILE]]:[[@LINE-13]]:3: note: s = (op a, a)
53 // CHECK: [[FILE]]:[[@LINE-9]]:3: note: args[0] = a { // A
54 // CHECK-NEXT: string A = "some text";
55 // CHECK-NEXT: dag X = (op op);
60 defm XX : MMC<(op a, a)>;
63 foreach i = [-1, 2] in {
64 // CHECK: [[FILE]]:[[@LINE+4]]:3: note: i = -1 (negative)
65 // CHECK: [[FILE]]:[[@LINE+8]]:5: note: i + 1 <= 0
66 // CHECK: [[FILE]]:[[@LINE+2]]:3: note: i = 2 (positive)
67 // CHECK: [[FILE]]:[[@LINE+4]]:5: note: i + 1 > 0 (i + 1 = 3)
68 dump "i = " # !repr(i) # !if(!ge(i,0), " (positive)", " (negative)");
69 defvar ip1 = !add(i, 1);
71 dump "i + 1 > 0 (i + 1 = " # !repr(ip1) # ")";
77 class Code<code val> {
78 dump "val = " # !repr(val);
82 // CHECK: [[FILE]]:[[@LINE-4]]:3: note: val = [{a = a +1;}]
83 def IncrementA : Code<[{a = a +1;}]>;
84 class InheritFromCode : Code<[{f(x);}]>{
86 dump "number = " # !repr(number);
88 // CHECK: [[FILE]]:[[@LINE-10]]:3: note: val = [{f(x);}]
89 // CHECK: [[FILE]]:[[@LINE-3]]:3: note: number = 33
90 def ModeCode : InheritFromCode;
93 class BaseClassForSet;
94 multiclass DefineSubSet {
95 def _One : BaseClassForSet;
96 def _Two : BaseClassForSet;
98 defset list<BaseClassForSet> TheSet = {
99 defm Subset: DefineSubSet;
100 def Three : BaseClassForSet;
102 // CHECK: [[FILE]]:[[@LINE+1]]:1: note: TheSet = [Subset_One, Subset_Two, Three]
103 dump "TheSet = " # !repr(TheSet);
105 // CHECK: [[FILE]]:[[@LINE+1]]:1: note: 0
106 dump !repr(!exists<BaseClassForSet>("non-existent-record"));