4 ms·
I have mostly-working code --- but the register allocator I was using turns out to be pretty pants, so it's generating lousy code and is nowhere ready to look a
by david-given 10y ago
I have mostly-working code --- but the register allocator I was using turns out to be pretty pants, so it's generating lousy code and is nowhere ready to look at yet. I'm taking time off to learn about graph colouring to try and do a proper job. (Turns out graph colouring on irregular architectures is kinda exciting, and not in a good way.)
It's not actually based on LLVM at all; I'm working with a completely different (and simpler) compiler suite, albeit using some of the same principles. The code quality is never going to be good, but I'm hoping the end result will allow a compiler port to any random relatively sane architecture in only two source files.
- tom_mellior 10y ago> Turns out graph colouring on irregular architectures is kinda exciting, and not in a good way. Have you looked into PBQP register allocation? It's almost as simple as basic graph coloring but handles irregularities in a nice and disciplined way.
- qznc 10y agoI helped building the one in libfirm and I agree. The x86 architecture is quite regular and we have not used it for others in practice. However, for all irregularities I have come across I could immediately see how to model it in theory.
- tom_mellior 10y agoOh, I thought PBQP was the only register allocator in libfirm. What do you use for other architectures?
- qznc 10y agoThe default is a graph coloring algorithm. Well actually a "recoloring" algorithm due to its SSA-based nature. There is also an ILP one, which is only useful for comparison.