A very interesting article about a way to do register allocation in a single pass (that can be used only on code without branches but is super fast).
The trick is very cool: run over the code in reverse.
Not immediately relevant for Roc but maybe there are compiler passes we could do in a similar way (run them in 'reverse').
https://www.mattkeeter.com/blog/2022-10-04-ssra/
that's how we monomorphize!
I'm a huge fan of the classic linear register allocator, it works really well in my experience even across functions and with branches
aside: register allocation is often really annoying at call sites, since that's often when you have to spill a bunch of callee-saved registers. That's one reason classic continuation-passing style is nice (for the compiler developer, maybe not the user); you never have to care about restoring callee-save data
Last updated: Jun 16 2026 at 16:19 UTC