Skip to main content

linear_scan_assignment

Function linear_scan_assignment 

Source
pub fn linear_scan_assignment(spec: &RegSpec) -> Vec<Option<usize>>
Expand description

A deterministic linear-scan assignment: variable index i → the physical register it is given, or None if linear-scan must spill it (no register was free when it became live). This is the data the animated view replays — each variable becomes one bar that lights up in its register’s lane while it is live. Re-checkable via is_valid_linear_scan. It spills nothing exactly when the block fits the budget (peak pressure ≤ registers), so it agrees with the certified allocate decision while also showing which value gets evicted when it does not.