<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 29, 2016 at 11:39 AM, Rail Shafigulin <span dir="ltr"><<a href="mailto:rail@esenciatech.com" target="_blank">rail@esenciatech.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Thu, Jan 28, 2016 at 8:34 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:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Try visualising the DAG like this.<div><br></div><div>```</div><div> ---- GPR:$rA</div><div> /</div><div>set GPR:$rd ---- add</div><div> \</div><div> ---- GPR:$rB</div><div>```</div><div><br></div><div>Each instruction forms a DAG with its operands being subnodes.</div><div><br></div><div>The core instruction selection logic just looks for the pattern `(set GPR:$rd, (add GPR:$rA, GPR:$rB))`. It then becomes a simple substitution. This is a DAG because there all nodes are directed and acyclic. <br></div></div></blockquote><div><br><br></div></span><div>Am I correct in my understanding that each node can either be a register or of type SDNode defined in TargetSelectionDAG.td? <br></div></div></div></div></blockquote><div><br></div><div>I should clarify. What I'm confused about is how exactly the DAG is defined. Here is what is says on <a href="http://llvm.org/docs/TableGen/LangIntro.html">llvm.org/docs/TableGen/LangIntro.html</a><br><dl class=""><dt><tt class=""><span class="">(DEF</span> <span class="">a,</span> <span class="">b)</span></tt></dt><dd>a dag value. The first element is required to be a record definition, the
remaining elements in the list may be arbitrary other values, including
nested <tt class=""><span class="">`dag</span></tt>‘ values.</dd></dl>What is meant by a record definition? Is it a definition of type SDNode which are defined in TargetSelectionDAG.td?<br></div><div>What exactly does (DEF, a, b) represent in the graph?<br><br></div><div>Is it <br><br></div><div> --------- a<br></div><div> /<br></div><div>DEF<br></div><div> \<br> ----------b<br><br></div><div>or <br><br></div><div> --------a<br></div><div>/<br></div><div>-------- DEF<br>\<br></div><div> -------b<br><br></div><div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Thu, Jan 28, 2016 at 7:33 PM, Rail Shafigulin via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div dir="ltr"><div><div>I'm confused about how to specify DAG patterns for a given instruction<br><br></div>Here is an example for my target<br><br>class ALU1_RR<bits<4> subOp, string asmstr, SDNode OpNode><br> : ALU_RR<subOp, asmstr,<br> [(set GPR:$rD, (OpNode (i32 GPR:$rA), (i32 GPR:$rB)))]>;<br><br>def ADD : ALU1_RR<0x0, "l.add", add>;<br><br></div>The set operation simply creates a list. The add operation creates a union. So at the end [(set GPR:$rD, (OpNode (i32 GPR:$rA), (i32 GPR:$rB)))] becomes a just a regular set. How come this is a DAG? I feel like I'm missing something. Would anyone be able to help with the explanation?<span><font color="#888888"><br><div><div><div><div><br>-- <br><div><div dir="ltr"><div><div dir="ltr"><div>Rail Shafigulin<br></div>Software Engineer <br>Esencia Technologies<br></div></div></div></div>
</div></div></div></div></font></span></div>
<br></div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></span></div><span class=""><br><br clear="all"><br>-- <br><div><div dir="ltr"><div><div dir="ltr"><div>Rail Shafigulin<br></div>Software Engineer <br>Esencia Technologies<br></div></div></div></div>
</span></div></div>
</blockquote></div><br><br clear="all"><br>-- <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>