feat(mir): Phase 25.1f完了 - Conservative PHI + ControlForm観測レイヤー
🎉 Conservative PHI Box理論による完全SSA構築 **Phase 7-B: Conservative PHI実装** - 片方branchのみ定義変数に対応(emit_void使用) - 全変数にPHI生成(Conservative Box理論) - Stage-1 resolver全テスト緑化(3/3 PASS) **Phase 25.1f: ControlForm観測レイヤー** - LoopShape/IfShape/ControlForm構造定義 - Loop/If統一インターフェース実装 - debug_dump/debug_validate機能追加 - NYASH_CONTROL_FORM_TRACE環境変数対応 **主な変更**: - src/mir/builder/phi.rs: Conservative PHI実装 - src/mir/control_form.rs: ControlForm構造(NEW) - src/mir/loop_builder.rs: LoopForm v2デフォルト化 **テスト結果**: ✅ mir_stage1_using_resolver_min_fragment_verifies ✅ mir_stage1_using_resolver_full_collect_entries_verifies ✅ mir_parserbox_parse_program2_harness_parses_minimal_source 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: ChatGPT <chatgpt@openai.com>
This commit is contained in:
42
lang/src/shared/mir/control_form_box.hako
Normal file
42
lang/src/shared/mir/control_form_box.hako
Normal file
@ -0,0 +1,42 @@
|
||||
// selfhost/shared/mir/control_form_box.hako
|
||||
// ControlFormBox — Loop / If 共通ビューの Hakorune 実装版(Layer 2)
|
||||
//
|
||||
// 目的:
|
||||
// - Rust 側の LoopShape / IfShape / ControlForm に対応する箱を .hako 側に用意して、
|
||||
// Stage‑B / LoopSSA からも同じモデルで制御構造を扱えるようにすることだよ。
|
||||
// - 現時点では「構造定義のみ」の箱で、コンパイルを通すための最小限の実装になっているよ。
|
||||
|
||||
static box ControlFormBox {
|
||||
// 共通フィールド
|
||||
kind_name: StringBox // "loop" or "if"
|
||||
entry: IntegerBox // BasicBlockId 相当(整数ID)
|
||||
exits: ArrayBox // of IntegerBox (BlockId)
|
||||
|
||||
// Loop 用フィールド(kind_name == "loop" の時のみ意味を持つ)
|
||||
loop_preheader: IntegerBox
|
||||
loop_header: IntegerBox
|
||||
loop_body: IntegerBox
|
||||
loop_latch: IntegerBox
|
||||
loop_exit: IntegerBox
|
||||
|
||||
// If 用フィールド(kind_name == "if" の時のみ意味を持つ)
|
||||
if_cond: IntegerBox
|
||||
if_then: IntegerBox
|
||||
if_else: IntegerBox
|
||||
if_merge: IntegerBox
|
||||
|
||||
// コンストラクタ相当: kind_name を設定し、exits 配列を初期化するよ。
|
||||
birth(kind) {
|
||||
me.kind_name = kind
|
||||
me.exits = new ArrayBox()
|
||||
}
|
||||
|
||||
is_loop() {
|
||||
return me.kind_name == "loop"
|
||||
}
|
||||
|
||||
is_if() {
|
||||
return me.kind_name == "if"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user