nx_compile_x86.nx
buildroot/runtime/nx_compile_x86.nx
about
nx_compile_x86.nx -- source-file driver for the NishiLang x86_64 backend.
Reads .nx source on stdin (pre-expanded; imports already inlined),
runs:
lex_source -> parse_module -> opt_run (per function) ->
x86ctx_emit_module
and writes the AT&T x86_64 asm to stdout.
The bash wrapper (bench/nx_compile_x86.sh) drives the source ->
native ELF pipeline:
nxc2.exe --target asm runtime/nx_compile_x86.nx (build driver)
riscv64-as + ld -> nx_compile_x86.elf
cat source.nx | qemu-riscv64-static nx_compile_x86.elf
-> x86_64 asm on stdout
gcc -nostdlib -static asm -o native.elf
run natively
Per cardinal feedback-no-nxc2-c-extension-only-nishilang-forward:
this driver is the NishiLang counterpart of nxc2.exe's --target
x86_64 path. No C-side modifications.
nx_safety_envelope:
intended_use: "Compile a .nx source (pre-import-expanded)
to native x86_64 SysV asm via the IR-driven
x86_64 backend."
sil_target: SIL3
asil_target: QM
dal_target: DAL B
iec_62304_class: NONE
evidence: [no_floating_point,
bounded_stdin_read_per_jpl_rule_2,
sealed_pipeline_verdict_codes,
opt_optional_via_env]
hazard_register: [bug-tape-source-exceeds-cap-silently-truncated,
bug-tape-opcode-not-yet-wired-passes-through]
residual_risk: "Hard 2 MiB source cap; pasting larger files
truncates silently. Streaming follow-up
when needed."
verdict: NOT_YET_EVALUATED
dependencies 14 imports · 0 importers
diagram shows first 10 each side; +4 more imports, +0 more importers in the complete lists below.
imports: nx_syscalls.nxnx_types.nxnx_lex_kinds.nxnx_outbuf.nxnx_ir.nxnx_tokenizer.nxnx_parse.nxnx_opt.nxnx_x86_64.nxnx_ir_dump.nxnx_ir_validate.nxnx_x86_regalloc.nxnx_x86_64_ctx.nxnx_import.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 56 | const NX_MAGIC_4096: i64 = 4096 |
| 57 | const NX_MAGIC_262144: i64 = 262144 |
| 59 | const NX_COMPILE_X86_SRC_CAP: i64 = 2097152 // 2 MiB |
| 60 | const NX_COMPILE_X86_OUT_CAP: i64 = 16777216 // 16 MiB |
| 61 | const NX_COMPILE_X86_EXPAND_CAP: i64 = 4194304 // 4 MiB import-expanded |
| 63 | const NX_COMPILE_X86_OK: i64 = 0 |
| 64 | const NX_COMPILE_X86_EMPTY: i64 = 1 |
| 65 | const NX_COMPILE_X86_LEX_FAIL: i64 = 2 |
| 66 | const NX_COMPILE_X86_PARSE_FAIL: i64 = 3 |
| 67 | const NX_COMPILE_X86_NO_FN: i64 = 4 |
functions
| 69 | func nxcx_read_stdin(buf: *u8, cap: i64) -> i64 |
| 92 | func nxcx_log(msg: *u8, n: i64) -> i64 |
| 96 | func main(argc: i64, argv: *i64) -> i64 |