<div dir="ltr"><div><div><div>This is typically accomplished with something like PPC's `RegConstraint` and `NoEncode`. You can see examples of it that are very similar to what you're after in PPC's load/store with update forms (i.e. load a value and update the base register with the effective address - these are used for pre-increment loads/stores).<br></div>For example: the definition of LBZU and friends in lib/Target/PowerPC/PPCInstrInfo.td.<br></div>For a simpler example of just the `RegConstraint` usage (as it doesn't use a compound node like PPC's address nodes), you can look at all the fused multiply-add such as XSMADDADP in lib/Target/PowerPC/PPCInstrVSX.td.<br><br></div>Hope this helps.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 28, 2017 at 12:04 PM, Dr. ERDI Gergo 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><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sun, 28 May 2017, David Chisnall wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 let Constraints = "@earlyclobber $reg" in<br>
 def LDWRdPtr : Pseudo<(outs DREGS:$reg),<br>
                       (ins PTRREGS:$ptrreg),<br>
                       "ldw\t$reg, $ptrreg",<br>
                       [(set i16:$reg, (load i16:$ptrreg))]>,<br>
                Requires<[HasSRAM]>;<br>
<br>
The problem, of course, is that with this definition I end up with code which assumes it is equivalent to save P before 'ldw r1:r2,P' or after. I tried adding "@earlyclobber $ptrreg" as a Constraint, but that just leads to an assertion failure during codegen (I assume because @earlyclobber is for output ports)<br>
</blockquote>
<br>
You need to express the P as both an input and output operand and add a constraint that both must be the same register.<br>
</blockquote>
<br></span>
OK, but then the pattern will have to include that extra output operand somehow, right? What would the pattern need to be so that during ISel, this LDWRdPtr instruction with the extra output still matches?<div class="HOEnZb"><div class="h5"><br>
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/llvm-dev</a><br>
</div></div></blockquote></div><br></div>