mirror of
https://github.com/Druthulu/BFM-decomp
synced 2026-09-26 21:36:06 -04:00
49fc465a51
§178 — SIX LEVERS FROM THE WAVE-P JOURNALS, each byte-proven and source-cited. Four wave-P repair
agents REFUTED the first pass's own diagnosis by dumping cc1 -dS/-da and reading gcc-2.7.2. The
meta-finding leads the section: "REGALLOC-PERM" is this project's most over-diagnosed class -- in
four functions the symptom was a register swap and the cause was in cse.c or sched.c, decided
BEFORE allocation, which is exactly why pins and statement order all failed.
A. The $0-add OPAQUE COPY defeats cse.c:826 make_regs_eqv (a PLUS is not a (set reg reg)), so the
parm pseudo keeps its register. MATCH on first compile; 3 of 5 pins then became dead weight.
B. A `return <const>` is a priority-1 hard-reg set that the BACKWARD list scheduler places FIRST
in the block, making hard $v0 live across a temp's range. Lever: goto a shared return tail.
C. birthing_insn_p (sched.c:2469) boosts only single-set destinations; splitting a 3-set temp
boosts the insn and drags its feeder chain down.
D. NEW IDIOM: a NARROW destination type blocks copy elision (SI->HI cannot be coalesced), so the
copy survives at its source position -- one type change worth ~20 instructions.
E. The ZERO-OFFSET ALIAS HOLE: memrefs_conflict_p's find_symbolic_term path is only reachable for
offset-0 fields, so an offset-0 store silently loses its dependence and floats.
F. MEM_IN_STRUCT_P asymmetry in true_dependence (sched.c:817): struct-varying vs scalar-fixed do
not depend. Struct-vs-scalar externs are a scheduling decision, not cosmetics.
G. Two modelling traps: `sw $a1,SYM($a0)` is ONE cc1 insn (the lui/addu/store triple is gas -G0
macro expansion, not cc1 output); and __asm__ __volatile__ with a memory clobber is a FULL
barrier that also sinks address chains.
Plus the exhaustion result: 2,240- and 5,040-variant statement-order sweeps moved nothing, because
the schedule was DAG-determined. When order does not matter, look for an alias or set-count
property, not a permutation.
§176j-2 — THE REPAIR PASS, MEASURED: 12 of 39 recovered / 579 ins, taking wave Q from 51 matches
(3,631 ins) to 64 (4,245). Closeness must be COUNTED, not read off the first differing index (my
first measurement reported six "closeness 0" drafts that were actually truncated).
§176k — two silent selector bugs: ranking gate groups by MEMBER COUNT collapses a wide band to the
smallest functions when the gate cost is per-slate (60 cards/2,604 ins chosen where 46/4,829 were
available); and a selector that globs its own output counts the previous attempt as spent (pool
106 -> 46). Any derive-from-disk rule must exclude the artifact it is about to produce.