summaryrefslogtreecommitdiff
path: root/docs/TableGenFundamentals.html
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
commit6e0a99a7ab6d6fd0099946c4859466f2a9cdd1e1 (patch)
treec680deee72d90ac6b5873788c0a1b523b8df33ee /docs/TableGenFundamentals.html
parent78db186d2dbaf4745f7e4beab4029db40856b54b (diff)
downloadllvm-6e0a99a7ab6d6fd0099946c4859466f2a9cdd1e1.tar.gz
llvm-6e0a99a7ab6d6fd0099946c4859466f2a9cdd1e1.tar.bz2
llvm-6e0a99a7ab6d6fd0099946c4859466f2a9cdd1e1.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106305 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/TableGenFundamentals.html')
-rw-r--r--docs/TableGenFundamentals.html41
1 files changed, 41 insertions, 0 deletions
diff --git a/docs/TableGenFundamentals.html b/docs/TableGenFundamentals.html
index f7a082d705..81f3cfe044 100644
--- a/docs/TableGenFundamentals.html
+++ b/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>
<!-- ======================================================================= -->