Open drcjt opened 7 months ago
Dotnet runtime uses Linear Scan Register Allocator - https://github.com/dotnet/runtime/blob/main/docs/design/coreclr/jit/lsra-detail.md
SDCC uses Optimal Register allocator (in polynomial time) - https://link.springer.com/content/pdf/10.1007/978-3-642-37051-9_1.pdf
Some notes from the latter paper on Z80 architecture:
No register allocation is done during compilation. The intermediate representation is stack based and this is converted into stack based operations of the Z80.
There are a couple of complications with adding register allocation support:
Using a typical solution for register allocation may result in a lot of spilling due to the above resulting in potentially worse performance. Some experimentation will be required to determine if register allocation is worth it.
Note that the compiler will pass parameters in registers in certain limited cases such as when calling intrinsic methods.