From 1fc08f5e9ef733ef1ce6f363fecedc2260e78974 Mon Sep 17 00:00:00 2001 From: dim Date: Sat, 14 Apr 2012 13:54:10 +0000 Subject: Vendor import of llvm trunk r154661: http://llvm.org/svn/llvm-project/llvm/trunk@r154661 --- docs/TableGenFundamentals.html | 56 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) (limited to 'docs/TableGenFundamentals.html') diff --git a/docs/TableGenFundamentals.html b/docs/TableGenFundamentals.html index 92b90e6..a211389 100644 --- a/docs/TableGenFundamentals.html +++ b/docs/TableGenFundamentals.html @@ -37,6 +37,7 @@
  1. File inclusion
  2. 'let' expressions
  3. +
  4. 'foreach' blocks
  • TableGen backends @@ -208,6 +209,14 @@ file, to factor out the common features that instructions of its class share. A key feature of TableGen is that it allows the end-user to define the abstractions they prefer to use when describing their information.

    +

    Each def record has a special entry called "NAME." This is the +name of the def ("ADD32rr" above). In the general case def names can +be formed from various kinds of string processing expressions and NAME +resolves to the final value obtained after resolving all of those +expressions. The user may refer to NAME anywhere she desires to use +the ultimate name of the def. NAME should not be defined anywhere +else in user code to avoid conflict problems.

    + @@ -393,6 +402,14 @@ which case the user must specify it explicitly.
    list[4-7,17,2-3]
    A slice of the 'list' list, including elements 4,5,6,7,17,2, and 3 from it. Elements may be included multiple times.
    +
    foreach <var> = <list> in { <body> }
    +
    foreach <var> = <list> in <def>
    +
    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 not conflict with any other object + introduced in <body> or <def>. Currently only defs are + expanded within <body>. +
    (DEF a, b)
    a dag value. The first element is required to be a record definition, the remaining elements in the list may be arbitrary other values, including nested @@ -400,6 +417,10 @@ which case the user must specify it explicitly.
    !strconcat(a, b)
    A string value that is the result of concatenating the 'a' and 'b' strings.
    +
    str1#str2
    +
    "#" (paste) is a shorthand for !strconcat. It may concatenate + things that are not quoted strings, in which case an implicit + !cast<string> is done on the operand of the paste.
    !cast<type>(a)
    A symbol of type type obtained by looking up the string 'a' in the symbol table. If the type of 'a' does not match type, TableGen @@ -868,6 +889,39 @@ several levels of multiclass instanciations. This also avoids the need of using + +

    + Looping +

    + +
    +

    TableGen supports the 'foreach' block, which textually replicates +the loop body, substituting iterator values for iterator references in the +body. Example:

    + +
    +
    +foreach i = [0, 1, 2, 3] in {
    +  def R#i : Register<...>;
    +  def F#i : Register<...>;
    +}
    +
    +
    + +

    This will create objects R0, R1, R2 and +R3. foreach blocks may be nested. If there is only +one item in the body the braces may be elided:

    + +
    +
    +foreach i = [0, 1, 2, 3] in
    +  def R#i : Register<...>;
    +
    +
    +
    + +
    + @@ -912,7 +966,7 @@ This should highlight the APIs in TableGen/Record.h.

    Chris Lattner
    LLVM Compiler Infrastructure
    - Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $ + Last modified: $Date: 2012-03-27 13:25:16 +0200 (Tue, 27 Mar 2012) $ -- cgit v1.1