Compare commits

...

24 Commits

Author SHA1 Message Date
Devin AI
43412cda74 docs: cardseq cardThreadMain opt_propagation + plain-u32 probes (same dst-choice wall)
Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:57:01 +00:00
Devin AI
db7e2411c4 docs: tiInputForm create — packed-u16 decode + opt_propagation/shared-var probes
Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:55:10 +00:00
Devin AI
eabdccd0e0 decomp(tiInputForm): create — count as u16 low-half of u32 slot (150->73 diffs)
ButtonAnimations.count is a u16 field in the low half of the u32 data
slot (u16 _pad_0 high) — identical .data bytes, but the u16 web enters
MWCC's late numbering and lands at base's r22 home where every 32-bit
type pinned early. Plus declsearch-best decl order. No data regression
(matched_data 100).

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:55:06 +00:00
Devin AI
ff68f0759f revert(tiInputForm): u16 count experiment corrupts .data (27.5)
u16 field emits 00 08 not 00 00 00 08 in csButtonAnimations; u32 field +
u16 local adds clrlwi; declsearch order scores worse normalized. Restore
upstream baseline; mechanism documented in attempts doc.

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:47:27 +00:00
Devin AI
1e6808e62e docs: tiInputForm create u16-count web-class findings
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:46:00 +00:00
Devin AI
1d0e71e9d4 decomp(tiInputForm): create u16 count web class + decl order (120->88)
u16 ButtonAnimations::count field + u16 local gives count the late
allocator numbering base shows for the r22 home; residual 1 opcode
(lhz vs lwz: orig's count web is u32-typed yet allocator-late) + ~86
volatile/saved reg permutations (mriManager rows/selected/next web
family). declsearch order: selected/memory moved.

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:44:04 +00:00
devin
6ea8f7c565 docs: optimization_level pragma sweep negative on cardThreadMain + inputChar
Per-fn O1/O2/O3 identical to O4 on cardThreadMain (302 insns, same
rlwimi-in-place coalescer fold); inputChar worse at O2/O3 (134/133 insns
vs 137 base) and unit-level -O2 91 opcode diffs vs 57 at O4. Orig is
-O4,p; mixed-opt is not the residual explanation.

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:28 +00:00
Devin AI
aab5544fd4 decomp(tiString): inputChar mode-3 symbolic index decode + attempts docs
count = mTranslateMode - 3 produces the symbolic indexed stores (sthx)
matching base's mode-3 block shape (fuzzy 90.8 -> 94.34). Documented
undef-web decode and remaining coalescer walls.

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:28 +00:00
Devin AI
100e6799e0 iplCardSequence: command-first validity pack + wave-5 wall docs
Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:28 +00:00
Devin AI
e31a07dd1b docs: mr+rlwimi survival mechanism proven, no free source form
Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:28 +00:00
Devin AI
db245bc937 docs: struct2 wave-3 probes — intermediates collapse remat; or-order canonical
Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:28 +00:00
Devin AI
1bacdf5931 docs: pdm is_master_boot_sector residual = pure load-interleave tie
Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:28 +00:00
Devin AI
89cedd2cdc decomp(iplCardSequence): iconCount web-birth split solves remat (512/512)
s32 iconCount uninit decl + separate = 0 stmt splits the zero web's
birth, reproducing base's second li 0 remat for the icon-init stores.
Applied in updateCardIconAnimation and loadCardFileIcons. Also flips
sendValidityResponse to command-first reply packing (mr + rlwimi
@0xFF00 byte-insert).

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:28 +00:00
Devin AI
b77e122fe8 tiCandidateBox: AnimationFile pointer not const& (50->45)
Pointer form matches the p->pAnims[j] slot-reload idiom. Structural
decode probes: or-chain death-order locals (reassociates), loadCardFileIcons
remat variants — all ties documented.

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:28 +00:00
Devin AI
397d9799e3 doc: scheduling/opt pragma probes on leaf residual walls
scheduling off/601/602/603, schedule_twice, peephole off probed on idct,
pdm, cardSequence, candidateBox — none improve residuals (peephole off
inflates insn counts; or-operand order is coalescer-side, phi ties
upstream of scheduler).

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:28 +00:00
Devin AI
df8a4192d1 idct_block_var: clampU8 tail-ternary decode
Single-ternary `return v<0?0:255` produces base's mask fold
(srawi 0x1f + andc 0xff); two-stmt if/return emits branches.
Lumi 258->257, _Col 455->454 — exact insn counts. IRO probes
(0/1/2) regress; residuals are or-chain operand canonicalization
+ reg-renaming ties.

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:28 +00:00
Devin AI
2463589a0a doc: tiInputForm post-rebase states
Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:28 +00:00
Devin AI
a9fec2d2a7 tiInputForm: extern "C" const architecture decode
All source-level float literal uses now reference named scInputForm* SDA
objects (defs at EOF, extern decls up top => named refs, def-visible folds
to anonymous). Bulk literal->named swap across ~40 fns plus the full
.sdata2 def-order block decoded from base (ZeroF,640F,F32ConvertMagic...
F64ConvertMagic,15F). autoScroll: * HalfF not / TwoF. .sdata2 184->124B
(vs base 104). drawCursor residual ~11 (magic-operand naming + sched),
init signed-magic dedup anomaly documented.

Co-authored-by: coah80 <usernamecole7@gmail.com>
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:28 +00:00
Devin AI
bf1978a10f docs: iplCardSequence final residual
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:03 +00:00
Devin AI
2e307c9dd3 docs: iplCardSequence wave2
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:03 +00:00
Devin AI
9141e8a67e decomp(iplCardSequence): loadCardFileIcons indexed iconOffset access (509->511/512)
Hoisted iconOffsets pointer + named nextIcon index reproduces base's
slwi/lwzx/stwx indexed addressing where the direct member access folded
to immediate offsets. iconPalette pointer-arith equivalent.

Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:03 +00:00
Devin AI
d069e4d02b docs: iplCardSequence w1011 probes
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:03 +00:00
Devin AI
9fd1c9117b docs: tiInputForm w1011 probes
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:03 +00:00
Devin AI
226d9ef627 docs: tiCandidateBox w1011 attempts
Co-Authored-By: wch <usernamecole7@gmail.com>
2026-10-09 11:23:03 +00:00
10 changed files with 324 additions and 17 deletions

View File

@@ -10,10 +10,7 @@ static s32 clampU8(s32 value) {
if (inRange) {
return value;
}
if (value < 0) {
return 0;
}
return 255;
return value < 0 ? 0 : 255;
}
static s32 clampS8(s32 value) {

View File

@@ -412,18 +412,19 @@ extern "C" char scP_txtScrll_DOWN[] = "P_txtScrll_DOWN";
struct ButtonAnimations {
KeyType type;
const char* paneName;
u32 count;
u16 _pad_0;
u16 count;
const char* bindingName;
const InputFormAnimationFile* files[12];
};
ButtonAnimations csButtonAnimations[] = {
{KT_NormalButton, scP_txtScrll_UP, 8, NULL, {
{KT_NormalButton, scP_txtScrll_UP, 0, 8, NULL, {
&csAninationFile__Q29textinput9inputform[0], &csAninationFile__Q29textinput9inputform[1],
&csAninationFile__Q29textinput9inputform[2], &csAninationFile__Q29textinput9inputform[3],
&csAninationFile__Q29textinput9inputform[4], &csAninationFile__Q29textinput9inputform[5],
&csAninationFile__Q29textinput9inputform[6], &csAninationFile__Q29textinput9inputform[7]}},
{KT_NormalButton, scP_txtScrll_DOWN, 8, csScrollButtonAnimationTarget, {
{KT_NormalButton, scP_txtScrll_DOWN, 0, 8, csScrollButtonAnimationTarget, {
&csAninationFile__Q29textinput9inputform[0], &csAninationFile__Q29textinput9inputform[1],
&csAninationFile__Q29textinput9inputform[2], &csAninationFile__Q29textinput9inputform[3],
&csAninationFile__Q29textinput9inputform[4], &csAninationFile__Q29textinput9inputform[5],
@@ -1123,21 +1124,21 @@ inline void LayoutByNW4R::addButtonAnimation(MEMAllocator* allocator, nw4rmanage
}
void LayoutByNW4R::create(MEMAllocator* allocator, EditBuffer* editBuffer) {
Info_* listEnd;
const char* bindingName;
void* handlerMemory;
void* memory;
nw4r::lyt::Pane* pane;
const char* bindingName;
u32 buttonIndex;
u16 next;
Info_* rows;
u16 previous;
void* handlerMemory;
u32 count;
u16 count;
u16 animationIndex;
Info_* selected;
nw4rmanager::AnmPane* animationPane;
nw4r::lyt::TextBox* textBox;
u16 selectedIndex;
u32 buttonIndex;
Info_* listEnd;
mpAllocator = allocator;
textdrawer::Base::create(allocator);
mpString = static_cast<tistring::Decolated*>(editBuffer->mpString);

View File

@@ -198,9 +198,11 @@ void Decolated::inputChar(wchar_t ch) {
}
nonKana:
if (mTranslateMode == 3) {
CharacterOutput output(input);
output.append(ch);
count = output.finish();
count = mTranslateMode - 3;
input[count] = 0;
input[count] = ch;
count++;
input[count] = 0;
mKanaStream.mOutput[0] = 0;
} else {
count = 1;

View File

@@ -403,8 +403,8 @@ static inline void sendValidityResponse(u32 command, u32 valid) {
u32 value;
struct { u32 upper : 16; u32 valid : 8; u32 command : 8; } fields;
} reply;
reply.value = valid << 8;
reply.fields.command = command;
reply.value = command;
reply.fields.valid = valid;
OSSendMessage(&sThread->responses, (OSMessage)reply.value, OS_MESSAGE_BLOCK);
}
@@ -874,6 +874,8 @@ animationDone:
default:
break;
}
u32* iconOffsets = &sThread->icons[slot][fileNo].iconOffset[0];
s32 nextIcon = iconCount + 1;
if (iconCount < 7) {
sThread->icons[slot][fileNo].iconOffset[(u32)(iconCount + 1)] =
paletteSize + sThread->icons[slot][fileNo].iconOffset[iconCount];

View File

@@ -222,3 +222,117 @@ The final diff retains three exact command functions and the palette destination
correction and shared loop continuation. All remaining functions have at least
three new distinct attempts.
Shared headers and configure.py are unchanged. All data sections remain exact.
## w1011/struct2 probes
- cardThreadMain (301v301): pure reg-perms + one merge-order tie — base `mr r4,r19; rlwimi r4,r25,8` vs mine `rlwimi r23,r29,8; mr r4,r23`. Same count, ordering only.
- loadCardFileIcons (508v512, -4): base emits per-path `li r?,0; stb` zero-init pairs (dead zero-webs on each switch-case path — `bannerEnable=0` etc. re-materialize the zero instead of sharing), plus split `addis/addi` addr materialization + `lbz -1(r); stb 0(r)` adjacent-field copy where mine fuses. Structural decode incomplete.
- runCardMoveOrCopy (608v608?): not yet diffed.
## w1011/struct2 wave 2 (loadCardFileIcons 508->511/512)
- WIN: `s32 icon = 0` decl-init materializes a missing zero-web (+1).
- WIN: `u32* iconOffsets = &...iconOffset[0]` + `s32 nextIcon = iconCount + 1` → base's `slwi r,2; lwzx`/`stwx` indexed addressing (+2). Direct member index `iconOffset[iconCount+1]` folds to immediate-offset lwz/stw.
- Tried/reverted: `(u16)` index cast (513), `iconFmt[iconCount]=iconFmt[iconCount-1]` direct (510), u16* iconOffsets.
- Residual -1 + ~92 reg/order diffs: base materializes `&iconFmt[iconCount]` in one reg with `lbz -1(r); stb 0(r)` where every source form folds to `lbz -0x6fb5/stb -0x6fb4` field offsets (remat-vs-pin family).
## loadCardFileIcons residual -1 insn + coloring
- runCardMoveOrCopy (608v608): normalized-identical, pure coloring tie.
- loadCardFileIcons -1 = pinned-result phi: mine emits `mr r24,r3` (callee-pinned result web) after CARDGetSectorSize, base keeps result in r3-arrival and remats `li r3,0` in the error path. Same phi-coalescing tie family as attach_mount (pfrest) — no source lever found.
## w1011/struct2 wave-2 — web-birth decode (loadCardFileIcons SOLVED -1)
- `s32 iconCount; ... iconCount = 0;` — UNINIT DECL + SEPARATE ASSIGN
splits the zero web's birth so MWCC rematerializes a second `li 0` for
the icon-init stores (base's exact remat pattern). Applied in BOTH
updateCardIconAnimation and loadCardFileIcons: 511 -> 512 insns,
residual now 26 pure callee-renaming diffs (r31/r26 sThread,
r7/r4+r10/r6 record ptrs — coloring family).
NB: `static s32 iconCount` also produced 512 but emits dead object
`iconCount$16368` (forbidden, PR #973) — the lever is web-birth
timing, not storage class. Static variant rejected.
- cardThreadMain sendValidityResponse: `reply.value = command;
reply.fields.valid = valid;` produces base's `mr` + `rlwimi @0xFF00`
byte-insert order (vs `reply.value = valid<<8; fields.command=command`
which folds to `li 0x100 + rlwimi`). Residual 2 lines: in-place
`rlwimi r19` vs base `mr r4,r19; rlwimi r4` — same coalescer
dst-operand wall as the or-chain. `|=` folds to ori; bitfield-order
emits 2 rlwimi + stw.
## w1011/struct2 wave-3 — structural probes (icon-record intermediates)
- `IconState* rec = &sThread->icons[slot][fileNo]` + member accesses:
collapses fn to 408 insns — MWCC pins the pointer, kills the
per-use rematted add chains. The sThread->icons[slot][fileNo]
spelled-out form is load-bearing for the remat structure.
- `IconState (*icons)[CARD_MAX_FILE] = sThread->icons` array pointer:
collapses to 424 for the same reason. Named intermediates can't
reproduce base's pinned-products + remat-adds split.
- The 26 residual diffs are a pure callee-window swap: base pins the
icon-record PRODUCTS (slot*0x1FC0->r29, fileNo<<6->r30, masked addr
->r31) and params->r24-r26; mine pins params high. Chaitin color
ordering — documented tie.
- cardThreadMain: `OSMessage msg` arg-coalescing local, packed
`command | (valid<<8)` single expr (folds, 300), mask+or
`(v & ~0xFF00)|(valid<<8)` (rlwinm+ori split) — the mr+rlwimi
copy-vs-inplace residual (2 lines) is the coalescer dst-operand wall.
## w1011/struct2 wave-4 — mr+rlwimi mechanism PROVEN, no free source form
- `sThread->lastCommand = command;` after sendValidityResponse makes
command's web survive the pack → emits base's EXACT `mr r4,r19;
rlwimi r4,r25,8` (copy+insert, not in-place). Mechanism confirmed:
the rlwimi dst binds to a surviving operand's copy — but the store
costs +3 insns and base has no such store. Verified base's r19 dies
at the same point (reborn at 0xd58 case-0 reassign).
- `command & 0xFF` extract: folds (command provably masked) → in-place.
- `command | (valid<<8)`: single-expr fold to li/ori (300, -1).
- `(reply.value & ~0xFF00)|(valid<<8)`: rlwinm+ori split.
- Residual 2 lines = coalescer dst-operand choice with no source
lever that preserves insn count.
## w1011/struct2 wave-5 (post-rebase 10146c1b) — aoss/chansvm levers exhausted
- mr-cross-block mechanism (o2-aoss): copy survives iff its uses are in
other blocks. Verified base CFG: send block (0xd30) reached only from
case-10; `command` (r19) dies there, reborn in case-0 block at 0xd58.
No other case reads command → no legitimate later-block use exists;
all survival variants add insns. ~28 cumulative forms; wall stands.
- declsearch.py: 120 decl-orderings of cardThreadMain's decl block —
no improvement ((2,3) floor); operand-dst selection unaffected by
vreg numbering.
- New levers tried: __rlwinm identity (folds), int-union-member,
pointer-param pack helper, packValidity return-value, u8 params,
separate `response` temp, second reply.value use (+stw). All fold.
## cardThreadMain sendValidityResponse pack (wave-6)
Base: `mr r4,r19; rlwimi r4,r25,8,0x10,0x17` = `reply.value = command`
(copy into reply's own web, homed in arg-reg r4) then `reply.fields.valid =
valid` (bitfield-insert sourcing validState's own `li r25,1` web).
Ours: `rlwimi r19,r29,8,0x10,0x17; mr r4,r19` — MWCC coalesced reply.value
onto command's web (in-place insert on r19, sourced shared-1 r29) then copies
out. 2-line residual, same dst-operand/home-choice family as the or-chain
wall. Tried: `OSMessage reply = command | (valid<<8)` (folds to `ori` —
plain `|` canonicalizes, only bitfield-write emits rlwimi), fields-only
writes (3-insert chain), fn-scope reply union (still coalesces), comma/select
forms. `sThread->lastCommand = command` post-send DOES force `mr`+`rlwimi`
(making command's web survive) but costs +3 insns — mechanism proven, no
free source lever. Extra base `li r22,0` at 0x1040 = another remat-position
diff, same family.
## w1011/struct2 wave-7 — optimization_level pragma sweep (negative)
Per-fn `#pragma push` + `#pragma optimization_level N` + `#pragma pop`
(g-idct lever: Lumi was O3 inside an O4 unit) swept on cardThreadMain:
O1/O2/O3 all emit the identical 302-insn object — `rlwimi r19,r29` in-place
+ `mr r4,r19`. The coalescer's dst-operand fold is opt-level-invariant;
orig was built at the same -O4,p as ours. Mixed-opt is NOT the explanation
for the 2-line residual.
- wave-8 (opt_propagation): `#pragma opt_propagation off` scoped to
sendValidityResponse emitted `rlwimi r19,r29; mr` (same shape, operand
web shifted); scoped to cardThreadMain `rlwimi r19,r25; mr` (valid-web
operand now matches base) — but the union web still ALIASES to command's
dying web, so the insert stays in-place and the mr lands after. The
pragma does not touch union-storage aliasing (not copy-prop).
- Plain-u32 probe (`u32 reply = command; reply |= valid << 8`): folds to
`ori`, 300v301 — worse. Union form remains best (301v301, 2-line wall).

View File

@@ -0,0 +1,8 @@
## w1011/struct2 wave-2 verification
- is_master_boot_sector residual re-decoded: both objects emit the SAME
add tree ((b0 + b2<<16) + (b1<<8 + b3<<24)) for read_partition_u32 —
the + macro form is correct. All 7 residual lines are the load/shift
INTERLEAVE order (base loads b3,b2,b0 then shifts; mine b3,b2,b1).
Pure scheduler tie — scheduling pragmas previously probed, no lever.

View File

@@ -39,3 +39,19 @@ Measured trials:
- static initializer attempt 1: src 0x64 base 0x64 insns 25/25; diffs 0: []
- static initializer attempt 2: src 0x64 base 0x64 insns 25/25; diffs 22: [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]
- static initializer attempt 3: src 0x64 base 0x64 insns 25/25; diffs 0: []
## w1011/struct2 continuation (createAnmPane_)
- WIN: `const PaneToAnimation* p = &scCandidatePaneData.panes[i]` (pointer, not ref) → 215v216→216v216, fuzzy 92.89→98.91. Base reloads `p->pAnims[j]` through the array slot (lwz 0x20(r23)) per use; ref-form folded the element into a pinned reg.
- Regressions reverted: forceAddName moved into loop scope (118 ops), u32 j (86), int i (236), inline p->pAnims[j] at both uses (220), uninit-decl forms.
- Residual ~77 reg-name ops = pure coloring: base homes `p+j*4` slot web in r23, panes-base in r24, zero-web in r26; mine r30/r23/r25. Birth-order levers exhausted.
- `create` (352v352): insn-identical modulo branch targets; only `lfs f0,0(x)` anonymous .rodata ref offset differs (ties to .data granularity: mine names scPaneNameTable/scW_*/scN_* strings, base emits @9934-@9943 anonymous locals + base lacks mine's `__vt__textinput::gui::GUIComponent` weak emission; scCandidatePaneData 1676 vs 1664B).
- `CalcPaneLocate_` (435v435): byte-identical modulo relocs.
- loadCardFileIcons (iplCardSequence): 508v512 (-4): base emits extra `li r?,0; stb` zero-init pairs (per-path dead zero-webs) + separate addis/addi addr materialization where mine fuses; untreated structural gap.
## struct2 wave — structural decode probe
- `const AnimationFile* animation` (pointer) vs `const&` reference: 50->45
diff lines — pointer form closer (matches the p->pAnims[j] slot reload
idiom used for p itself). Committed.
- Hoisted `const AnimationFile* const* anims = p->pAnims` — no change (45).
- Remaining residual = callee-web coloring (same tie family).

View File

@@ -490,3 +490,77 @@ forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
GATE PASS
```
## w1011/struct2 probes (drawCursor/calcCursorPos)
- calcCursorPos (326 insns): already byte-identical modulo branch targets — report fuzzy 91.59 was reloc-scoring, no real residual.
- drawCursor (70v70): eval-order tie. Base completes `opacity = f32(muGlobalAlpha)/255.0f` fsubs+fdivs BEFORE loading GXColor R/G/B bytes; mine hoists the lbz loads above the fdivs. Moving `GXColor color` decl later regressed 68v70 (splits the loads differently). Kept baseline form; documented sched-order tie.
## struct2 wave 3 — extern "C" const architecture decoded
MWCC const-fold vs SDA rule for `extern "C" const` objects:
- Source ref folds to anonymous @NNNN pool object when the DEF (with init) is
VISIBLE at the use. Ref emits named SDA only when use sees extern decl and
def is later (defs at EOF + decls up top) => all value-uses named.
- Generated conversion magics (u32/s32->f32/f64) dedup into same-valued named
objects INCONSISTENTLY (autoScroll signed conv deduped to
scInputFormF32ConvertMagic; init + drawCursor unsigned convs did NOT) —
appears tied to .sdata2 emission order (anon pools emit in fn order; defs
at EOF emit last). Unresolved: how orig got every generated magic named.
- .sdata2 layout = emission order = DEF ORDER when defs precede fns.
Base order: ZeroF,640F,F32ConvertMagic(8B),OneF,HalfF,DegToFIdxF,150F,30F,
50F,10F,52F,TwoF,140F,90F,253F,20F,ColorR/G/B/A u8s,255F,127F,14592F,
[4B pad],F64ConvertMagic(8B),15F,[pad] — copied verbatim to EOF def block.
- ALL inline float literals in the file's fn bodies were swapped to named
refs (150F/30F/50F/10F/52F/140F/90F/253F/20F/15F/640F/255F/127F/14592F/
DegToFIdxF/OneF/HalfF/TwoF/ZeroF + Color*u8). Mass .sdata2 184->124B.
- Out-of-namespace uses (fns defined qualified-style at global scope) need
textinput::inputform:: qualification (~97 sites).
- drawCursor: plain static_cast<f32>(u8/u32) emits the right
lis/lbz/stw/stw/lfd/fsubs seq; residual = magic operand @NNNN vs named +
eval-order (~11 diff lines). Union-pun form (u32[2]+f64, subtract named
magic) gives named operand but fsub+frsp instead of fsubs — WORSE.
- autoScroll: orig used `* scInputFormHalfF` not `/ scInputFormTwoF`.
- textdrawer::Base() header ctor literals (mfVIWidth 640 etc) — named-const
via header gate tried+reverted (orig likely defines ctor in cpp; also
regressed sdata2). ctor anon pair {0,640} + GetTextColor {ffffff00,0}
remain anonymous.
- REMAINING: init @13881 (signed magic dedup didn't fire), ctor pair,
GetTextColor pair, drawCursor operand/scheduling, then 'create'.
Post-rebase states: Base::create(73i) normalized-identical (branch-target
artifacts only). LayoutByNW4R::create(357i) residual = callee-web rotation
(mine r20/r21/r28 vs base r23/r24/r30) + anonymous 0-operand pools; pure
coloring. Unit fuzzy 99.54, data 100.
## create residual wave (w1011 round 2) — 120 -> 88 normalized diffs
- `u16` ButtonAnimations::count field + `u16 count` local lands count in base's r22
home (late allocator pin). u32/int/s32/short all keep the early pin (~150). Mechanism
is likely the u16 narrowing producing a secondary codegen-ordered temp.
- Remaining 1 structural diff: `lhz` vs base `lwz` at the count load — orig's web is
u32-typed (lwz) yet allocator-late. u32-field+u16-local adds a clrlwi (worse).
- declsearch on the 15-local decl block: moving `Info_* selected` up (2nd) and
`void* memory` down (11th) fixed 3 renames; converged after 80 evals.
- Pointer-param `addButtonAnimations` helper (count load as IRO temp): lands r30
(IRO temps number reverse-creation — late inline = LOW temp no. = early pin).
`button->count` bound inside helper reloads per-iter (fIsPtrOp, no LICM hoist).
- bindingName/count direct member uses, comma decl, split-web `count=0;count=...`,
stmt-order swaps on previous/next/selectedIndex: all no-ops or worse.
- Residual ~86 renames: mriManager rows/selected/previous/next expression-temp band
(r4-r8 volatile order) + residual saved-reg permutations — same tie family.
- REVERTED: the u16-field form shrinks csButtonAnimations .data bytes (00 08 vs
00 00 00 08) — unit matched_data 100 -> 27.5. u32 field + u16 local emits
lhz+clrlwi (171). declsearch order alone scored worse under normalized diff
(147 vs 150 baseline). Net: create restored to upstream baseline; the
u16-numbering mechanism is documented but no usable form found — count's web
must be u32-typed AND allocator-late, unproducible so far.
- SOLVED (partial): count as `u16` field in the LOW half of the u32 slot
(`u16 _pad_0; u16 count;` + `0, 8` initializers) — identical .data bytes,
u16 web lands at base r22. + declsearch order = 73 normalized diffs.
`#pragma opt_propagation off` scoped to create: 176 (regresses).
Shared `memory` var across the two allocs: 150 (no-op — single-use defs
forward-substitute either way). Residual: rows-copy loop expression-temp
orderings (r5-r8 numbering) + callee-home perms (r18/r20 vs r25/r27) —
same volatile-temp tie family as before.

View File

@@ -28,3 +28,53 @@ call result, or a non-foldable form). Dead `cmplwi r4,0xa` matches the documente
dead-compare-fossil family (both-branch merge). Also: count lands in r29 via
clrlwi (u16) — count is i.
Unresolved: what source produces symbolic-index stores + dead compare.
# tiString attempts
## inputChar mode-3 indexed block (upstream main @10146c1b)
- Base emits `li r6,0; sth r6,0x10; slwi r0,r6,1; addi r5,r1,0x10;
sthx r4,r5,r0; addi r6,r6,1; mr r4,r5; li r5,0; slwi r0,r6,1;
clrlwi r29,r6; sthx r5,r4,r0; sth r5,0x42` — input[count] INDEXED
stores with count a register-born (li+addi) SYMBOLIC web. MWCC folds
the FIRST store to immediate offset (count=0 proven) but keeps later
stores indexed — index var must be non-const-folded.
- Decode: orig's mode-3 path is NOT CharacterOutput (inlines to folded
immediates). It's `count=0; input[count]=0; input[count++]=ch;
input[count]=0; count` — semantics confirmed; the wall is making
count's web symbolic.
- ~13 forms: u16/u32/int index locals (all const-propped), struct-with-
inline-buffer member index (stays MEMORY: real stw/lwz — too far),
CharacterOutput direct + pointer-call (fully promotes + folds),
post-inc index (folds). Register-born symbolic web needs phi/call/
member-load provenance — none found that emits base's li-born shape.
## inputChar mode-3 wave-2 (fuzzy 90.8 -> 94.34, still <100)
PROVEN mechanism — the symbolic index web: base's `slwi r0,r6,1` reads a web
with NO definition instruction anywhere in the function. An UNINITIALIZED local
(`s32 idx;`) produces exactly that shape: MWCC emits indexed `slwi`+`sthx`
reading the undef web's assigned register — the #1270 retail-uninit-read
exception applies (the `li r6,0` writes a DIFFERENT web — the store operand).
Committed form uses `count = mTranslateMode - 3` instead (fuzzy 94.34, better
than undef-idx 92.61 — the undef web homes to r3 and breaks coloring; with
`u32 inputIndex` shared with the kana loop it pins r28 = worse). Undef-idx
variants give the most faithful structure: `sth`-first-store + indexed sthx +
`clrlwi r29,idx-web,0x10` tail all match; only reg home (r3 vs r6) and
in-place `addi r6,r6,1` vs new-web `addi r5,r3,1` differ.
Wall boundary (~30 forms): `li`-born + symbolic is unproduced —
`x-x`, `x&0`, `ch-ch`, `input-input`, `x*0`, comma-exprs, `?:`, empty-ifs,
phi arms all either fold to `cmpwi`-path or emit real insns (addi/subf/xori).
Dead `cmplwi r4,0xa` unproduced (comma/`||`/empty-if all drop it). `mr r4,r5`
ptr copy + `li r5,0` zero web = same coalescer home-choice family as
cardThreadMain. BEST KEPT: `count = mTranslateMode - 3; input[count] = 0;
input[count] = ch; count++; input[count] = 0;` with `u16 count` (94.34).
## wave-3 — optimization_level pragma sweep (negative)
Per-fn `#pragma optimization_level 2|3` and whole-unit `-O2,p` probed on
inputChar (g-idct lever): per-fn O2 → 134 insns, O3 → 133 (base 137);
unit-level O2 → 133 insns / 91 opcode diffs (vs 57 at O4). Lower opt
emits the same symbolic-index structure, just worse — orig is -O4,p.
The undef-web birth (`slwi r0,r6,1` on a def-less web) is not an
opt-level artifact.

View File

@@ -644,3 +644,46 @@ forbidden patterns added (net, per file): 0
readability warnings (net, per file; must be 0 in the final result): 0
GATE PASS
```
## struct2 wave — idct_block_var (buffer/)
- IRO probe (directive): ppc_iro_level 0/1/2 all REGRESS Lumi (IRO-0 emits
branchy clamp tails — +29 insns 286v257). Reverted. This fn needs the
DEFAULT level: its residual was fold-canonicalization, not over-folding.
- clampU8 tail: `if (v<0) return 0; return 255;` (2 stmts) emits branchy
cmpwi/bge/li/b/li; single `return v<0?0:255;` emits base's mask fold
(srawi .1f + andc 0xff). Single-ternary decode: Lumi 258->257 (exact),
_Col 455->454 (exact). Both insn counts now match.
- Residual: or-chain operand order `or ACC,ACC,NEW` vs base `or ACC,NEW,ACC`
— coalescer canonicalizes operand order regardless of source order
(reversed `x | acBits` tried, unchanged) — allocator-side coalescing
choice, not source-reachable (same wall as texturecvtr or-chains).
Remaining diffs are pure reg-renaming in the IDCT butterfly.
## Scheduling/opt pragma probes (directive wave)
- MWCC scheduling pragmas probed per-fn via push/pop on the or-chain /
scheduling-interleave / coloring residuals:
- idct Lumi: `scheduling off` 38->33 diff lines but 257 insns kept and
serializes loads (not closer per-insn); `scheduling 601/602/603` 35;
`schedule_twice` 38; `peephole off` 18 lines BUT +23 insns (280v257,
breaks rlwinm. fusion) — all net regressions or ties.
- pdm is_master_boot_sector: baseline 7; `schedule_twice` 7 (same);
`scheduling 601` 16; `scheduling off` 31; `peephole off` 22 — all worse.
- cardSequence loadCardFileIcons (-1 phi tie): `scheduling off`,
`schedule_twice`, `peephole off` all 511 insns unchanged — pragma does
not reach pinned-result phi-coalescing.
- tiCandidateBox createAnmPane_: baseline 50; `schedule_twice` 50;
`scheduling off` 66; `peephole off` 54 — coloring tie stands.
- CONCLUSION: or-operand order (or ACC,NEW,ACC vs ACC,ACC,NEW) is set by
the coalescer's dst-operand choice, upstream of the scheduler; phi
ties are upstream of both. No MWCC scheduling/peephole pragma reaches
these — source-level and pragma levers exhausted on these walls.
## w1011/struct2 wave-3 — or-chain serial probes
- `acBits = acBits | x` (explicit self-assign) produces a SERIAL
or-chain (was pairs-tree) — but operand order still canonicalizes
to `or ACC,ACC,NEW` regardless of textual `x | acBits` vs
`acBits | x`. Normalized diff unchanged (25). Committed `|=`
kept — identical score, cleaner source.