1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/TableGen/NestedForeach.td
Nicolai Haehnle 96e034ed15 TableGen: Allow foreach in multiclass to depend on template args
Summary:
This also allows inner foreach loops to have a list that depends on
the iteration variable of an outer foreach loop. The test cases show
some very simple examples of how this can be used.

This was perhaps the last remaining major non-orthogonality in the
TableGen frontend.

Change-Id: I79b92d41a5c0e7c03cc8af4000c5e1bda5ef464d

Reviewers: tra, simon_tatham, craig.topper, MartinO, arsenm

Subscribers: wdng, llvm-commits

Differential Revision: https://reviews.llvm.org/D47431

llvm-svn: 335221
2018-06-21 13:35:44 +00:00

83 lines
1.6 KiB
TableGen

// RUN: llvm-tblgen %s | FileCheck %s
class Droid<string series, int release, string model, int patchlevel> {
string Series = series;
int Release = release;
string Model = model;
int Patchlevel = patchlevel;
}
foreach S = ["R", "C"] in {
foreach R = [2, 3, 4] in {
foreach M = ["D", "P", "Q"] in {
foreach P = [0, 2, 4] in {
def S#R#M#P : Droid<S, R, M, P>;
}
}
}
}
foreach i = [0, 1] in
foreach j = !foreach(x, [0, 2], !add(i, x)) in
def Z#i#_#j;
// CHECK: def C2D0
// CHECK: def C2D2
// CHECK: def C2D4
// CHECK: def C2P0
// CHECK: def C2P2
// CHECK: def C2P4
// CHECK: def C2Q0
// CHECK: def C2Q2
// CHECK: def C2Q4
// CHECK: def C3D0
// CHECK: def C3D2
// CHECK: def C3D4
// CHECK: def C3P0
// CHECK: def C3P2
// CHECK: def C3P4
// CHECK: def C3Q0
// CHECK: def C3Q2
// CHECK: def C3Q4
// CHECK: def C4D0
// CHECK: def C4D2
// CHECK: def C4D4
// CHECK: def C4P0
// CHECK: def C4P2
// CHECK: def C4P4
// CHECK: def C4Q0
// CHECK: def C4Q2
// CHECK: def C4Q4
// CHECK: def R2D0
// CHECK: def R2D2
// CHECK: def R2D4
// CHECK: def R2P0
// CHECK: def R2P2
// CHECK: def R2P4
// CHECK: def R2Q0
// CHECK: def R2Q2
// CHECK: def R2Q4
// CHECK: def R3D0
// CHECK: def R3D2
// CHECK: def R3D4
// CHECK: def R3P0
// CHECK: def R3P2
// CHECK: def R3P4
// CHECK: def R3Q0
// CHECK: def R3Q2
// CHECK: def R3Q4
// CHECK: def R4D0
// CHECK: def R4D2
// CHECK: def R4D4
// CHECK: def R4P0
// CHECK: def R4P2
// CHECK: def R4P4
// CHECK: def R4Q0
// CHECK: def R4Q2
// CHECK: def R4Q4
// CHECK: def Z0_0
// CHECK: def Z0_2
// CHECK: def Z1_1
// CHECK: def Z1_3