Hacker News new | ask | show | jobs
by mathisfun123 5 hours ago
> The problem of assigning registers to values (in SSA form) has a single pass optimal solution

I knew someone would comment this because hn is always "well akshually...". But the parenthetical is doing all the work in this "nit". Yes coloring chordal graphs is polynomial but real compilers don't do register allocation on SSA form. Spilling and spitting break chordal form.

1 comments

The HotSpot C1 compiler allocates on SSA form [0], so does libfirm [1], I think the Android Runtime does [2], Go does [3], and so does Cranelift [4]. And this compiler for Intel GPUs does too [5].

[0] https://dl.acm.org/doi/acm/10.1145/1772954.1772979 however they do note that splitting breaks SSA form, and fall back to slower algorithms for values which get split.

[1] https://libfirm.github.io/Features.html

[2] https://arxiv.org/abs/2011.05608v1

[3] https://developers.redhat.com/articles/2024/09/24/go-compile...

[4] https://github.com/bytecodealliance/regalloc2/

[5] https://www.youtube.com/watch?v=-UFjec3YctM