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
LoweringError::UnsupportedOpcodewhen no wave-1 family matches an instruction. (Signature errors are also surfaced via this variant pending the W2.10LoweringError::Signature(#[from] ...)follow-up; they carry the signature error’sDisplaytext in theopfield.)LoweringError::UnsupportedTypewhen a memory-family op references a Cranelift typecrate::lowered_ir::LoweredTypecannot model.LoweringError::UndefinedValuewhen a memory-family op references a CraneliftValuenot yet in the value-map (driver bug or ill-formed input function).
§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.