From fae8b1de47c004fefaa6c2683ae193d465b9d93f Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Thu, 24 May 2012 22:17:39 +0000 Subject: 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 --- test/TableGen/ForeachLoop.td | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'test/TableGen') diff --git a/test/TableGen/ForeachLoop.td b/test/TableGen/ForeachLoop.td index 3426096..4aacc74 100644 --- a/test/TableGen/ForeachLoop.td +++ b/test/TableGen/ForeachLoop.td @@ -6,11 +6,19 @@ class Register { 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 -- cgit v1.1