Files
hakorune/docs/development/current/main/phases/phase-277/P1-COMPLETION.md
tomoaki 939efbca9b feat(llvm/phi): Phase 277 P1.5 - structured error handling + import organization
## Changes
- P1.5.1: import整理 - debug_helper imports をモジュールトップへ移動
- P1.5.2: PhiStrictError 箱化 - エラーハンドリング構造化 (error_helpers.py新規)
- P1.5.3: wiring.py で PhiStrictError を使用 - 3箇所のエラーパターン統一

## Benefits
-  エラーメッセージ生成の一元化(SSOT化)
-  Python import 慣習準拠(関数内import削除)
-  エラーコンテキスト構造化(block_id/dst_vid/next_file)

## Testing
 strict=OFF - passes without errors
 strict=ON - passes without errors
 debug mode - verification connected and running

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-22 14:59:24 +09:00

1.7 KiB
Raw Blame History

Phase 277 P1: PHI順序検証強化fail-fast— 完了報告

Status: completed (2025-12-22)

Goal:

  • strict modeNYASH_LLVM_PHI_STRICT=1で、PHI順序/配線失敗を “原因箇所で止める” ようにする。

Scope:

  • LLVM harnessPython側のみ
  • 新しい環境変数は追加しないPhase 277 P2 で統合した3つのみ
  • JoinIR/Rust側のパイプライン統一は対象外根治は Phase 279

Changes

1) PHI created after terminator を strict で fail-fast

Target:

  • src/llvm_py/phi_wiring/wiring.pyensure_phi

Behavior:

  • strict=ON: RuntimeErrorblock_id/dst_vid を含む)
  • strict=OFF: warning のみ(既定挙動維持)

2) PHI incoming 解決の “silent fallback 0” を strict で禁止

Target:

  • src/llvm_py/phi_wiring/wiring.pywire_incomings

Behavior:

  • strict=ON: “incoming unresolved / type coercion failed” を RuntimeError
  • strict=OFF: 従来どおり 0 fallback互換維持

3) PHI ordering verifier を実行導線に接続

Target:

  • src/llvm_py/builders/function_lower.py
  • src/llvm_py/phi_placement.py::verify_phi_ordering

Behavior:

  • strict=ON: ordering NG を RuntimeErrorblock list を含む)
  • debug=ON: ordering のサマリを stderr に出力

Verification

  • strict=OFF: 既存 fixture が退行しないことを確認
  • strict=ON: 既存 fixture が正常系として PASS違反がないことを確認
  • debug=ON: verify の接続がログで確認できることを確認

Notes / Next

  • 旧 env var の後方互換性削除は Phase 278。
  • “2本のコンパイラ型伝播パイプライン差” 根治は Phase 279。