2013-08-23 04:46:05 +08:00
|
|
|
// RUN: llvm-tblgen %s | FileCheck %s
|
2013-11-10 22:26:08 +08:00
|
|
|
// XFAIL: vg_leak
|
2013-08-23 04:46:05 +08:00
|
|
|
|
|
|
|
// CHECK: Classes
|
|
|
|
// CHECK: Sr
|
|
|
|
// CHECK: Jr
|
|
|
|
// CHECK: "NAME"
|
|
|
|
|
|
|
|
// CHECK: Defs
|
2018-02-22 23:26:35 +08:00
|
|
|
|
|
|
|
// CHECK: def DX {
|
|
|
|
// CHECK: list<string> x = ["0", "1", "2"];
|
|
|
|
// CHECK: }
|
|
|
|
|
TableGen: Reimplement !foreach using the resolving mechanism
Summary:
This changes the syntax of !foreach so that the first "parameter" is
a new syntactic variable: !foreach(x, lst, expr) will define the
variable x within the scope of expr, and evaluation of the !foreach
will substitute elements of the given list (or dag) for x in expr.
Aside from leading to a nicer syntax, this allows more complex
expressions where x is deeply nested, or even constant expressions
in which x does not occur at all.
!foreach is currently not actually used anywhere in trunk, but I
plan to use it in the AMDGPU backend. If out-of-tree targets are
using it, they can adjust to the new syntax very easily.
Change-Id: Ib966694d8ab6542279d6bc358b6f4d767945a805
Reviewers: arsenm, craig.topper, tra, MartinO
Subscribers: wdng, llvm-commits, tpr
Differential Revision: https://reviews.llvm.org/D43651
llvm-svn: 326705
2018-03-05 23:21:04 +08:00
|
|
|
// CHECK: def DY {
|
|
|
|
// CHECK: list<int> y = [5, 7];
|
|
|
|
// CHECK: }
|
|
|
|
|
2013-08-23 04:46:05 +08:00
|
|
|
// CHECK: Jr
|
|
|
|
// CHECK: Sr
|
2009-05-15 06:23:47 +08:00
|
|
|
|
|
|
|
class A<list<string> names> {
|
|
|
|
list<string> Names = names;
|
|
|
|
}
|
|
|
|
|
TableGen: Reimplement !foreach using the resolving mechanism
Summary:
This changes the syntax of !foreach so that the first "parameter" is
a new syntactic variable: !foreach(x, lst, expr) will define the
variable x within the scope of expr, and evaluation of the !foreach
will substitute elements of the given list (or dag) for x in expr.
Aside from leading to a nicer syntax, this allows more complex
expressions where x is deeply nested, or even constant expressions
in which x does not occur at all.
!foreach is currently not actually used anywhere in trunk, but I
plan to use it in the AMDGPU backend. If out-of-tree targets are
using it, they can adjust to the new syntax very easily.
Change-Id: Ib966694d8ab6542279d6bc358b6f4d767945a805
Reviewers: arsenm, craig.topper, tra, MartinO
Subscribers: wdng, llvm-commits, tpr
Differential Revision: https://reviews.llvm.org/D43651
llvm-svn: 326705
2018-03-05 23:21:04 +08:00
|
|
|
class B<list<string> names> : A<!foreach(name, names, !strconcat(name, ", Sr."))>;
|
2009-05-15 06:23:47 +08:00
|
|
|
|
TableGen: Reimplement !foreach using the resolving mechanism
Summary:
This changes the syntax of !foreach so that the first "parameter" is
a new syntactic variable: !foreach(x, lst, expr) will define the
variable x within the scope of expr, and evaluation of the !foreach
will substitute elements of the given list (or dag) for x in expr.
Aside from leading to a nicer syntax, this allows more complex
expressions where x is deeply nested, or even constant expressions
in which x does not occur at all.
!foreach is currently not actually used anywhere in trunk, but I
plan to use it in the AMDGPU backend. If out-of-tree targets are
using it, they can adjust to the new syntax very easily.
Change-Id: Ib966694d8ab6542279d6bc358b6f4d767945a805
Reviewers: arsenm, craig.topper, tra, MartinO
Subscribers: wdng, llvm-commits, tpr
Differential Revision: https://reviews.llvm.org/D43651
llvm-svn: 326705
2018-03-05 23:21:04 +08:00
|
|
|
class C<list<string> names> : A<!foreach(name, names, !strconcat(name, ", Jr."))>;
|
2009-05-15 06:23:47 +08:00
|
|
|
|
TableGen: Reimplement !foreach using the resolving mechanism
Summary:
This changes the syntax of !foreach so that the first "parameter" is
a new syntactic variable: !foreach(x, lst, expr) will define the
variable x within the scope of expr, and evaluation of the !foreach
will substitute elements of the given list (or dag) for x in expr.
Aside from leading to a nicer syntax, this allows more complex
expressions where x is deeply nested, or even constant expressions
in which x does not occur at all.
!foreach is currently not actually used anywhere in trunk, but I
plan to use it in the AMDGPU backend. If out-of-tree targets are
using it, they can adjust to the new syntax very easily.
Change-Id: Ib966694d8ab6542279d6bc358b6f4d767945a805
Reviewers: arsenm, craig.topper, tra, MartinO
Subscribers: wdng, llvm-commits, tpr
Differential Revision: https://reviews.llvm.org/D43651
llvm-svn: 326705
2018-03-05 23:21:04 +08:00
|
|
|
class D<list<string> names> : A<!foreach(name, names, !subst("NAME", "John Smith", name))>;
|
2009-05-15 06:23:47 +08:00
|
|
|
|
|
|
|
class Names {
|
|
|
|
list<string> values = ["Ken Griffey", "Seymour Cray"];
|
|
|
|
}
|
|
|
|
|
|
|
|
def People : Names;
|
|
|
|
|
|
|
|
def Seniors : B<People.values>;
|
|
|
|
def Juniors : C<People.values>;
|
|
|
|
def Smiths : D<["NAME", "Jane Smith"]>;
|
|
|
|
def Unprocessed : D<People.values>;
|
2018-02-22 23:26:35 +08:00
|
|
|
|
|
|
|
class X<list<int> a> {
|
TableGen: Reimplement !foreach using the resolving mechanism
Summary:
This changes the syntax of !foreach so that the first "parameter" is
a new syntactic variable: !foreach(x, lst, expr) will define the
variable x within the scope of expr, and evaluation of the !foreach
will substitute elements of the given list (or dag) for x in expr.
Aside from leading to a nicer syntax, this allows more complex
expressions where x is deeply nested, or even constant expressions
in which x does not occur at all.
!foreach is currently not actually used anywhere in trunk, but I
plan to use it in the AMDGPU backend. If out-of-tree targets are
using it, they can adjust to the new syntax very easily.
Change-Id: Ib966694d8ab6542279d6bc358b6f4d767945a805
Reviewers: arsenm, craig.topper, tra, MartinO
Subscribers: wdng, llvm-commits, tpr
Differential Revision: https://reviews.llvm.org/D43651
llvm-svn: 326705
2018-03-05 23:21:04 +08:00
|
|
|
list<string> x = !foreach(num, a, !cast<string>(num));
|
2018-02-22 23:26:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
def DX : X<[0, 1, 2]>;
|
TableGen: Reimplement !foreach using the resolving mechanism
Summary:
This changes the syntax of !foreach so that the first "parameter" is
a new syntactic variable: !foreach(x, lst, expr) will define the
variable x within the scope of expr, and evaluation of the !foreach
will substitute elements of the given list (or dag) for x in expr.
Aside from leading to a nicer syntax, this allows more complex
expressions where x is deeply nested, or even constant expressions
in which x does not occur at all.
!foreach is currently not actually used anywhere in trunk, but I
plan to use it in the AMDGPU backend. If out-of-tree targets are
using it, they can adjust to the new syntax very easily.
Change-Id: Ib966694d8ab6542279d6bc358b6f4d767945a805
Reviewers: arsenm, craig.topper, tra, MartinO
Subscribers: wdng, llvm-commits, tpr
Differential Revision: https://reviews.llvm.org/D43651
llvm-svn: 326705
2018-03-05 23:21:04 +08:00
|
|
|
|
|
|
|
class Y<list<int> a> {
|
|
|
|
list<int> y = !foreach(num, a, !add(!add(4, num), !add(1, num)));
|
|
|
|
}
|
|
|
|
|
|
|
|
def DY: Y<[0, 1]>;
|