<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Dec 27, 2017 2:00 PM, "Matt Arsenault" <<a href="mailto:arsenm2@gmail.com">arsenm2@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text"><br>
<br>
> On Dec 26, 2017, at 18:42, Sean Silva via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
> Thanks! That looks like a winning approach.<br>
><br>
> I swear I grepped around for ISD::Constant but for some reason never found this code. I think maybe I was searching for ISD::Constant with setOperationAction, which in hindsight was narrowing down my search to just lowering, which is exactly what I didn't want! (I was looking for other approaches). I also tried looking in depth at PowerPC but it looks like it doesn't use this approach either.<br>
><br>
> -- Sean Silva<br>
<br>
</div>What’s the reason for trying to handle this in SelectionDAG at all? I would just materialize zero like any other constant, and treat replacing that with the zero register as an immediate folding optimization (e.g. FoldImmediate or another peephole pass)<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">I thought about doing that, but I wasn't sure I could make it work.</div><div dir="auto"><br></div><div dir="auto">The issue is that the hardwired registers are actually the only way to write immediates of this register class (the registers are very small, obviously). I've been phrasing this as integer 0 (and -1) to keep the discussion closer to other architectures, but the fact that these hardwired registers are the only way to reference immediates of this register class is one important difference.</div><div dir="auto"><br></div><div dir="auto">One thing I've been curious about is how immediates interact with register classes. Could we use ordinary immediate MachineOperand's (of the appropriate bit width) and just print the immediate MO's of this register class as the corresponding hardwired register? Does MIR have any constraints on using an immediate MO instead of a register?</div><div dir="auto"><br></div><div dir="auto">-- Sean Silva</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<font color="#888888"><br>
-Matt</font></blockquote></div><br></div></div></div>