Files
BFM-decomp/tools/permuter/compile.sh
T
Drew T 0abcd250ab feat(phase-24): T3 — permuter setup fixes (pins/GTE-asm, typedefs, -O0); flagship closed
- p16_permute.hide_asm: b64literal-pragma carrier for register pins + GTE __asm__ blocks.
  pycparser parses the pragma; decomp-permuter's process_pragmas decodes it back so cc1 sees
  the real pins/asm (regalloc steered, mvmva compiles). No submodule edit (reuses its own carrier).
- drop_preproc_and_scalar_typedefs: keep #define + custom struct/typedefs, drop only #include
  (fixes func_801412A8 'OTLINK undeclared'); +f32 typedef gap; make_base_c hides asm.
- compile.sh/compile_o0.sh: prepend .include "macro.inc" so GTE mvmva assembles (the real build
  gets it via include_asm.h, which base.c omits + -DPERMUTER disables). Byte-neutral for non-GTE.
  compile_o0.sh (-O0) auto-selected for _o0 targets.
- run_masked.py: expr_type->int fallback for hidden-pin vars -> 0 internal-permuter-failures
  (perm_split_assignment/perm_temp_for_expr no longer KeyError on pinned drafts).
- ALL 5 seeds parse+compile (base 4/110/36/52/77). FLAGSHIP func_80132784 (4/400) CLOSED to a
  masked-0 that match_one confirms MATCH (400 ins) -> .run/wave/func_80132784.win.c for T4 gate.
- no build-input changed (136/136 untouched)
2026-07-02 23:32:38 -06:00

21 lines
1.4 KiB
Bash

#!/bin/bash
# decomp-permuter compile command for BFM — the PINNED triple (docs/SETUP.md §5.4).
# Invoked by the permuter as: ./compile.sh input.c -o output.o
# input.c is preprocessed C (pycparser-parseable). This mirrors the Makefile c-rule
# exactly so permuter objects are build-faithful:
# cpp -> cc1 (gcc-2.7.2-psx) -> maspsx (--aspsx-version=2.56 --expand-div) -> mipsel-as
set -e -o pipefail
REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
IN="$1"; OUT="${3:-out.o}" # args as passed by permuter: input.c -o output.o
mipsel-linux-gnu-cpp -lang-c -I"$REPO/include" -undef -Wall -fno-builtin \
-Dmips -D__GNUC__=2 -D__OPTIMIZE__ -Dpsx -D_PSYQ -D_MIPSEL -D_LANGUAGE_C "$IN" \
| "$REPO/tools/bin/gcc-2.7.2-psx/cc1" -quiet -O2 -G0 -mips1 -mcpu=3000 -mgas \
-msoft-float -fgnu-linker \
| "$REPO/.venv/bin/python" "$REPO/tools/maspsx/maspsx.py" --aspsx-version=2.56 --expand-div \
| { printf '.include "macro.inc"\n'; cat; } \
| mipsel-linux-gnu-as -I"$REPO/include" -march=r3000 -mtune=r3000 -no-pad-sections -O1 -G0 -o "$OUT"
# .include "macro.inc" (found via -I"$REPO/include") pulls the GTE assembler macros (mvmva/…) so drafts
# with GTE inline asm assemble -- the real build gets these via include_asm.h, which the permuter's base.c
# omits (and -DPERMUTER disables). Pure macro defs -> byte-neutral for non-GTE functions. (Phase 24 T3)