mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-11 15:26:07 +00:00
TableGen: some LangRef doc fixes
Summary: Change-Id: I1442e2daa09cab727a01d8c31893b50e644a5cd3 Reviewers: tra, simon_tatham, craig.topper Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D47530 Change-Id: I397655dd18b7ff978c1affa3174740d9c1a82594 llvm-svn: 333901
This commit is contained in:
parent
9a21ccd3ad
commit
f62a6ed017
@ -152,8 +152,8 @@ supported include:
|
|||||||
``foreach <var> = [ <list> ] in <def>``
|
``foreach <var> = [ <list> ] in <def>``
|
||||||
Replicate <body> or <def>, replacing instances of <var> with each value
|
Replicate <body> or <def>, replacing instances of <var> with each value
|
||||||
in <list>. <var> is scoped at the level of the ``foreach`` loop and must
|
in <list>. <var> is scoped at the level of the ``foreach`` loop and must
|
||||||
not conflict with any other object introduced in <body> or <def>. Currently
|
not conflict with any other object introduced in <body> or <def>. Only
|
||||||
only ``def``\s are expanded within <body>.
|
``def``\s and ``defm``\s are expanded within <body>.
|
||||||
|
|
||||||
``foreach <var> = 0-15 in ...``
|
``foreach <var> = 0-15 in ...``
|
||||||
|
|
||||||
@ -348,6 +348,23 @@ In this case, the ``Z`` definition will have a zero value for its ``V`` value,
|
|||||||
despite the fact that it derives (indirectly) from the ``C`` class, because the
|
despite the fact that it derives (indirectly) from the ``C`` class, because the
|
||||||
``D`` class overrode its value.
|
``D`` class overrode its value.
|
||||||
|
|
||||||
|
References between variables in a record are substituted late, which gives
|
||||||
|
``let`` expressions unusual power. Consider this admittedly silly example:
|
||||||
|
|
||||||
|
.. code-block:: text
|
||||||
|
|
||||||
|
class A<int x> {
|
||||||
|
int Y = x;
|
||||||
|
int Yplus1 = !add(Y, 1);
|
||||||
|
int xplus1 = !add(x, 1);
|
||||||
|
}
|
||||||
|
def Z : A<5> {
|
||||||
|
let Y = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
The value of ``Z.xplus1`` will be 6, but the value of ``Z.Yplus1`` is 11. Use
|
||||||
|
this power wisely.
|
||||||
|
|
||||||
.. _template arguments:
|
.. _template arguments:
|
||||||
|
|
||||||
Class template arguments
|
Class template arguments
|
||||||
|
@ -229,15 +229,17 @@ of:
|
|||||||
int Baz = Bar;
|
int Baz = Bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Values defined in superclasses can be accessed the same way.
|
||||||
|
|
||||||
* a template arg of a ``class``, such as the use of ``Bar`` in::
|
* a template arg of a ``class``, such as the use of ``Bar`` in::
|
||||||
|
|
||||||
class Foo<int Bar> {
|
class Foo<int Bar> {
|
||||||
int Baz = Bar;
|
int Baz = Bar;
|
||||||
}
|
}
|
||||||
|
|
||||||
* value local to a ``multiclass``, such as the use of ``Bar`` in::
|
* value local to a ``class``, such as the use of ``Bar`` in::
|
||||||
|
|
||||||
multiclass Foo {
|
class Foo {
|
||||||
int Bar = 5;
|
int Bar = 5;
|
||||||
int Baz = Bar;
|
int Baz = Bar;
|
||||||
}
|
}
|
||||||
@ -245,9 +247,16 @@ of:
|
|||||||
* a template arg to a ``multiclass``, such as the use of ``Bar`` in::
|
* a template arg to a ``multiclass``, such as the use of ``Bar`` in::
|
||||||
|
|
||||||
multiclass Foo<int Bar> {
|
multiclass Foo<int Bar> {
|
||||||
int Baz = Bar;
|
def : SomeClass<Bar>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
* the iteration variable of a ``foreach``, such as the use of ``i`` in::
|
||||||
|
|
||||||
|
foreach i = 0-5 in
|
||||||
|
def Foo#i;
|
||||||
|
|
||||||
|
* a variable defined by ``defset``
|
||||||
|
|
||||||
* the implicit template argument ``NAME`` in a ``class`` or ``multiclass``
|
* the implicit template argument ``NAME`` in a ``class`` or ``multiclass``
|
||||||
|
|
||||||
.. productionlist::
|
.. productionlist::
|
||||||
|
Loading…
x
Reference in New Issue
Block a user