pub fn rounds(func: &mut Func, to: u32)Expand description
Rounds up the bytes every variable length array asks for, so that the stack pointer stays where a call can be made from.
The size of one is whatever the program wrote in the brackets times the size of an element, so
it is any number at all, and the bytes come off the stack pointer where the declaration stands.
A stack pointer moved by an odd number is one no call can be made through afterwards: the
convention says a call arrives with the stack pointer on a multiple of to, and every argument
passed on the stack, every spill of a vector register and the alignment of every local below the
array is counted from there. So the number that comes off is the size rounded up, which is
(size + to - 1) & -to and is three instructions the machine already has.
Here rather than in the front end because to is the convention’s and the front end writes one
IR for every target. Here rather than in crate::lower because it is arithmetic, which is the
one thing a lowering rule deliberately cannot do, and that is what this module is for.
An array asking for more alignment than to asks for to bytes more than it needs and takes
the address it wanted out of the middle of them, which aligns below writes. The stack pointer
itself is left where a call can be made from, so nothing about a frame like that is different
from any other frame that grows.