diff options
Diffstat (limited to 'docs/TableGenFundamentals.html')
-rw-r--r-- | docs/TableGenFundamentals.html | 26 |
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<bits<4> opc> { + <b>let </b>Predicates = [HasSSE2] in { + <b>def </b>rr : Instruction<opc, "rr">; + <b>def </b>rm : Instruction<opc, "rm">; + } + <b>let </b>Predicates = [HasSSE3] in + <b>def </b>rx : Instruction<opc, "rx">; +} + +<b>multiclass </b>basic_ss<bits<4> opc> { + <b>let </b>IsDouble = 0 in + <b>defm </b>SS : basic_r<opc>; + + <b>let </b>IsDouble = 1 in + <b>defm </b>SD : basic_r<opc>; +} + +<b>defm </b>ADD : basic_ss<0xf>; +</pre> </div> <!-- *********************************************************************** --> |