Skip to main content

lower_function

Function lower_function 

Source
pub fn lower_function(func: &Function) -> Result<LoweredFunction, LoweringError>
Expand description

Lower a complete Cranelift cl::Function to a LoweredFunction.

Walks the function in layout order, dispatches each instruction through the wave-1 per-family lowerers (arith → float → memory → cf → vector → conv), and assembles the resulting LoweredOps into per-block LoweredBlocks.

§Errors

§Notes

Block parameters of non-entry blocks are also seeded into the value-map up front — the wave-1 cf lowerings translate BlockCall args using the value map of the call site, but a downstream consumer that uses a block param as an operand needs that param to be in the map before its block is walked. We allocate ids for every block param in layout order before walking instructions.