mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
cebb4ee93a
Add some data structures to represent for loops. These will be referenced during object processing to do any needed iteration and instantiation. Add foreach keyword support to the lexer. Add a mode to indicate that we're parsing a foreach loop. This allows the value parser to early-out when processing the foreach value list. Add a routine to parse foreach iteration declarations. This is separate from ParseDeclaration because the type of the named value (the iterator) doesn't match the type of the initializer value (the value list). It also needs to add two values to the foreach record: the iterator and the value list. Add parsing support for foreach. Add the code to process foreach loops and create defs based on iterator values. Allow foreach loops to be matched at the top level. When parsing an IDValue check if it is a foreach loop iterator for one of the active loops. If so, return a VarInit for it. Add Emacs keyword support for foreach. Add VIM keyword support for foreach. Add tests to check foreach operation. Add TableGen documentation for foreach. Support foreach with multiple objects. Support non-braced foreach body with one object. Do not require types for the foreach declaration. Assume the iterator type from the iteration list element type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151164 91177308-0d34-0410-b5e6-96231b3b80d8
75 lines
1.4 KiB
TableGen
75 lines
1.4 KiB
TableGen
// RUN: llvm-tblgen %s | FileCheck %s
|
|
// XFAIL: vg_leak
|
|
|
|
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>;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// 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
|