feat(mir): Phase 30 F-3.0.7 LoopScopeShape Case-A minimal routing

Add func_name-based routing in LoopScopeShape::from_existing_boxes()
to prepare for MIR-based independent analysis:

- Add is_case_a_minimal_target() helper for 4 Case-A targets
- Add analyze_case_a() method (delegates to legacy, future MIR-based)
- Add from_existing_boxes_legacy() for backward compatibility
- Update from_existing_boxes() with func_name: Option<&str> parameter
- Update 4 production call sites with specific func_name
- Update 6 test cases with None for legacy path
- Update module documentation with routing logic diagram

Tests: 10/10 LoopScopeShape tests PASS, 6/7 JoinIR VM bridge tests PASS

🤖 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-26 00:36:41 +09:00
parent 2b47f47061
commit bf3893b2cc
5 changed files with 263 additions and 75 deletions

View File

@ -352,8 +352,12 @@ fn lower_skip_ws_handwritten_or_mir(module: &crate::mir::MirModule) -> Option<Jo
}
/// トグル ON 時にだけ試す generic Case A ロワーminimal_ssa_skip_ws 限定)
///
/// Phase 30 F-3: LoopScopeShape 経由の新API を使用
fn try_lower_skip_ws_generic_case_a(module: &crate::mir::MirModule) -> Option<JoinModule> {
use crate::mir::join_ir::lowering::generic_case_a::lower_case_a_loop_to_joinir_for_minimal_skip_ws;
use crate::mir::join_ir::lowering::generic_case_a::lower_case_a_skip_ws_with_scope;
use crate::mir::join_ir::lowering::loop_form_intake::intake_loop_form;
use crate::mir::join_ir::lowering::loop_scope_shape::LoopScopeShape;
use crate::mir::loop_form::LoopForm;
use crate::mir::phi_core::loop_exit_liveness::LoopExitLivenessBox;
use crate::mir::phi_core::loop_var_classifier::LoopVarClassBox;
@ -380,14 +384,23 @@ fn try_lower_skip_ws_generic_case_a(module: &crate::mir::MirModule) -> Option<Jo
break_targets: vec![exit],
};
// Phase 30 F-3: 実データ Box を使用(空箱から実箱へ)
let var_classes = LoopVarClassBox::new();
let exit_live = LoopExitLivenessBox::new();
lower_case_a_loop_to_joinir_for_minimal_skip_ws(
// LoopFormIntake 構築
let intake = intake_loop_form(&loop_form, &var_classes, &query, target_func)?;
// LoopScopeShape 構築
let scope = LoopScopeShape::from_existing_boxes(
&loop_form,
&intake,
&var_classes,
&exit_live,
&query,
target_func,
)
Some("Main.skip/1"), // Phase 30 F-3.1: Case-A minimal target
)?;
// 新API経由で JoinModule 生成
lower_case_a_skip_ws_with_scope(scope)
}