File: dump.td

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (103 lines) | stat: -rw-r--r-- 2,953 bytes parent folder | download | duplicates (4)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// RUN: llvm-tblgen %s -o -  2>&1 >/dev/null | FileCheck %s -DFILE=%s

// CHECK: [[FILE]]:[[@LINE+1]]:1: note: Debug message
dump "Debug message";

def op;
class A {
  string A = "some text";
  dag X =(op op);
}
def a : A;
// CHECK: [[FILE]]:[[@LINE+5]]:1: note: The Value of A is:
// CHECK-NEXT: a {     // A
// CHECK-NEXT: string A = "some text";
// CHECK-NEXT: dag X = (op op);
// CHECK-NEXT: }
dump "The Value of A is: \n" # !repr(a);

def b : A;
// CHECK: [[FILE]]:[[@LINE+4]]:1: note: b {     // A
// CHECK-NEXT: string A = "some text";
// CHECK-NEXT: dag X = (op op);
// CHECK-NEXT: }
dump b;

defvar value_A = "some other text";
// CHECK: [[FILE]]:[[@LINE+1]]:1: note: some other text
dump value_A;

defvar value_B = 12;
def X;
// CHECK: [[FILE]]:[[@LINE+3]]:1: note: got a pair of values ["some other text" : 12], and an empty record:
// CHECK-NEXT: X {
// CHECK-NEXT: }
dump "got a pair of values [" # !repr(value_A) # " : " # !repr(value_B) # "], " # "and an empty record:\n" # !repr(X);

multiclass MC<dag s> {
// CHECK: [[FILE]]:[[@LINE+1]]:3: note: s = (op a)
  dump "s = " # !repr(s);
// CHECK: [[FILE]]:[[@LINE+4]]:3: note: args[0] = a {        // A
// CHECK-NEXT:   string A = "some text";
// CHECK-NEXT: dag X = (op op);
// CHECK-NEXT: }
  dump "args[0] = " # !repr(!getdagarg<A>(s,0));
  def A;
}
defm X : MC<(op a)>;

multiclass MMC<dag s> {
// CHECK: [[FILE]]:[[@LINE+1]]:3: note: the operand of s is op
  dump "the operand of s is " # !getdagop(s);
// CHECK: [[FILE]]:[[@LINE-13]]:3: note: s = (op a, a)
// CHECK: [[FILE]]:[[@LINE-9]]:3: note: args[0] = a {        // A
// CHECK-NEXT:   string A = "some text";
// CHECK-NEXT: dag X = (op op);
// CHECK-NEXT: }
  defm : MC<s>;
}

defm XX : MMC<(op a, a)>;


foreach i = [-1, 2] in {
// CHECK: [[FILE]]:[[@LINE+4]]:3: note: i = -1 (negative)
// CHECK: [[FILE]]:[[@LINE+8]]:5: note: i + 1  <= 0
// CHECK: [[FILE]]:[[@LINE+2]]:3: note: i = 2 (positive)
// CHECK: [[FILE]]:[[@LINE+4]]:5: note: i + 1  > 0 (i + 1 = 3)
  dump "i = " # !repr(i) # !if(!ge(i,0), " (positive)", " (negative)");
  defvar ip1 = !add(i, 1);
  if !gt(ip1,0) then {
    dump "i + 1 > 0 (i + 1 = " # !repr(ip1) # ")";
  } else {
    dump "i + 1 <= 0" ;
  }
}

class Code<code val> {
  dump "val = " # !repr(val);
  code Val = val;
  int number = 0;
}
// CHECK: [[FILE]]:[[@LINE-4]]:3: note: val = [{a = a +1;}]
def IncrementA : Code<[{a = a +1;}]>;
class InheritFromCode : Code<[{f(x);}]>{
  let number = 33;
  dump "number = " # !repr(number);
}
// CHECK: [[FILE]]:[[@LINE-10]]:3: note: val = [{f(x);}]
// CHECK: [[FILE]]:[[@LINE-3]]:3: note: number = 33
def ModeCode : InheritFromCode;


class BaseClassForSet;
multiclass DefineSubSet {
  def _One : BaseClassForSet;
  def _Two : BaseClassForSet;
}
defset list<BaseClassForSet> TheSet = {
defm Subset: DefineSubSet;
def Three : BaseClassForSet;
}
// CHECK: [[FILE]]:[[@LINE+1]]:1: note: TheSet = [Subset_One, Subset_Two, Three]
dump "TheSet = " # !repr(TheSet);