reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    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
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
// RUN: llvm-tblgen %s | FileCheck %s
// XFAIL: vg_leak

// CHECK: --- Defs ---

// CHECK: def A00 {
// CHECK:   int sum = 7;
// CHECK: }

// CHECK: def A01 {
// CHECK:   int sum = 8;
// CHECK: }

// CHECK-NOT: def B0

// CHECK: def B12 {
// CHECK:   int val = 9;
// CHECK: }

// CHECK: def B20 {
// CHECK:   int val = 7;
// CHECK: }

// CHECK: def B24 {
// CHECK:   int val = 11;
// CHECK: }

// CHECK: def B25 {
// CHECK:   int val = 12;
// CHECK: }

// CHECK: def C04
// CHECK: def C05

// CHECK: def D0A
// CHECK-NOT: def D0B
// CHECK: def D1A
// CHECK: def D1B

// CHECK: def E01
// CHECK: def E02
// CHECK-NOT: def E0C

// CHECK: def E18
// CHECK: def E19
// CHECK: def E1C33
// CHECK: def E1C34
// CHECK: def E1C55
// CHECK: def E1C56

// CHECK-NOT: def F0
// CHECK-NOT: def F1
// CHECK-NOT: def F2_0_0
// CHECK:     def F2_1_0
// CHECK-NOT: def F2_1_2
// CHECK:     def F2_2_0
// CHECK:     def F2_2_1
// CHECK-NOT: def F2_2_2

multiclass A<int x> {
  foreach i = [0, 1] in {
    def NAME#i {
      int sum = !add(x, i);
    }
  }
}

defm A0 : A<7>;

multiclass B<int x, list<int> lst> {
  foreach i = lst in {
    def NAME#i {
      int val = !add(x, i);
    }
  }
}

defm B0 : B<7, []>;
defm B1 : B<7, [2]>;
defm B2 : B<7, [0, 4, 5]>;

multiclass C<int x> {
  foreach i = [x, !add(x, 1)] in {
    def NAME#i;
  }
}

defm C0 : C<4>;

multiclass D<bit b> {
  def A;

  foreach _ = !if(b, [0], []<int>) in
  def B;
}

defm D0 : D<0>;
defm D1 : D<1>;

multiclass E<list<int> lst, int x>
  : C<x> {
  foreach i = lst in
  defm C#i : C<i>;
}

defm E0 : E<[], 1>;
defm E1 : E<[3, 5], 8>;

multiclass F<list<int> lst> {
  foreach i = lst in
  foreach j = !foldl([]<int>, lst, lhs, x,
                     !if(!lt(x, i), !listconcat(lhs, [x]), lhs)) in
  def _#i#_#j;
}

defm F0 : F<[]>;
defm F1 : F<[0]>;
defm F2 : F<[0, 1, 2]>;