feat(mir): Phase 32 Step 0-3B - LoopRegion/LoopControlShape view methods
Phase 32 introduces a "view pattern" for loop structures, enabling gradual migration without breaking existing code. Changes: - control_form.rs: Add new ID types (LoopId, ExitEdgeId, ContinueEdgeId) and structures (LoopRegion, LoopControlShape, ExitEdge, ContinueEdge) - control_form.rs: Add view methods on LoopShape: - to_region_view() - returns LoopRegion - to_control_view() - returns LoopControlShape - to_exit_edges() - returns Vec<ExitEdge> - to_continue_edges() - returns Vec<ContinueEdge> - loop_scope_shape.rs: Use views in from_existing_boxes_legacy() - loop_to_join.rs: Add debug logging with Phase 32 views All 4 minimal lowerers (skip_ws/trim/append_defs/stage1) now use view-based block ID extraction via shared from_existing_boxes_legacy(). Tests: joinir_runner_standalone_*, joinir_vm_bridge_trim_* PASS 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
//! let join_module = lowerer.lower(func, &loop_form, &query)?;
|
||||
//! ```
|
||||
|
||||
use crate::mir::control_form::LoopId;
|
||||
use crate::mir::join_ir::lowering::generic_case_a;
|
||||
use crate::mir::join_ir::lowering::loop_form_intake::intake_loop_form;
|
||||
use crate::mir::join_ir::lowering::loop_scope_shape::LoopScopeShape;
|
||||
@ -108,6 +109,23 @@ impl LoopToJoinLowerer {
|
||||
);
|
||||
}
|
||||
|
||||
// Phase 32 Step 3-A: View メソッドを使った構造確認(段階移行)
|
||||
if self.debug {
|
||||
let loop_id = LoopId(0); // 単一ループの場合は 0
|
||||
let region = loop_form.to_region_view(loop_id);
|
||||
let control = loop_form.to_control_view(loop_id);
|
||||
let exit_edges = loop_form.to_exit_edges(loop_id);
|
||||
let continue_edges = loop_form.to_continue_edges(loop_id);
|
||||
|
||||
eprintln!(
|
||||
"[LoopToJoinLowerer] Phase 32 views: region.header={:?}, control.exits={}, exit_edges={}, continue_edges={}",
|
||||
region.header,
|
||||
control.exits.len(),
|
||||
exit_edges.len(),
|
||||
continue_edges.len()
|
||||
);
|
||||
}
|
||||
|
||||
// Step 5: パターンに応じた lowering を実行
|
||||
self.lower_with_scope(scope, func_name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user