Skip to main content

cost

Function cost 

Source
pub fn cost(func: &Func, order: &Order, assignment: &Assignment) -> u128
Expand description

What an assignment is expected to cost a function, in instructions each counted by how often its block runs.

A value on the stack costs a load or a store every time it is read or written. A two address instruction whose answer is not where its source is costs the copy between them, and so does a block parameter that is not where the value passed to it is. Moves the machine needs whatever the assignment, like those into the registers a call insists on, are left out, since they are the same for any answer.

ยงPanics

Panics on a function with more values than a register number can name, as Reg::virtual_reg does.