phase-36: alloc_table prints gcc's truncated integer priority and flags ties (global.c:594-607) — e14's integer-tie closes were invisible in the float column; e14 banked 4 (ov_SC06_010)

This commit is contained in:
Drew T
2026-09-11 02:29:04 -06:00
parent af963cbf81
commit 8caf6ba259
2 changed files with 8 additions and 2 deletions
+1
View File
@@ -1820,6 +1820,7 @@ CLAIM, not a fact — two were refuted on bytes on 2026-09-10.**
classes the pass has judged and not closed. An ALL-families pass (`--families R2 … R26`, `-j 26`) costs ~1.8 s per `--try`
and 100–370 candidates per head class; it closed an R12 class in its first minute, so re-running the old families on a
moved tree is not redundant.
- **`tools/alloc_table.py` prints the INTEGER priority (S104)** — `global.c:594-603` stores it in a `register int` (truncated) and breaks ties by allocno number (`:607`); equal integers are flagged `TIE`. The float column hid e12/e14's closes (245.6 vs 245.2). Known-true: e14's `func_8017BEBC` lever-free dumps show the two `&g.sz` pseudos at 245 TIE.
- **`delever_pack.related_bodies` for main (S104):** main's units are `src/800*.c`, not `src/main/` — the search now falls back to the target TU's directory; every main pack's `related.txt` had been empty (e3: the answers were same-TU siblings sharing a global). Known-true: `func_80036FB0`'s pack now lists 7 bodies sharing `D_8006AEE8`/`D_80078F10`.
- **Marked ordinary-C fakes (S104, Drew's ruling (a)):** a `// !FAKE:` on a `do { … } while (0)` line or a `!FAKE:
do-while|dead-init` marker is a KEPT fake (sotn-decomp's STYLE.md rule), not an orphan and not a lever —
+7 -2
View File
@@ -77,12 +77,15 @@ def main():
order = [int(x) for x in mo.group(2).split()]
rows = []
for n, r in regs.items():
pri = (math.floor(math.log2(r["refs"])) * r["refs"] / r["live"]) * 10000 if r["refs"] > 0 and r["live"] > 0 else 0
# global.c:594-603 stores the priority in a `register int` — TRUNCATED — and breaks a tie by allocno number (:607).
# S104 e12/e14: two closes hinged on ties the old float column hid (245.6 vs 245.2 are both 245).
pri = int((math.floor(math.log2(r["refs"])) * r["refs"] / r["live"]) * 10000) if r["refs"] > 0 and r["live"] > 0 else 0
rows.append((pri, n, r))
rows.sort(key=lambda x: (-x[0], x[1]))
print(f"alloc_table {fn} ({tag}): {len(regs)} pseudo(s) in the .lreg table"
+ (f"; .greg order: {' '.join(str(x) for x in order)}" if order else "; .greg printed no order line"))
print(f" {'pseudo':>7} {'hard':>5} {'pri':>10} {'refs':>5} {'live':>5} {'blk':>5} prefs / notes")
tied = {p_ for p_, c in __import__("collections").Counter(p_ for p_, _n, _r in rows).items() if c > 1 and p_ > 0}
for pri, n, r in rows:
h = hard.get(n)
hn = NAMES.get(h, str(h)) if h is not None else "-"
@@ -93,7 +96,9 @@ def main():
hardconf = [NAMES[x] for x in conf[n] if x in NAMES] # the HARD regs it may not take
if hardconf:
note = f"conflicts {','.join(hardconf)} " + note
print(f" r{n:<6} {hn:>5} {pri:10.1f} {r['refs']:5d} {r['live']:5d} {str(r['block']):>5} {note}")
if pri in tied:
note = "TIE (lower allocno wins, global.c:607) " + note
print(f" r{n:<6} {hn:>5} {pri:10d} {r['refs']:5d} {r['live']:5d} {str(r['block']):>5} {note}")
# R32: the order line over-approximates the allocnos; anything it names that this table lacks is a SILENT GAP
missing = [x for x in order if x not in regs]
if missing: