Phase 9.78h: Stabilize MIR26 pipeline

- Add lib test to sync Core Instruction names with docs (INSTRUCTION_SET.md)
- Optimizer: Pass 0 normalizes legacy ops -> unified (TypeCheck/Cast->TypeOp,
  WeakNew/WeakLoad->WeakRef, BarrierRead/Write->Barrier)
- Optimizer: diagnostics for legacy ops; forbid via NYASH_OPT_DIAG_FORBID_LEGACY=1
- Runner: treat diagnostics (unlowered/legacy) as fatal when enabled
- Printer: unify legacy print style to TypeOp/WeakRef/Barrier
- Verifier: treat Phi inputs correctly (skip merge/dominance violations for Phi)
- Docs: update PHI_NORMALIZATION_PLAN; CURRENT_TASK: add risk note for op duplication
- Misc: PHI debugging/logs kept stable; snapshots still green
This commit is contained in:
Moe Charm
2025-08-26 06:30:01 +09:00
parent ff53fc90b1
commit 391a095f4c
10 changed files with 537 additions and 24 deletions

View File

@ -73,8 +73,10 @@ impl MirCompiler {
if self.optimize {
let mut optimizer = MirOptimizer::new();
let stats = optimizer.optimize_module(&mut module);
if std::env::var("NYASH_OPT_DIAG_FAIL").is_ok() && stats.diagnostics_reported > 0 {
return Err(format!("Diagnostic failure: {} unlowered type-op calls detected", stats.diagnostics_reported));
if (std::env::var("NYASH_OPT_DIAG_FAIL").is_ok()
|| std::env::var("NYASH_OPT_DIAG_FORBID_LEGACY").is_ok())
&& stats.diagnostics_reported > 0 {
return Err(format!("Diagnostic failure: {} issues detected (unlowered/legacy)", stats.diagnostics_reported));
}
}