code wiki / _hdl_build / nx_regalloc_exec_test.nx

nx_regalloc_exec_test.nx

buildroot/runtime/_hdl_build/nx_regalloc_exec_test.nx

5260 B112 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic regalloc
docsdependenciesstructsconstsfunctions

about

nx_regalloc_exec_test.nx -- PROVE register-allocated execution is 1:1 with the reference, on the race kernel's real arithmetic, over many inputs -- AND prove the check CATCHES a corrupted allocation. This is the gate that makes absorbing the allocator into codegen safe: any g1-style miscompile diverges here and fails. v0=INPUT c, v1=INPUT acc, v2=INPUT i v3=c*K, v4=v3+A, v5=v4>>31, v6=v4^v5(c2,live-out), v7=v6&M, v8=acc+v7(acc1,live-out), v9=i+1(i1,live-out), v10=v9<KK Known answer: allocation sound + 0 spills; ref==alloc for ALL random inputs; a corrupted allocation (two overlapping vregs aliased to one register) DIVERGES (the verifier catches the miscompile). exit 0.

dependencies 1 imports · 0 importers

nx_regalloc_interp.nx nx_regalloc_exec_test.nx

imports: nx_regalloc_interp.nx

imported by: nobody (leaf or entry point)

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

main re_puts ra_compute_last_use ra_linscan sys_mmap ra_validate sys_mmap ↻ re_emit re_puts ↻ re_rng ri_interp_ref ri_op_eval ri_interp_alloc ri_get ri_op_eval ↻

structs

none

consts

27const RE_N: i64 = 11
28const RE_NREG: i64 = 8
29const RE_TRIALS: i64 = 256
30const RE_K: i64 = 6364136223846793005
31const RE_A: i64 = 1442695040888963407
32const RE_M: i64 = 65535
33const RE_KK: i64 = 1000000

functions

16func re_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 2: re_emitmain
17func re_emit(name: *u8, v: i64) -> i64
called by 1: main calls 1: re_puts
35func re_rng(s: i64) -> i64 { return s * 6364136223846793005 + 1442695040888963407 }
called by 1: main
37func main() -> i64