mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 10:19:47 -04:00
9123784a6a
Widen the leaf emitter from single-block to multi-block leaf functions, and add the mult/hi-lo arithmetic family. - Two-pass compile: pass 1 linearly scans to the jr $ra terminator, collecting PC-relative branch targets + delay-slot offsets and validating targets (in-range, 4-aligned, not landing on a delay slot); pass 2 emits an sljit label per target, captures each branch predicate into a saved reg (S1) BEFORE its delay slot, emits the delay slot, then the conditional jump, and binds jumps to labels at the end. - Branches: BEQ/BNE/BLEZ/BGTZ/BLTZ/BGEZ. - Arithmetic: MULT/MULTU (64-bit sign/zero-extend -> MUL -> split into hi/lo) + MFHI/MFLO/MTHI/MTLO. - Still deferred to the interpreter (abort): J/JAL/JALR, BLTZAL/BGEZAL, DIV/DIVU, LWL family, GTE/COP, jr-tables. Verified: sljit_emit_test.c extended with loops (backward branch), forward conditionals (max), and signed/unsigned mult — 40/40 pass. Full psx-runtime build clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>