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 | ee65db3add855bfbc4ddc7e45926d1b9bafca8a4 (patch) | |
tree | 66d1077f45dd0e5ec7082137c540e017545a50a7 /docs/TableGenFundamentals.html | |
parent | 302ef834e0a2fd03e4b435079a9fa6c1e1cdc23b (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.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> <!-- *********************************************************************** --> |