<div dir="ltr"><div>Matthias and David, </div><div><br></div><div>Thanks for the insight into the problem at hand :)</div><div><br></div><div>Yes, generally, we would do the reg alloc on MI because it has meaning on an actual architecture we specified. For the project I'm working on, I'm <i>intentionally</i> not using MI, as I need to find out whether it is possible to evaluate code on different architectures, using IR simulations.<br></div><div><br></div><div>Since it is not possible to return SSA form after doing reg-alloc on the IR, I'll be satisfied with a non-SSA IR, or if you will, NS-IR. This won't be LLVM IR but I can modify my IR simulator and use it nonetheless.</div><div><br></div><div>Thanks,</div><div><br></div><div>Kartik.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 17, 2015 at 12:05 PM, Matthias Braun <span dir="ltr"><<a href="mailto:mbraun@apple.com" target="_blank">mbraun@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Having worked on SSA register allocators in the past I have to say that SSA is actually a good fit for register allocation. However LLVM IR is indeed not. You don't have any target instructions or register classed/constraints. It wouldn't make much sense to designate registers to llvm IR values nor is there a way to express that in IR. llvm has the machine instruction (MI) representation for that.<br>
<span class="HOEnZb"><font color="#888888"><br>
- Matthias<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> On Jun 17, 2015, at 5:37 AM, David Chisnall <<a href="mailto:David.Chisnall@cl.cam.ac.uk">David.Chisnall@cl.cam.ac.uk</a>> wrote:<br>
><br>
> On 15 Jun 2015, at 17:21, Kartik Ramkrishnan <<a href="mailto:kartikram3@gmail.com">kartikram3@gmail.com</a>> wrote:<br>
>><br>
>> Thanks. I will also work on doing an SSA register allocation that returns SSA form (IR), since it is not yet implemented.<br>
><br>
> It’s not implemented because it doesn’t really make sense as a concept.  Register allocation is all about making use of a finite set of registers, spilling values to memory if they don’t fit.  In SSA form, you have an infinite number of registers and (more importantly) you can only assign to each register once, so there is no way of spilling from a register and then using that register for something else.<br>
><br>
> To implement register allocation in LLVM IR, you would need IR not to be SSA, and then it wouldn’t be LLVM IR.<br>
><br>
> David<br>
><br>
<br>
</div></div></blockquote></div><br></div>