Expand description
Float-family Cranelift→LoweredOp lowering (wave 1, task L2).
This module covers the float rows of the Cranelift → dialect-mir
mapping table:
| Cranelift op | Produces |
|---|---|
fadd | LoweredOp::AddF |
fsub | LoweredOp::SubF |
fmul | LoweredOp::MulF |
fdiv | LoweredOp::DivF |
fma | LoweredOp::Fma (a*b + c, single rounding) |
fneg | LoweredOp::FNeg |
fabs | LoweredOp::FAbs |
Only f32 / f64 scalars are accepted — f16, v128, or any other
Cranelift type returns None so the caller can fall back to a
different lowering family (lower_vector handles vector float ops in a
sibling module). Per-row Pliron equivalents and PTX semantics are
captured in the mapping table; this module purposely does not repeat
those notes here so the single source of truth stays in
[crate::pliron_dialect].
§Result-id allocation
Each successful lowering allocates a fresh LoweredValueId for the
op’s SSA result by reading *next_value_id and post-incrementing it.
Operand ids come from the caller-owned value_map which maps each
Cranelift cranelift_codegen::ir::Value to the already-assigned
LoweredValueId. Missing operands are a caller bug and panic — the
lowering walker must populate the map for every block parameter and
every prior instruction’s result before recursing into this family.
§Scope
- Pure: no side effects beyond
*next_value_idand readingfunc.dfg. Safe to call in any order; the caller controls block-walk ordering. - Stateless: no module-level statics; multiple lowerings can run
concurrently (one
&mut next_value_idper pass, as is the wave-1 convention shared withlower_arithetc.).
Functions§
- lower_
float_ inst - Try to lower one Cranelift instruction as a float-family op.