Skip to main content

rewrite

Function rewrite 

Source
pub fn rewrite(
    func: &mut Func,
    assignment: &mut Assignment,
    env: &Env,
) -> Vec<Edit>
Expand description

Rewrites a function to the places it was given, and says what moves are still wanted.

§Panics

Panics if the entry block has parameters, since there is no edge into it for their moves to go on and what arrives in a function is the ABI lowering’s to say. Panics on a critical edge, on an edge carrying the wrong number of arguments, and if a class has fewer than two registers on an edge that moves a spilled value into a spilled parameter, all of which are the caller handing it something it was told not to.

The assignment is taken by reference and may gain a slot, which is the one the register borrowed at an instruction with more spilled operands than the class holds registers back for waits in. The section above says what the borrowing is, and the slot is asked for here rather than planned before allocation because most functions never want one.