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>
This commit is contained in:
@ -0,0 +1,58 @@
|
||||
# Phase 277 P1: PHI順序検証強化(fail-fast)— 完了報告
|
||||
|
||||
Status: ✅ completed (2025-12-22)
|
||||
|
||||
Goal:
|
||||
- strict mode(`NYASH_LLVM_PHI_STRICT=1`)で、PHI順序/配線失敗を “原因箇所で止める” ようにする。
|
||||
|
||||
Scope:
|
||||
- LLVM harness(Python)側のみ
|
||||
- 新しい環境変数は追加しない(Phase 277 P2 で統合した3つのみ)
|
||||
- JoinIR/Rust側のパイプライン統一は対象外(根治は Phase 279)
|
||||
|
||||
---
|
||||
|
||||
## Changes
|
||||
|
||||
### 1) PHI created after terminator を strict で fail-fast
|
||||
|
||||
Target:
|
||||
- `src/llvm_py/phi_wiring/wiring.py`(`ensure_phi`)
|
||||
|
||||
Behavior:
|
||||
- strict=ON: RuntimeError(block_id/dst_vid を含む)
|
||||
- strict=OFF: warning のみ(既定挙動維持)
|
||||
|
||||
### 2) PHI incoming 解決の “silent fallback 0” を strict で禁止
|
||||
|
||||
Target:
|
||||
- `src/llvm_py/phi_wiring/wiring.py`(`wire_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 を RuntimeError(block 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。
|
||||
@ -29,7 +29,7 @@ Phase 275/276で完了したFloat型PHI対応・型取得SSOT化の後続改善
|
||||
- 指示書(Claude Code):
|
||||
- `docs/development/current/main/phases/phase-277/P0-INSTRUCTIONS.md`
|
||||
|
||||
### Phase 277 P1: PHI順序検証強化(予定)
|
||||
### Phase 277 P1: PHI順序検証強化(fail-fast) ✅
|
||||
|
||||
- 目的: PHI命令の配置順序検証を強化
|
||||
- 内容:
|
||||
@ -40,6 +40,8 @@ Phase 275/276で完了したFloat型PHI対応・型取得SSOT化の後続改善
|
||||
- `docs/development/current/main/phases/phase-277/P1-VALIDATION.md`
|
||||
- 指示書(Claude Code):
|
||||
- `docs/development/current/main/phases/phase-277/P1-INSTRUCTIONS.md`
|
||||
- 完了報告:
|
||||
- `docs/development/current/main/phases/phase-277/P1-COMPLETION.md`
|
||||
|
||||
### Phase 277 P2: PHI関連環境変数の統合・整理 ✅
|
||||
|
||||
@ -91,9 +93,12 @@ NYASH_LLVM_PHI_STRICT=1
|
||||
```
|
||||
phase-277/
|
||||
├── README.md # 本ファイル(Phase 277概要)
|
||||
├── P0-INSTRUCTIONS.md # P0指示書(Claude Code)
|
||||
├── P2-COMPLETION.md # P2完了報告
|
||||
├── P0-DESIGN.md # P0設計ドキュメント(docs)
|
||||
└── P1-VALIDATION.md # P1検証強化ドキュメント(validation)
|
||||
├── P1-INSTRUCTIONS.md # P1指示書(Claude Code)
|
||||
├── P1-VALIDATION.md # P1検証強化ドキュメント(validation)
|
||||
└── P1-COMPLETION.md # P1完了報告
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user