Skip to main content

stores

Function stores 

Source
pub fn stores(
    func: &mut Func,
    machine: &MachineInsts,
    names: &mut Interner,
    pending: &mut Pending<'_>,
) -> usize
Expand description

Puts every run that reads a place, computes on it and writes it back into the one instruction this machine has for all three, and gives back how many.

pending is the addresses crate::finish has still to write a displacement into. The store is the instruction that survives and it is already waiting on the entry the load was waiting on, since the two name the same place, so the load’s entry is taken off rather than moved.

Run before loads rather than after it. The run this looks for is three instructions the selector wrote, and folding the load into the arithmetic first would leave two instructions that are the same thing written differently, so the walk would have to know both spellings. Whatever this does not take is still there for loads to take the load out of.

The run whose arithmetic is against a constant is looked for after the one whose arithmetic is against a register, and the order between those two does not matter: the middle instruction decides which of them a run is, and no instruction is both an UPDATES row and a BUMPS row.