<div dir="ltr">> <span style="font-size:12.8px">You'd add extra CopyFromReg nodes, glued[1] to your multiplication </span><span style="font-size:12.8px">node</span><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Thanks makes a lot of sense, thanks Tim!</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 20, 2016 at 4:45 AM, Tim Northover <span dir="ltr"><<a href="mailto:t.p.northover@gmail.com" target="_blank">t.p.northover@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> If I write a C++ matcher, will the register allocator work correctly? The<br>
> multiplication instruction I'm working with always writes the result to<br>
> registers `R1` and `R0`, but if that logic is in C++, how will the<br>
> regallocator know?<br>
<br>
</span>You'd add extra CopyFromReg nodes, glued[1] to your multiplication<br>
node. The values produced by the CopyFromReg nodes are what other<br>
users should actually be using[2]. x86 has similar hard-coded<br>
registers on its multiplication operations, I believe. Try "llc<br>
-view-sched-dags ..." to see the kind of thing you should be<br>
producing.<br>
<br>
Cheers.<br>
<br>
Tim.<br>
<br>
[1] Glue is represented by producing/consuming a value of type MVT::Glue.<br>
[2] You may well have to manually call ReplaceAllUsesOfValueWith after<br>
creating them to make that happen.<br>
</blockquote></div><br></div>