summaryrefslogtreecommitdiffstats
path: root/llvm/docs
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2010-06-18 19:53:41 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2010-06-18 19:53:41 +0000
commit23f8321cbcb61272ce4e6fbc78e7a8738ba3f861 (patch)
treed5778d0d8c129cf8abf1ce1bd2d4a6f17fdf502f /llvm/docs
parent4c807fca974bb80547e1add9be6e21b58e16d76a (diff)
downloadbcm5719-llvm-23f8321cbcb61272ce4e6fbc78e7a8738ba3f861.tar.gz
bcm5719-llvm-23f8321cbcb61272ce4e6fbc78e7a8738ba3f861.zip
Teach tablegen how to inherit from classes in 'defm' definitions.
The rule is simple: only inherit from a class list if they come in the end, after the last multiclass. llvm-svn: 106305
Diffstat (limited to 'llvm/docs')
-rw-r--r--llvm/docs/TableGenFundamentals.html41
1 files changed, 41 insertions, 0 deletions
diff --git a/llvm/docs/TableGenFundamentals.html b/llvm/docs/TableGenFundamentals.html
index f7a082d7050..81f3cfe0448 100644
--- a/llvm/docs/TableGenFundamentals.html
+++ b/llvm/docs/TableGenFundamentals.html
@@ -732,6 +732,47 @@ multiclass instanciations.
</pre>
</div>
+<p>
+defm declarations can inherit from classes too, the
+rule to follow is that the class list must start after the
+last multiclass, and there must be at least one multiclass
+before them.
+</p>
+
+<div class="doc_code">
+<pre>
+<b>class</b> XD { bits&lt;4&gt; Prefix = 11; }
+<b>class</b> XS { bits&lt;4&gt; Prefix = 12; }
+
+<b>class</b> I&lt;bits<4&gt; op> {
+ bits&lt;4&gt; opcode = op;
+}
+
+<b>multiclass</b> R {
+ <b>def</b> rr : I&lt;4&gt;;
+ <b>def</b> rm : I&lt;2&gt;;
+}
+
+<b>multiclass</b> Y {
+ <b>defm</b> SS : R, XD;
+ <b>defm</b> SD : R, XS;
+}
+
+<b>defm</b> Instr : Y;
+
+<i>// Results</i>
+<b>def</b> InstrSDrm {
+ bits&lt;4&gt; opcode = { 0, 0, 1, 0 };
+ bits&lt;4&gt; Prefix = { 1, 1, 0, 0 };
+}
+...
+<b>def</b> InstrSSrr {
+ bits&lt;4&gt; opcode = { 0, 1, 0, 0 };
+ bits&lt;4&gt; Prefix = { 1, 0, 1, 1 };
+}
+</pre>
+</div>
+
</div>
<!-- ======================================================================= -->
OpenPOWER on IntegriCloud