pub struct Layout<'a> {
pub conv: &'a CallRegs,
pub file: RegFile,
pub locals: &'a [Local],
pub outgoing: u32,
pub leaf: bool,
pub frame_pointer: bool,
pub grows: bool,
pub red_zone: bool,
pub protect: bool,
}Expand description
Everything about a function’s frame that does not come out of its allocation.
Fields§
§conv: &'a CallRegsWhere the convention this function is compiled for puts things.
file: RegFileThe registers the target has, which is what says how wide a spill slot of a class is.
locals: &'a [Local]The memory the function asked for itself, in the order it wants it reported back.
outgoing: u32How many bytes the widest call in the function needs for arguments it passes on the stack.
leaf: boolWhether the function calls nothing, which is what the alignment and the red zone turn on.
frame_pointer: boolWhether the function keeps a frame pointer, which -fno-omit-frame-pointer asks for and
which a realigned or a dynamically grown frame requires whatever the flags say.
grows: boolWhether the function moves the stack pointer while it runs, which is what a variable length array does and what the rest of the frame then has to be reached around.
See Growing in the module documentation. A frame like this keeps a frame pointer, takes
its bytes rather than living in the red zone, and reports every offset in its body from the
frame pointer, because the stack pointer stops being somewhere a constant reaches from.
red_zone: boolWhether the red zone may be used at all, which -mno-red-zone and every kernel turns off.
protect: boolWhether the frame holds a stack protector’s canary, which -fstack-protector and the
function’s own attribute decide between them.
A protected frame is never a leaf, whatever the function called, because the check at the
end of it calls when it fails. The caller sets leaf accordingly rather than this working
it out, so that there is one place a frame learns whether it owes an aligned stack pointer.