Repository navigation
Conversation
A derived version like GC_2_0p2 and GC_2_5a: GameCube 2.0p2 (BFBB's model) plus four rules measured on the Japanese game code of the Final Fantasy Crystal Chronicles decompilation: - gather_instruction_alias keeps an access's own alias when other reaching definitions of its base register have none; - may_alias_scheduling orders a worst_case store before a load of a stack-passed parameter; - is_pointer_like_load treats const small-data globals like the others; - is_pointer_like_load treats a load of part of a small literal like a load of a whole one. Every other version builds byte-identically. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QmcpERTQ1WaRZ73F12eUis
Author
|
Closing in favour of PrimeDecomp/mwcc-tools#4, the same change ported to mwcc-tools' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
GC_2_0p3, a derived version likeGC_2_0p2(and #3'sGC_2_5a): BFBB's 2.0p2 plus four alias-analysis rules that the Japanese game code of the Final Fantasy Crystal Chronicles decompilation needs. The name "2.0p3" is provisional; happy to rename it (2.0p2f, 2.0f, ...). It is independent of #3; the two touchinclude/version.hand the README table, so whichever lands second needs a trivial rebase.What
include/version.h:VERSION_GC_2_0P3between 2.0p2 and 2.5 (2.5, 2.6 and 2.7 move up one index).config/GC_2_0p3/config.jsonhas"derived_from": "GC_2_0": the tooling resolves functions and the original executable one level deep, so a version derived from 2.0p2 itself would not buildsource-only; the description says it is 2.0p2-based.VERSION == VERSION_GC_2_0P2test also takes 2.0p3 (|| VERSION == VERSION_GC_2_0P3,!=likewise), and<= VERSION_GC_2_0P2becomes<= VERSION_GC_2_0P3(build 92, build date). So 2.0p3 is 2.0p2 everywhere else.Alias.c, 2.0p3 only:gather_instruction_alias: an access keeps its own alias when other reaching definitions of its base register have none (the loop that downgrades it toworst_caseis skipped);may_alias_scheduling: aworst_casestore (e.g. the prologue's register saves) and a load of a stack-passed parameter (VarInfoFlag_ParamArea) may alias;is_pointer_like_load: a direct small-data load counts even when the global isconst, and a load of part of a small@literal counts like a load of the whole one.static inline), a note under the table, and a section in the style of the BFBB one.Why / evidence
Measured on FFCC's Japanese game code: every unit the project builds with its Japanese compiler (268 units, 3081 functions), scored per function like FFCC's
report.json(objdiff 3.6.1). FFCC has so far used2.0p1k, BFBB's2.0p1gbinary-patch chain plus four FFCC patch steps.CMenuPcs::SetWorldParam: astatic constmember in.sdata2whose load stays below stores intothis;CChara::CModel::DrawFur: the copies of two 8-byte{0, 0}initialisers stay below the first array's stores).e3ns,c3a,dsl) were ported too, as experiments: an instrumented build shows they never change a scheduling answer on top of 2.0p2 (its floating-point-literal and small-data-store rules already cover them), so they are not included.#if VERSIONat a time (148 sites, 77 that build and change the executable), gains nothing. Removing 2.0p2's own rules one at a time loses functions for most of them (up to 218, for the small-data store rule); the floating-point-literalconst, copy propagation and small-data value-kill lines change nothing on FFCC. So FFCC Japan independently supports 2.0p2's model.Only FFCC has been measured. I could not rebuild BFBB (or Ratatouille) with 2.0p3 here; nothing changes for anyone who does not select it.
How tested (macOS arm64, LLVM 23)
python configure.py && ninja: all six versions build with clang;build/GC_{2_0,2_0p2,2_5,2_6,2_7}/clang/mwcceppc.exeare byte-identical to the same build ofmain.configure.py --mwcc:ninja build/GC_2_0/ok build/GC_2_5/ok build/GC_2_6/ok build/GC_2_7/okgives the same per-function results as before (compare.jsonfunctionsidentical), andbuild/GC_2_0p3/source-only/mwcceppc.exeandbuild/GC_2_0p2/source-only/mwcceppc.exelink ("4068 functions, all from the sources"). The MWCC-built source-only 2.0p3 gives the same objects as the clang build on all 274 Japanese FFCC units and the 8 sound units in each region.ruff format --check,ruff check,clang-format --dry-run -Werroron the changed C sources: clean.--matching/relink.ok,tools/verify.py's regressions baseline, the native Linux build (not available on arm64 macOS). files.decomp.dev failed here earlier, sobuild/compilerswas seeded from FFCC's copy of the same compiler bundle.FFCC will switch its Japanese game code and sound library to this build once it is merged and released; the FFCC side (draft) expects the release archive to carry
2.0p3/mwcceppc.exe.🤖 Generated with Claude Code
https://claude.ai/code/session_01QmcpERTQ1WaRZ73F12eUis