pub struct Stack {
pub calls: Option<u32>,
pub locals: Vec<Local>,
pub addresses: Vec<(Inst, usize)>,
}Expand description
What a function’s stack has to hold, as far as selection is able to say.
All of it is answered here because selection is where a call is built and where an alloca
is read, and nothing after it could tell what either of them needed.
Fields§
§calls: Option<u32>How many bytes the widest call in the function needs below the stack pointer for the
arguments it passes there, or None for a function that makes no call at all.
None is a leaf, which is the function that may use the red zone and the one whose stack
pointer does not have to be left aligned for anybody.
locals: Vec<Local>The memory the function asked for itself, one entry for every alloca in it, in the order
the walk reached them.
addresses: Vec<(Inst, usize)>Which instruction computes the address of which of those locals.
An address in the frame is a distance from the stack pointer, and there is no frame until
after allocation, so the instruction is written here with nothing in its displacement and
crate::finish writes the number in once crate::frame::Frame knows it.
Implementations§
Source§impl Stack
impl Stack
Sourcepub fn layout<'a>(&'a self, base: Layout<'a>) -> Layout<'a>
pub fn layout<'a>(&'a self, base: Layout<'a>) -> Layout<'a>
The layout given, with the three fields only the lowering knows the answer to filled in.
Everything else in a layout comes from the flags the function is compiled under or from the allocation, so this takes one and returns it rather than building one.