selfhost: migrate tool sources to directory packages

Build w6a and w6l from package-main directories and expose the wcc backend through a narrow package API so w6c and wwdump no longer import implementation files. Retarget the remaining load-bearing fixtures and example sources to directory packages; retain the one intentional flat compiler collision as an explicitly composed raw unit.
This commit is contained in:
2026-08-12 17:12:03 +09:00
parent 90f9d60291
commit c7d9dc92de
38 changed files with 197 additions and 252 deletions

View File

@@ -11,11 +11,6 @@ import memio;
// Split files. Bundler pulls these in transitively so consumers only
// need `use cgen;`. Order matters for the flat-bundle concat — utils
// first so cgenexpr/stmt/decl can reference helpers defined here.
import cgenutil;
import cgenexpr;
import cgenstmt;
import cgendecl;
// Only direct nkind.N_TNAME aliases are mapped; `type p = struct {...}`
// is handled by collectstructs.
@@ -1419,7 +1414,7 @@ fn preinternstrarray(c: *cgen, au: *syntax.tinfo, r: *syntax.node) void = {
// emitdatasection emits the DATA row in the same .s file. Running
// emitletdataw after emitdatasection would flip the (DATA strlits,
// DATAW lets) section order and break byte-identity.
export fn letpreintern(c: *cgen, file: *syntax.node) void = {
fn letpreintern(c: *cgen, file: *syntax.node) void = {
if (file == nil) { return; };
// #49: strlit labels allocated here (static-data initialisers) take
// the OWNING decl's module prefix, not the stale last-fn curmod.
@@ -4033,7 +4028,7 @@ fn argregname(i: i32) str = {
// fargregname — XMM scalar-float arg registers (SysV: X0..X7).
// Parallel to argregname / sysv_argregs; float args advance their
// own counter so int and float arg slots don't conflict.
export fn fargregname(i: i32) str = {
fn fargregname(i: i32) str = {
if (i == 0) { return "X0"; };
if (i == 1) { return "X1"; };
if (i == 2) { return "X2"; };