//! TIR β LIR conversion pass.
//!
//! Transforms stack-based TIR into register-based LIR by:
//! 1. Simulating the TIR operand stack
//! 2. Assigning virtual registers for each stack position
//! 3. Flattening nested control flow (IfElse/IfOnly/Loop) into
//! labels + branches + jumps
//!
//! The algorithm is not yet implemented β only the types and helpers.
use ;
use crateTIROp;
/// Convert a sequence of TIR operations into LIR operations.
///
/// The conversion simulates the TIR operand stack, assigning a fresh
/// virtual register for each value produced. Nested structural control
/// flow (`IfElse`, `IfOnly`, `Loop`) is flattened into `Branch`, `Jump`,
/// and `LabelDef` operations.
///
/// # Example (conceptual)
///
/// ```text
/// TIR: LIR:
/// Push(10) β LoadImm(v0, 10)
/// Push(20) β LoadImm(v1, 20)
/// Add β Add(v2, v0, v1)
/// WriteIo(1) β WriteIo { src: v2, count: 1 }
/// ```
/// State for the TIRβLIR conversion pass.
///
/// Tracks the virtual register stack (simulating TIR's operand stack)
/// and generates fresh labels for flattened control flow.
pub
trident/src/ir/lir/convert.rs
Ο 0.0%