Commit Graph

5 Commits

Author SHA1 Message Date
853cb36800 refactor(joinir): L-1.3 - Rename minimal helpers to Case-A helpers
LoopToJoinLowerer API cleanup:

1. Rename methods to reflect their purpose as Case-A helpers:
   - lower_minimal_skip_ws_case_a → lower_case_a_for_skip_ws
   - lower_minimal_trim_case_a → lower_case_a_for_trim
   - lower_minimal_append_defs_case_a → lower_case_a_for_append_defs
   - lower_minimal_stage1_case_a → lower_case_a_for_stage1_resolver

2. Update comments to clarify these are thin wrappers over `lower()`
   - "Case-A 汎用 lowerer の薄いラッパー"
   - Actual logic is centralized in `lower` method

3. Update all 4 call sites:
   - skip_ws.rs
   - funcscanner_trim.rs
   - funcscanner_append_defs.rs
   - stage1_using_resolver.rs

Test results: standalone (2/2), JSON snapshot (6/6) PASS

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 10:28:03 +09:00
7d0581c9a4 refactor(joinir): Extract construct_simple_while_loopform helper, delete legacy code
Phase 32 cleanup:

1. Delete legacy is_supported_case_a_loop function from loop_to_join.rs
   - Replaced by is_supported_case_a_loop_view() in Phase 32 Step 3

2. Extract construct_simple_while_loopform helper to common.rs
   - Unified LoopForm construction for simple while loops
   - Parameters: entry_is_preheader (trim=true, stage1=false)
                 has_break (trim=true, stage1=false)
   - Sets latch=body to satisfy is_simple_case_a_loop check

3. Update lowering modules to use the common helper:
   - funcscanner_trim.rs: entry_is_preheader=true, has_break=true
   - stage1_using_resolver.rs: entry_is_preheader=false, has_break=false

Test results: JSON snapshot 6/6 PASS, VM bridge trim 2/2 PASS

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 10:15:31 +09:00
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