diff options
| author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2010-06-10 02:42:59 +0000 |
|---|---|---|
| committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2010-06-10 02:42:59 +0000 |
| commit | 5f2adccc1b61998109862a86f119afaf13994589 (patch) | |
| tree | f7cc8d5d6082c7dc61a8ab16570d1212092c5c0e /llvm/docs/TableGenFundamentals.html | |
| parent | 38f65604611d3146d1d38ee319f487b2819992bb (diff) | |
| download | bcm5719-llvm-5f2adccc1b61998109862a86f119afaf13994589.tar.gz bcm5719-llvm-5f2adccc1b61998109862a86f119afaf13994589.zip | |
Teach tablegen to allow "let" expressions inside multiclasses,
providing more ways to factor out commonality from the records.
llvm-svn: 105776
Diffstat (limited to 'llvm/docs/TableGenFundamentals.html')
| -rw-r--r-- | llvm/docs/TableGenFundamentals.html | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/docs/TableGenFundamentals.html b/llvm/docs/TableGenFundamentals.html index 9d1f14e2d47..e504a894640 100644 --- a/llvm/docs/TableGenFundamentals.html +++ b/llvm/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> <!-- *********************************************************************** --> |

