mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Add support for range expressions in TableGen foreach loops.
Like this: foreach i = 0-127 in ... Use braces for composite ranges: foreach i = {0-3,9-7} in ... git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157432 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -6,11 +6,19 @@ class Register<string name, int idx> {
|
||||
int Index = idx;
|
||||
}
|
||||
|
||||
// CHECK-NOT: !strconcat
|
||||
|
||||
foreach i = 0-3 in
|
||||
def Q#i : Register<"Q"#i, i>;
|
||||
|
||||
// CHECK: def Q0
|
||||
// CHECK: def Q1
|
||||
// CHECK: def Q2
|
||||
// CHECK: def Q3
|
||||
|
||||
foreach i = [0, 1, 2, 3, 4, 5, 6, 7] in
|
||||
def R#i : Register<"R"#i, i>;
|
||||
|
||||
// CHECK-NOT: !strconcat
|
||||
|
||||
// CHECK: def R0
|
||||
// CHECK: string Name = "R0";
|
||||
// CHECK: int Index = 0;
|
||||
@@ -42,3 +50,14 @@ foreach i = [0, 1, 2, 3, 4, 5, 6, 7] in
|
||||
// CHECK: def R7
|
||||
// CHECK: string Name = "R7";
|
||||
// CHECK: int Index = 7;
|
||||
|
||||
foreach i = {0-3,9-7} in
|
||||
def S#i : Register<"Q"#i, i>;
|
||||
|
||||
// CHECK: def S0
|
||||
// CHECK: def S1
|
||||
// CHECK: def S2
|
||||
// CHECK: def S3
|
||||
// CHECK: def S7
|
||||
// CHECK: def S8
|
||||
// CHECK: def S9
|
||||
|
Reference in New Issue
Block a user