code wiki / (root) / callee_save_test.nx

callee_save_test.nx

buildroot/runtime/callee_save_test.nx

8740 B216 linesdepth 6pulls 12 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

callee_save_test.nx -- exercise emit_function's save_mask > 0 path. Hand-crafts a mask that claims s0 + s3 were used by regalloc, then calls emit_function and verifies the asm output contains: * prologue saves for s0 and s3 * an epilogue label .L<fn>_epi: * epilogue restores + ld ra + addi + ret * the RETURN instruction emits `j .L<fn>_epi` instead of inline Confirms mask == 0 path stays inline-return (no epilogue label present in that output -- absence check).

dependencies 5 imports · 0 importers

syscalls.nx types.nx ir.nx outbuf.nx riscv.nx callee_save_test.nx

imports: syscalls.nxtypes.nxir.nxoutbuf.nxriscv.nx

imported by: nobody (leaf or entry point)

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

main ir_function_new sys_mmap ir_type_i64 alloc_type sys_mmap ↻ ir_block_new nx_assert_ptr sys_write nx_puts_err sys_write ↻ nx_assert sys_write ↻ nx_puts_err ↻ nx_assert_lt sys_write ↻ nx_puti_err sys_mmap ↻ sys_write ↻ nx_puts_err ↻ ir_const_i64 nx_assert_ptr ↻ nx_assert ↻ alloc_value nx_assert_ptr ↻ nx_assert ↻ nx_assert_lt ↻ ir_type_i64 ↻ emit_return_instr alloc_instr nx_assert_ptr ↻ nx_assert ↻ nx_assert_lt ↻ ir_type_i64 ↻ append_instr out_new sys_mmap ↻ emit_function sys_mmap ↻ loc_at

structs

none

consts

none

functions

19func buf_contains(buf: *u8, n: i64, needle: *u8) -> i64 {
called by 1: main
37func main() -> i64 {