feat(.hako): Exit PHI実装(Phase 2-5完了)- リファレンス実装

.hakoコンパイラにExit PHI生成機能を実装(将来の本命実装)

実装ファイル(585行):
- break_finder.hako (~250行): break文検出
- phi_injector.hako (~280行): PHI命令生成・挿入
- loopssa.hako (更新): BreakFinder/PhiInjector統合
- README.md: アーキテクチャ説明・使用方法

設計:
- 箱化・モジュール化(3Box分離)
- JSON文字列→文字列処理
- HAKO_LOOPSSA_EXIT_PHI=1 で有効化

重要な発見:
- Exit PHI生成はMIRレベルで行うべき(JSON v0では情報不足)
- 現在のTest 2エラーはRust MIRビルダーのバグ
- .hako実装は将来のリファレンス・Phase 25.1f用に温存

次のステップ:
- Rust側 loopform_builder.rs のphi pred mismatchバグ修正
- .hakoへの完全移行はPhase 25.1e後半〜25.1f

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-11-18 04:05:45 +09:00
parent 9f45ebaced
commit 5bb094d58f
5 changed files with 714 additions and 5 deletions

View File

@ -126,6 +126,8 @@ path = "lang/src/shared/common/string_helpers.hako"
"lang.compiler.builder.ssa.loop" = "lang/src/compiler/builder/ssa/loopssa.hako"
"lang.compiler.builder.ssa.loopssa" = "lang/src/compiler/builder/ssa/loopssa.hako"
"lang.compiler.builder.ssa.cond_inserter" = "lang/src/compiler/builder/ssa/cond_inserter.hako"
"lang.compiler.builder.ssa.exit_phi.break_finder" = "lang/src/compiler/builder/ssa/exit_phi/break_finder.hako"
"lang.compiler.builder.ssa.exit_phi.phi_injector" = "lang/src/compiler/builder/ssa/exit_phi/phi_injector.hako"
"lang.compiler.builder.rewrite.special" = "lang/src/compiler/builder/rewrite/special.hako"
"lang.compiler.builder.rewrite.known" = "lang/src/compiler/builder/rewrite/known.hako"
"lang.compiler.pipeline_v2.localvar_ssa_box" = "lang/src/compiler/pipeline_v2/local_ssa_box.hako"