<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Jan 30, 2016 at 5:32 PM, Dylan McKay <span dir="ltr"><<a href="mailto:dylanmckay34@gmail.com" target="_blank">dylanmckay34@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><p style="margin:0px 0px 1.2em!important">TableGen, as a DSL language, is made up of records. Every <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">def</code> corresponds to a record. For example, TableGen has a <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">class Register</code>, and your backend will define records by <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">def GPR8 : Register<...></code>. You are correct in saying that the record definition is one of the <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">SDNode</code> values. These correspond 1:1 to <a href="http://llvm.org/docs/doxygen/html/namespacellvm_1_1ISD.html#a22ea9cec080dd5f4f47ba234c2f59110" target="_blank"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">llvm::ISD::NodeType</code></a>.</p>
<p style="margin:0px 0px 1.2em!important"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">(DEF a, b)</code> corresponds to</p><span class="">
<pre style="font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;background-color:rgb(248,248,248)">    --------- a
   /
DEF
   \
    ----------b
</code></pre></span><p style="margin:0px 0px 1.2em!important">A more complicated example, regarding that <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">a</code> and <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)">b</code> themselves can be nested DAGs.</p>
<pre style="font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;background-color:rgb(248,248,248)">                     a
                   /
     --------- add
    /              \ 
   /                 b
DEF
   \                 c
    \              /
     ---------- sub
                   \
                    d
</code></pre><p style="margin:0px 0px 1.2em!important">And so on and so fourth.</p>
<div title="MDH:VGFibGVHZW4sIGFzIGEgRFNMIGxhbmd1YWdlLCBpcyBtYWRlIHVwIG9mIHJlY29yZHMuIEV2ZXJ5
IGBkZWZgIGNvcnJlc3BvbmRzIHRvIGEgcmVjb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hidden;font-size:0em;padding:0px;margin:0px"></div></div></div></blockquote><div><br></div><div>My next question is about the nodes of the Selection DAG. Based on what I'm seeing the nodes can either be registers or they can be instructions. If I understand correctly <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);border-radius:3px;display:inline;background-color:rgb(248,248,248)"><a href="http://llvm.org/docs/doxygen/html/namespacellvm_1_1ISD.html#a22ea9cec080dd5f4f47ba234c2f59110" target="_blank">llvm::ISD::NodeType</a> </code>tells me the type of the node (register, add instruction, pseudo instruction, etc).</div><div><br></div><div>What does a DAG set operation do? Does it create new node? </div><div><br></div><div>Here is the example:</div><div><br></div><div>(set GPR:$rD, (add (i32 GPR:$rA), (i32 GPR:$rB)))<br></div><div><br></div><div>And here is what I assume this to look like:</div><div><br></div><div><br></div><div>                                 --------------- GPR:$rA</div><div>                                /</div><div>                               / </div><div>GPR:$rd ----------- add</div><div>                               \</div><div>                                \</div><div>                                 --------------- GRP:$rb</div><div><br></div><div>Am I correct?</div><div><br></div><div>Any help is appreciated.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div title="MDH:VGFibGVHZW4sIGFzIGEgRFNMIGxhbmd1YWdlLCBpcyBtYWRlIHVwIG9mIHJlY29yZHMuIEV2ZXJ5
IGBkZWZgIGNvcnJlc3BvbmRzIHRvIGEgcmVjb3JkLiBGb3IgZXhhbXBsZSwgVGFibGVHZW4gaGFz
IGEgYGNsYXNzIFJlZ2lzdGVyYCwgYW5kIHlvdXIgYmFja2VuZCB3aWxsIGRlZmluZSByZWNvcmRz
IGJ5IGBkZWYgR1BSOCA6IFJlZ2lzdGVyJmx0Oy4uLiZndDtgLiBZb3UgYXJlIGNvcnJlY3QgaW4g
c2F5aW5nIHRoYXQgdGhlIHJlY29yZCBkZWZpb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3A7XCAmbmJz
cDsgJm5ic3A7ICZuYnNwOyAmbmJzcDsgJm5ic3A7ICZuYnNwOyAmbmJzcDsgJm5ic3A7IGM8L2Rp
dj48ZGl2IHN0eWxlPSJmb250LXNpemU6IDEyLjhweDsiPiZuYnNwOyAmbmJzcDsgXCAmbmJzcDsg
Jm5ic3A7ICZuYnNwOyAmbmJzcDsgJm5ic3A7ICZuYnNwOyAmbmJzcDsvPGJyPiZuYnNwOyAmbmJz
cDsgJm5ic3A7LS0tLS0tLS0tLSBzdWI8L2Rpdj48ZGl2IHN0eWxlPSJmb250LXNpemU6IDEyLjhw
eDsiPiZuYnNwOyAmbmJzcDsgJm5ic3A7ICZuYnNwOyAmbmJzcDsgJm5ic3A7ICZuYnNwOyAmbmJz
cDsgJm5ic3A7ICZuYnNwO1w8L2Rpdj48ZGl2IHN0eWxlPSJmb250LXNpemU6IDEyLjhweDsiPiZu
YnNwOyAmbmJzcDsgJm5ic3A7ICZuYnNwOyAmbmJzcDsgJm5ic3A7ICZuYnNwOyAmbmJzcDsgJm5i
c3A7ICZuYnNwOyBkPC9kaXY+PGRpdiBzdHlsZT0iZm9udC1zaXplOiAxMi44cHg7Ij5gYGA8L2Rp
dj48ZGl2IHN0eWxlPSJmb250LXNpemU6IDEyLjhweDsiPjxicj48L2Rpdj48ZGl2IHN0eWxlPSJm
b250LXNpemU6IDEyLjhweDsiPkFuZCBzbyBvbiBhbmQgc28gZm91cnRoLjwvZGl2PjwvZGl2Pg==" style="min-height:0px;width:0px;max-height:0px;max-width:0px;overflow:hidden;font-size:0em;padding:0px;margin:0px">​</div></div></div></blockquote></div>--<br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Rail Shafigulin<br></div>Software Engineer <br>Esencia Technologies<br></div></div></div></div>
</div></div>