Skip to main content

addresses

Function addresses 

Source
pub fn addresses(
    func: &mut Func,
    insts: &FrameInsts,
    names: &mut Interner,
    pending: &mut Pending<'_>,
) -> usize
Expand description

Folds every address computation that one memory operand reads, and gives back how many.

pending is the addresses crate::finish has still to write a displacement into, and folding one moves its entry to the instruction that took it. The displacement composed in by the fold stays where it is and the frame’s offset is added to it later, which is why that write is an addition rather than an assignment.

Run after lowering and before allocation. Running it twice can find more than running it once. Folding a lea into a second lea leaves that second one foldable in turn, and the walk below takes those in the one pass since it goes forwards. What it does not take in the one pass is the other order, where the second lea has a reader of its own and goes before the first one’s set is complete, and that is a set the next run finds whole.