code wiki / (root) / regalloc_fpr_evict_test.nx

regalloc_fpr_evict_test.nx

buildroot/runtime/regalloc_fpr_evict_test.nx

2804 B78 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind gate/prooftopic regalloc
docsdependenciesstructsconstsfunctions

about

regalloc_fpr_evict_test.nx -- proves linear_scan_fpr's eviction policy fires. Companion smoke to regalloc_evict_test.nx. No public ir_const_f64 / ir_emit_fcast builders exist yet, so we construct Interval entries directly (linear_scan_fpr is leaf- callable: it takes intv + sorted_ids + n + mask + spill_start without touching the Function pointer). The 22-interval workload matches the FPR pool size of 21 (9 caller-clobbered ft-regs after the 3 scratch exclusions + 12 callee-saved fs-regs). Construction: intv[i].end is monotonically decreasing in i, so intv[0] has the LATEST end and intv[21] has the EARLIEST. All crosses_call=0 so the want_cs=0 path is exercised. When intv[21] arrives and the pool is empty, the eviction policy walks active[] backward and finds intv[0] (latest end, in an ft-reg). Since intv[0].end > intv[21].end, evict intv[0]; intv[21] gets that register. Assertion: intv[0].reg == -1 (spilled by eviction) intv[0].slot >= 0 (spill slot assigned) intv[21].reg >= FREG_BASE_T (got a float register)

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_types.nx nx_regalloc.nx regalloc_fpr_evict_test.nx

imports: nx_syscalls.nxnx_types.nxnx_regalloc.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap intv_at sort_by_start intv_at ↻ linear_scan_fpr sys_mmap ↻ intv_at ↻ expire intv_at ↻ pop_free is_callee_saved spill_furthest_active intv_at ↻ is_callee_saved ↻ active_insert intv_at ↻

structs

none

consts

28const N_FLOATS: i64 = 22 // 21 reg pool + 1 forces exactly 1 spill

functions

30func main() -> i64