CONSOLIDATION.md Phase 6. Both lived untracked in the project root -- on one
disk, backed up by nothing.
tools/ppc-manual/ 393 files, 3.7 MB. 455 instructions, 350 family pages,
598 mnemonics resolvable through index.json, plus the
generator that produced them.
tools/run-canary.sh the oracle launcher.
🔴 THE LAUNCHER WAS BROKEN IN TWO WAYS AND IS REWRITTEN, not copied:
* it pointed at `xenia-rs/sylpheed.iso`, a SYMLINK. Wine cannot resolve one
and says "path invalid", which reads as a corrupt image rather than a path
problem -- it has cost a session before. It now points at the real file and
warns if handed a symlink.
* it hardcoded one machine's absolute paths, and named `xenia-rs`, which this
consolidation retires. Now derived from the script's own location, with
SYLPH_CANARY_BIN / SYLPH_ISO overrides and a check that each exists.
The standing constraints are in its header where someone will read them: one
emulator at a time, Canary runs MUTED, and never judge a crash or a hang from
a Bash-launched run -- a SIGKILL that looked like the binary was the editor's
process supervisor.
⚠️ The manual's GENERATOR reads the xenia-rs source tree, which is going away.
Its decoder now lives here as crates/sylpheed-ppc, so the generator must be
repointed before it is run again. Recorded in the README rather than left for
someone to discover; the manual's content is checked in and regenerates from
nothing implicitly.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
76 lines
2.4 KiB
Python
76 lines
2.4 KiB
Python
"""
|
|
Scrapes xenia-canary's emit files for the location of each instruction's
|
|
semantic implementation function `InstrEmit_<mnem>`.
|
|
|
|
The files are:
|
|
src/xenia/cpu/ppc/ppc_emit_alu.cc (integer ALU)
|
|
src/xenia/cpu/ppc/ppc_emit_memory.cc (loads/stores/cache/sync)
|
|
src/xenia/cpu/ppc/ppc_emit_altivec.cc (VMX + VMX128)
|
|
src/xenia/cpu/ppc/ppc_emit_fpu.cc (floating-point)
|
|
src/xenia/cpu/ppc/ppc_emit_control.cc (branch/CR/SPR/syscall/trap)
|
|
|
|
Returns, for each mnemonic, the relative file path and the starting line
|
|
of the `int InstrEmit_<mnem>(...)` definition.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from pathlib import Path
|
|
import re
|
|
|
|
|
|
CXX_EMIT_FILES = [
|
|
"src/xenia/cpu/ppc/ppc_emit_alu.cc",
|
|
"src/xenia/cpu/ppc/ppc_emit_memory.cc",
|
|
"src/xenia/cpu/ppc/ppc_emit_altivec.cc",
|
|
"src/xenia/cpu/ppc/ppc_emit_fpu.cc",
|
|
"src/xenia/cpu/ppc/ppc_emit_control.cc",
|
|
]
|
|
|
|
|
|
@dataclass
|
|
class CxxRef:
|
|
mnem: str
|
|
emit_file: str | None = None # relative to xenia-canary/
|
|
emit_line: int | None = None
|
|
|
|
|
|
def _cxx_ident(mnem: str) -> str:
|
|
"""Canary maps '.' in the mnemonic to a trailing 'x' in the C++ symbol
|
|
(e.g. addic. → InstrEmit_addicx)."""
|
|
return mnem.replace(".", "x")
|
|
|
|
|
|
class CxxScraper:
|
|
def __init__(self, repo_root: Path):
|
|
self.canary_root = repo_root / "xenia-canary"
|
|
self._index: dict[str, tuple[str, int]] = {}
|
|
fn_pat = re.compile(r"^\s*int\s+InstrEmit_([A-Za-z_][A-Za-z0-9_]*)\s*\(")
|
|
for rel in CXX_EMIT_FILES:
|
|
path = self.canary_root / rel
|
|
if not path.is_file():
|
|
continue
|
|
for i, line in enumerate(path.read_text(encoding="utf-8").splitlines(), start=1):
|
|
m = fn_pat.match(line)
|
|
if not m:
|
|
continue
|
|
name = m.group(1)
|
|
self._index.setdefault(name, (rel, i))
|
|
|
|
def lookup(self, mnem: str) -> CxxRef:
|
|
ident = _cxx_ident(mnem)
|
|
hit = self._index.get(ident)
|
|
if hit is None:
|
|
return CxxRef(mnem=mnem)
|
|
return CxxRef(mnem=mnem, emit_file=hit[0], emit_line=hit[1])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
root = Path(__file__).resolve().parent.parent.parent
|
|
s = CxxScraper(root)
|
|
for m in ("addx", "addic.", "lwz", "bclrx", "mfspr", "stvx", "vaddfp",
|
|
"vaddfp128", "faddx", "lvsl"):
|
|
r = s.lookup(m)
|
|
print(f"{m:12s} {r.emit_file}:{r.emit_line}")
|