Fix typo.
[oota-llvm.git] / docs / TableGenFundamentals.html
index a89e60dba9a5d32beb720293f128c7a6774a3532..ec87f2967cb4c8e135389c01f5e85abff8d63e5e 100644 (file)
@@ -104,8 +104,10 @@ definition, so the backend can find all definitions of a particular class, such
 as "Instruction".</p>
 
 <p><b>TableGen multiclasses</b> are groups of abstract records that are
-instantiated all at once.  Each instantiation can result in multiple TableGen
-definitions.</p>
+instantiated all at once.  Each instantiation can result in multiple
+TableGen definitions.  If a multiclass inherits from another multiclass,
+the definitions in the sub-multiclass become part of the current
+multiclass, as if they were declared in the current multiclass.</p>
 
 </div>
 
@@ -138,7 +140,7 @@ file prints this (at the time of this writing):</p>
   <b>bit</b> isIndirectBranch = 0;
   <b>bit</b> isBarrier = 0;
   <b>bit</b> isCall = 0;
-  <b>bit</b> isSimpleLoad = 0;
+  <b>bit</b> canFoldAsLoad = 0;
   <b>bit</b> mayLoad = 0;
   <b>bit</b> mayStore = 0;
   <b>bit</b> isImplicitDef = 0;
@@ -369,8 +371,11 @@ supported include:</p>
   <dd>string value</dd>
 <dt><tt>[{ ... }]</tt></dt>
   <dd>code fragment</dd>
-<dt><tt>[ X, Y, Z ]</tt></dt>
-  <dd>list value.</dd>
+<dt><tt>[ X, Y, Z ]<type></tt></dt>
+  <dd>list value.  <type> is the type of the list 
+element and is usually optional.  In rare cases,
+TableGen is unable to deduce the element type in
+which case the user must specify it explicitly.</dd>
 <dt><tt>{ a, b, c }</tt></dt>
   <dd>initializer for a "bits&lt;3&gt;" value</dd>
 <dt><tt>value</tt></dt>
@@ -393,9 +398,38 @@ supported include:</p>
   <dd>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
   `<tt>dag</tt>' values.</dd>
+<dt><tt>(implicit a)</tt></dt>
+  <dd>an implicitly defined physical register.  This tells the dag instruction
+  selection emitter the input pattern's extra definitions matches implicit
+  physical register definitions.</dd>
+<dt><tt>(parallel (a), (b))</tt></dt>
+  <dd>a list of dags specifying parallel operations which map to the same
+  instruction.</dd>
 <dt><tt>!strconcat(a, b)</tt></dt>
   <dd>A string value that is the result of concatenating the 'a' and 'b'
   strings.</dd>
+<dt><tt>!cast<type>(a)</tt></dt>
+  <dd>A symbol of type <em>type</em> obtained by looking up the string 'a' in
+the symbol table.  If the type of 'a' does not match <em>type</em>, TableGen
+aborts with an error. !cast<string> is a special case in that the argument must
+be an object defined by a 'def' construct.</dd>
+<dt><tt>!nameconcat&lt;type&gt;(a, b)</tt></dt>
+  <dd>Shorthand for !cast<type>(!strconcat(a, b))</dd>
+<dt><tt>!subst(a, b, c)</tt></dt>
+  <dd>If 'a' and 'b' are of string type or are symbol references, substitute 
+'b' for 'a' in 'c.'  This operation is analogous to $(subst) in GNU make.</dd>
+<dt><tt>!foreach(a, b, c)</tt></dt>
+  <dd>For each member 'b' of dag or list 'a' apply operator 'c.'  'b' is a 
+dummy variable that should be declared as a member variable of an instantiated 
+class.  This operation is analogous to $(foreach) in GNU make.</dd>
+<dt><tt>!car(a)</tt></dt>
+  <dd>The first element of list 'a.'</dd>
+<dt><tt>!cdr(a)</tt></dt>
+  <dd>The 2nd-N elements of list 'a.'</dd>
+<dt><tt>!null(a)</tt></dt>
+  <dd>An integer {0,1} indicating whether list 'a' is empty.</dd>
+<dt><tt>!if(a,b,c)</tt></dt>
+  <dd>'b' if the result of integer operator 'a' is nonzero, 'c' otherwise.</dd>
 </dl>
 
 <p>Note that all of the values have rules specifying how they convert to values
@@ -625,8 +659,10 @@ Here is an example TableGen fragment that shows this idea:
 
 <p>The name of the resultant definitions has the multidef fragment names
    appended to them, so this defines <tt>ADD_rr</tt>, <tt>ADD_ri</tt>,
-   <tt>SUB_rr</tt>, etc.  Using a multiclass this way is exactly equivalent to
-   instantiating the classes multiple times yourself, e.g. by writing:</p>
+   <tt>SUB_rr</tt>, etc.  A defm may inherit from multiple multiclasses,
+   instantiating definitions from each multiclass.  Using a multiclass
+   this way is exactly equivalent to instantiating the classes multiple
+   times yourself, e.g. by writing:</p>
 
 <div class="doc_code">
 <pre>
@@ -694,7 +730,7 @@ File-scope let expressions are really just another way that TableGen allows the
 end-user to factor out commonality from the records.</p>
 
 <p>File-scope "let" expressions take a comma-separated list of bindings to
-apply, and one of more records to bind the values in.  Here are some
+apply, and one or more records to bind the values in.  Here are some
 examples:</p>
 
 <div class="doc_code">
@@ -740,9 +776,9 @@ This should highlight the APIs in <tt>TableGen/Record.h</tt>.</p>
 <hr>
 <address>
   <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
-  src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
+  src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
   <a href="http://validator.w3.org/check/referer"><img
-  src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
+  src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
 
   <a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
   <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>