Grumble, Grumble.
You start running out of registers just when I have figured out how to make inlining functions optional.
I just need to transform my intermediate form from Static Single Assignment, to Continuation passing style. (Basically represent each basic block as a function that preforms a tail call). Doing that I explicitly know which parameters are passed where, and I can explicitly put the registers that are alive across a function call from all of the different call sites in the same variables, which will later wind up in the same registers.
I have an almost usable version that puts all of the different variables that are alive across a call into different registers, which is not very useful.
There is a known issue that some combinations of code that if your present it to the register allocator wrong it fails to allocate registers, as well as the unfortunate fact that register allocator does not always make progress.
I am really hoping you are running into one of those two bugs, as I would like to reduce code space by not inlining everything :)
Of course the great thing about CPS is that it allows the inlining decision to be delayed. So I can be more flexible in that regard. At least I think I can delay it.
The next big step is to properly handle variables that are kept alive across procedure calls and then I can actually get some code compiling and see where I am at.
Eric