code wiki / (root) / nx_opt_eqsat_wire_gate.nx

nx_opt_eqsat_wire_gate.nx

buildroot/runtime/nx_opt_eqsat_wire_gate.nx

6789 B140 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic opt
docsdependenciesstructsconstsfunctions

about

nx_opt_eqsat_wire_gate.nx -- GATE for LN8 "equality saturation CONSUMED by the backend" (lang.plan rung LN8, symbol opt_eqsat_pass). nx_opt_eqsat_pass_gate proves the PASS on an in-memory IR fixture; THIS gate proves the SHIPPING PIPELINE runs it: the toolchain compiler (argv[1], default the live builder) is driven over runtime/nx_eqsat_wire_probe.nx with --ir-dump and the post-opt IR is read back. Observables (both measured 2026-08-23 on the first wired build, neither assumed): * ewp_xor_self (x ^ x, x a runtime param): the xor folds to the constant 0 through the e-graph and is then dead-code-eliminated, so the dump carries NO `op=12` line whose operands are the SAME value id; the emitted asm goes from `xorq %rcx, %rax` to `movabsq $0, %rax`. * ewp_xor_pair (x ^ y, distinct params): the xor SURVIVES -- exactly one `op=12` line with o0 != o1. This is the anti-vacuity control: a pipeline that deleted every xor would fail it. * Behaviour is unchanged: the probe exits argc+3 with and without the pass (exit 4 unarg'd). A pre-LN8 compiler (no pass in opt_run) fails the fold tooth and keeps both xors; a pre-LN8 compiler without --ir-dump fails the dump-present tooth too -- both are the bite, attributable. Driver = nx_ccgate_lib. Data captures in /tmp/nxeqw/, RUNNABLES under _build/ (NAS /tmp noexec). Usage: nx_opt_eqsat_wire_gate [compiler_elf] (CWD = the tree root, like nx_cc_equiv_gate) license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_ccgate_lib.nx nx_opt_eqsat_wire_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_ccgate_lib.nx

imported by: nobody (leaf or entry point)

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

main ccg_anchor_root sys_openat_rd sys_close sys_chdir sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_mkdir ccg_pid ccg_path sys_mmap ↻ gv_ctr sys_mmap ↻ gv_head gv_puts sys_write ↻ ccg_build ccg_compile sys_mmap ↻ sys_openat_wr ccg_run sys_fork sys_dup3 sys_mmap ↻ sys_execve sys_exit ↻ sys_wait4

structs

none

consts

25const EWG_EXPECT_EXIT: i64 = 4

functions

30func ewg_count_xor(path: *u8, out: *i64) -> i64
62func ewg_field(b: *u8, lo: i64, hi: i64, key: *u8, kl: i64) -> i64
called by 1: ewg_count_xor calls 1: ccg_mem_has
86func main(argc: i64, argv: *i64) -> i64