The graph of your second instruction looks like this:<br><br><br>  $dst <-----      +<br>                       /   \<br>                      /     \<br>                   $b    $c<br><br>No set in BA instruction pattern because no dest register should be updated.<br>
in ADD instruction pattern, you should update your dest register $dst with the value (add IntRegs:$b, IntRegs:$c).<br><br><br><div class="gmail_quote">On 18 January 2012 10:36, Matthias Berndt <span dir="ltr"><<a href="mailto:matthias.berndt@studserv.uni-leipzig.de">matthias.berndt@studserv.uni-leipzig.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'm trying to write an LLVM backend using LLVM's retargetable code<br>
generator, and I'm confused about how the SelectionDAG works. Let me give<br>
you an example from the SPARC backend (as this is what is often mentioned<br>
in the documentation). This is how the "branch always" instruction is<br>
defined:<br>
<br>
def BA   : BranchSP<0b1000, (ins brtarget:$dst),<br>
                      "ba $dst",<br>
                      [(br bb:$dst)]>;<br>
<br>
The pattern that is to be matched is simply (br bb: $dst). Based on this, I<br>
would have expected the pattern for an add instruction to look somehow like<br>
this: (add IntRegs:$b, IntRegs:$c). But in reality, it looks like this:<br>
(set IntRegs:$dst, (add IntRegs:$b, IntRegs:$c))<br>
What is this "set" thing all about? It doesn't seem to be a node in the<br>
graph, as the pattern is also matched in a graph in which the add node's<br>
ancestor is, say, a mul node. So what is it?<br>
<br>
Cheers<br>
Matthias<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Sincerely,<br><br>Aries Wu<br><br>