aboutsummaryrefslogtreecommitdiff
path: root/docs/TableGenFundamentals.html
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2010-06-05 02:11:52 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2010-06-05 02:11:52 +0000
commit270562b3d4c61ae1381cb1b0026bb703b46ff88f (patch)
treedc95c8cba3a2dd08aa0facb0293c7689bca5e6bb /docs/TableGenFundamentals.html
parent8613b18a5aa80b13bb8c7f470528146f009bed74 (diff)
Teach tablegen to support 'defm' inside multiclasses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105519 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/TableGenFundamentals.html')
-rw-r--r--docs/TableGenFundamentals.html44
1 files changed, 44 insertions, 0 deletions
diff --git a/docs/TableGenFundamentals.html b/docs/TableGenFundamentals.html
index 5be11624ce..9d1f14e2d4 100644
--- a/docs/TableGenFundamentals.html
+++ b/docs/TableGenFundamentals.html
@@ -687,6 +687,50 @@ Here is an example TableGen fragment that shows this idea:
</pre>
</div>
+<p>
+A defm can also be used inside a multiclass providing several levels of
+multiclass instanciations.
+</p>
+
+<div class="doc_code">
+<pre>
+<b>class</b> Instruction&lt;bits&lt;4&gt; opc, string Name&gt; {
+ bits&lt;4&gt; opcode = opc;
+ string name = Name;
+}
+
+<b>multiclass</b> basic_r&lt;bits&lt;4&gt; opc&gt; {
+ <b>def</b> rr : Instruction&lt;opc, "rr"&gt;;
+ <b>def</b> rm : Instruction&lt;opc, "rm"&gt;;
+}
+
+<b>multiclass</b> basic_s&lt;bits&lt;4&gt; opc&gt; {
+ <b>defm</b> SS : basic_r&lt;opc&gt;;
+ <b>defm</b> SD : basic_r&lt;opc&gt;;
+ <b>def</b> X : Instruction&lt;opc, "x"&gt;;
+}
+
+<b>multiclass</b> basic_p&lt;bits&lt;4&gt; opc&gt; {
+ <b>defm</b> PS : basic_r&lt;opc&gt;;
+ <b>defm</b> PD : basic_r&lt;opc&gt;;
+ <b>def</b> Y : Instruction&lt;opc, "y"&gt;;
+}
+
+<b>defm</b> ADD : basic_s&lt;0xf&gt;, basic_p&lt;0xf&gt;;
+...
+
+<i>// Results</i>
+<b>def</b> ADDPDrm { ...
+<b>def</b> ADDPDrr { ...
+<b>def</b> ADDPSrm { ...
+<b>def</b> ADDPSrr { ...
+<b>def</b> ADDSDrm { ...
+<b>def</b> ADDSDrr { ...
+<b>def</b> ADDY { ...
+<b>def</b> ADDX { ...
+</pre>
+</div>
+
</div>
<!-- ======================================================================= -->