aboutsummaryrefslogtreecommitdiff
path: root/docs/TableGenFundamentals.html
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2010-06-10 02:42:59 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2010-06-10 02:42:59 +0000
commitee65db3add855bfbc4ddc7e45926d1b9bafca8a4 (patch)
tree66d1077f45dd0e5ec7082137c540e017545a50a7 /docs/TableGenFundamentals.html
parent302ef834e0a2fd03e4b435079a9fa6c1e1cdc23b (diff)
Teach tablegen to allow "let" expressions inside multiclasses,
providing more ways to factor out commonality from the records. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105776 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/TableGenFundamentals.html')
-rw-r--r--docs/TableGenFundamentals.html26
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/TableGenFundamentals.html b/docs/TableGenFundamentals.html
index 9d1f14e2d4..e504a89464 100644
--- a/docs/TableGenFundamentals.html
+++ b/docs/TableGenFundamentals.html
@@ -798,6 +798,32 @@ examples:</p>
need to be added to several records, and the records do not otherwise need to be
opened, as in the case with the <tt>CALL*</tt> instructions above.</p>
+<p>It's also possible to use "let" expressions inside multiclasses, providing
+more ways to factor out commonality from the records, specially if using
+several levels of multiclass instanciations. This also avoids the need of using
+"let" expressions within subsequent records inside a multiclass.</p>
+
+<div class="doc_code">
+<pre>
+<b>multiclass </b>basic_r&lt;bits&lt;4&gt; opc&gt; {
+ <b>let </b>Predicates = [HasSSE2] in {
+ <b>def </b>rr : Instruction&lt;opc, "rr"&gt;;
+ <b>def </b>rm : Instruction&lt;opc, "rm"&gt;;
+ }
+ <b>let </b>Predicates = [HasSSE3] in
+ <b>def </b>rx : Instruction&lt;opc, "rx"&gt;;
+}
+
+<b>multiclass </b>basic_ss&lt;bits&lt;4&gt; opc&gt; {
+ <b>let </b>IsDouble = 0 in
+ <b>defm </b>SS : basic_r&lt;opc&gt;;
+
+ <b>let </b>IsDouble = 1 in
+ <b>defm </b>SD : basic_r&lt;opc&gt;;
+}
+
+<b>defm </b>ADD : basic_ss&lt;0xf&gt;;
+</pre>
</div>
<!-- *********************************************************************** -->