diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-05-24 22:17:39 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-05-24 22:17:39 +0000 |
commit | fae8b1de47c004fefaa6c2683ae193d465b9d93f (patch) | |
tree | 26d07890a81e7e3d41ff71f57000d86383c00d59 /test | |
parent | 72cba6cdf640411e2fb6207858a0abd87c4286fc (diff) |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/TableGen/ForeachLoop.td | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/test/TableGen/ForeachLoop.td b/test/TableGen/ForeachLoop.td index 342609643c..4aacc74d8a 100644 --- a/test/TableGen/ForeachLoop.td +++ b/test/TableGen/ForeachLoop.td @@ -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 |