Match and link lbdvd, textdraw, sobjlib, and mndatadel - #3025
Merged
Conversation
Report for GALE01 (2800533 - 9de1965)📈 Matched code: 85.32% (+0.16%, +6128 bytes) ✅ 6 new matches
📈 1 improvement in an unmatched item
|
Reorder the text-loop locals so MWCC preserves the target register webs while assigning stack objects in the original EABI frame order. The stack allocator walks lexical compiler objects before finalizing the outgoing-argument, local, linkage, and save bands. Keeping color_ptr in the text scope preserves r31, while moving the addressed GXColor into the inner loop assigns it local+0x8 (SP+0x10). The dead function-scope index carrier takes local+0x18 (SP+0x20); cursor and background colors remain at SP+0x0c, +0x14, and +0x18, with the final frame unchanged at 0x90. Verified DevText_Draw and DevText_DrawAll at 100% with GC/1.2.5n.
Promote TextDraw's split-unit globals so the original textlib.o can resolve the draw list, pool head, and menu allocator state from the reconstructed object. MWCC emits external zero-initialized objects in reverse declaration order, so declare the .sbss owners in reverse address order and retain the otherwise dead word at 0x804D6E3C as the second pool-head slot. This reproduces the original 0x38-byte small-BSS contribution and keeps the following allocator globals at 0x804D6E40, 0x804D6E44, 0x804D6E48, and 0x804D6E4C. The DevText_Draw match itself depends on MWCC's lexical stack-object walk: the addressed inner-loop GXColor owns local+0x8 (SP+0x10), the dead function-scope carrier owns local+0x18 (SP+0x20), and cursor/background objects retain SP+0x0c, +0x14, and +0x18 in the 0x90-byte EABI frame. Register-web allocation remains exact across all twelve functions. Verified all TextDraw functions at 100% and the full GALE01 DOL checksum.
Replace 0x18 bytes of dead named stack objects with two optimized-away by-value GXColor carriers. MWCC allocates each inline identity call as 0x0C bytes in the compiler-temporary stratum, so the pair moves the contiguous color-argument band from SP+0x1C..0x5C to the target SP+0x34..0x74 without emitting instructions or data. Inlining the center calculations, CI predicate, and z-color expression removes the corresponding lexical objects plus PAD_STACK. The object-slot cursor therefore remains 0x80, the final EABI frame remains 0xC8, and all GPR/FPR save locations and register webs stay unchanged. Verified every function and material section in sobjlib at 100% with GC/1.2.5n.
Promote sobjlib after verifying every function and material section at 100%. The final HSD_SObjLib_803A4A68 match preserves MWCC's 0x80-byte object-slot cursor and 0xC8 EABI frame by replacing 0x18 bytes of late lexical objects with 0x18 bytes of early compiler-generated by-value color temporaries. Verified the linked GALE01 DOL checksum.
Reshape mnDataDel_8024EA6C around an explicit table iterator and an inline animation consumer. Passing the animation frame by value lets MWCC retain the ABI f1 call-result carrier as the long-lived f31 web instead of materializing f1 -> f0 -> f31, while passing &sp18 preserves the target stack-slot ownership and repeated SP+0x18 reloads. The saved-f30 set and 0x48 EABI frame remain unchanged. Use a shared zero carrier and named byte cursor for mnDataDel_8024FE4C. This preserves the optimizer's slwi/add strength-reduction PCode and four-byte induction step while making the object-backed cursor web color to r24 rather than r25. Verified every function plus .text, .data, .bss, .sdata, and .sdata2 in mndatadel at 100% with GC/1.2.5n.
Enable mndatadel as a matching object after verifying all functions and material sections at 100%. The two sbss definitions are declared in reverse source order so MWCC emits mnDataDel_804D6C68 before mnDataDel_804D6C6C at the target addresses. Verified build/GALE01/main.dol against the target checksum.
MarkMcCaskey
marked this pull request as ready for review
August 9, 2026 01:37
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.
Working through some near matches from #2933. A lot of these are very hard but I got a few. I'll keep grinding on a few but the matches here can be merged whenever.
These cases are pushing the limits of what the tools can do but there's a clear path to being able to solve these problems.