Commit Graph

3 Commits

Author SHA1 Message Date
ec69b49446 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>
2025-11-26 08:01:32 +09:00
acffd9974b feat(phase31): Step 3-A/B - Add early return and structure checks to LoopToJoinLowerer
Phase 31 Step 3-A: Add early return using is_case_a_minimal_target() filter
- Check before LoopScopeShape construction for efficiency
- Returns None immediately for non-target functions

Phase 31 Step 3-B: Add structural validation to is_supported_case_a_loop()
- Single exit check: loop_form.break_targets.len() <= 1
- Variable presence check: !carriers.is_empty() || !pinned.is_empty()
- Debug logging for rejection reasons

Also refactored lower_with_scope() from if-else chain to match expression for clarity.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 06:02:52 +09:00
ef9fd4417a feat(phase31): Add LoopToJoinLowerer unified box
Phase 31 Step 1 complete:
- Create src/mir/join_ir/lowering/loop_to_join.rs
- Add LoopToJoinLowerer struct with lower() method
- Implement lower_minimal_skip_ws_case_a() via generic_case_a
- Support for trim, append_defs, stage1 patterns
- Re-export from mod.rs

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 01:18:32 +09:00