Register allocation and spilling, the easy way?
I'm looking for a way to allocate local variables to registers. I'm aware of a couple of serious methods for doing it (namely, those mentioned on Wikipedia ), but I'm stuck on how "spilling" is accomplished. Also, the relevant literature is quite intimidating. I'm hoping there's something simpler that will satisfy my priorities: Correctness -- an algorithm that will generate correct code regardless of how many local variables there are. Simplicity -- something I can understand without having to read too much literature. Efficiency -- it needs to be better than the current method, which is: