Skip to main content

run

Function run 

Source
pub fn run(func: &mut Func, env: &Env) -> Allocation
Expand description

Allocates registers for a function the way -O0 asks for, rewriting it as it goes.

This is the shape spec/10-backend.md section 10.4 gives an allocator: a function and the registers it may use in, an assignment and the moves that make it true out. The backtracking allocator will answer the same question the same way.

ยงPanics

Panics on a function the caller was told not to hand it, which is one with a critical edge, one whose entry block has parameters, or one wanting more scratch registers at an instruction than the environment holds back. See rewrite::rewrite.

In a debug build it also panics on an assignment check finds a problem with, which is a bug in this crate rather than anything the caller did. spec/10-backend.md section 10.4 asks for that check in debug and CI builds, and it runs before the rewrite because the assignment is the decision and the rewrite only writes it down.