mirror of
https://github.com/Druthulu/BFM-decomp
synced 2026-09-26 13:33:34 -04:00
bfbcb86b3d
Distilled from ~100 agent-drafted functions gated whole-binary across three waves; each idiom CLOSED a specific residual, none is a hypothesis. CODEGEN: 1. UNSIGNED switch index => pure equality chain — for an unsigned index the case-0 leaf satisfies node_has_low_bound (0==TYPE_MIN) so emit_case_nodes drops the range test entirely. 2. ARRAY_REF vs INDIRECT_REF changes ALIASING hence SCHEDULING — a[i] sets MEM_IN_STRUCT_P and true_dependence() drops the dependence vs a constant-address store, so the load hoists. A '4-ins scheduling residual' that is really a type-form choice. 3. A constant store with the top bit set in the STORED width needs an UNSIGNED destination (u16 -> ori via force_fit_type; s16 -> sign-extended fold -> addiu). 4. The list scheduler PRESERVES relative order of disambiguable stores — a store written late SINKS. Move it earlier in SOURCE. Closed 9 mismatches with no permuter. 5. A short loop counter blocks strength reduction on array indexing; the original walked pointers. 6. Frame size off by a constant => DEAD LOCALS (every diff is an sp displacement of one delta). INTEGRATION (what decides whether a byte-correct draft BANKS): 7. match_one MATCH != a bank (83%/93%/71%->89% survived the gate across the three waves). 8. cc1 reports only the FIRST conflict — grep the whole TU for every symbol in one pass (one draft had SIX bad prototypes, two BELOW the splice point). 9. An INTERIOR address has no symbol (D_801DA0F0 is +0x6C into D_801DA084) -> undefined reference at LINK, not a compile error. 10. Never redeclare a C-library name (one TU declares memcpy THREE times, incompatibly). WAVE SHAPE: two lanes; the reconcile lane is 12/12 across two waves because the orchestrator captures the compiler error BEFORE the fan-out. Promote wave-N's Opus discoveries into wave-N+1's cheap-tier prompt (83->93%). Paste args from a DERIVED manifest. If N reconcile targets share ONE TU, forbid agent builds. An agent that rejects your premise is working correctly.