<div dir="ltr"><div>You'll need to declare two sources in "ins" like this</div><div><br></div><div><div>```</div><div>"add $dst,$src"</div><div>(outs GPR64:$dst)</div><div>(ins GPR64:$src1, GPR64:$src2)</div><div>```</div></div><div><br></div><div>And your pattern will need to beĀ </div><div><br></div><div><div>```</div><div>(set GPR64:$dst,(add GPR64:$src1,GPR64:$src2))</div><div>```</div></div><div><br></div><div>Then just above your instruction definition you needĀ </div><div><br></div><div>```</div><div>let Constraints = "$src1 = $dst" in</div><div>```</div><div><br></div><div>This will tell tell register allocation that they need to be the same register.</div><div><br></div><div><br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 14, 2020 at 12:23 AM Zhang via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<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><font>Hi:</font></div><div><font>I'm new to LLVM backend and is developing for a custom ISA which instruction has two addresses.</font></div><div><font>For example:</font></div><div><font>add $r0,$1 means r0=r0+r1.</font></div><div><font><br></font></div><div><font>Previously I just declare two operands for add as following:</font></div><div><font><br></font></div><div><font>```</font></div><div><font>"add $dst,$src"</font></div><div><font>(outs GPR64:$dst)</font></div><div><font>(ins GPR64:$src)</font></div><div><font>```</font></div><div><br></div><div>However when I tried to add ISel patterns to this instruction with the following pattern:</div><div><br></div><div>```</div><div>(set GPR64:$dst,(add GPR64:$src,GPR64:$dst))</div><div>```</div><div><br></div><div>I received error:</div><div><br></div><div>```</div><div>In ADDRR: Input operand $dst occurs in pattern but not in operands list!</div><div>```</div><div><br></div><div>Not sure about what I did wrong here, any hint would be much appreciate</div><div><br></div><div><u></u><u></u></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="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>