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:
@ -346,7 +346,12 @@ fn lower_from_mir(module: &crate::mir::MirModule) -> Option<JoinModule> {
|
||||
eprintln!("[joinir/funcscanner_append_defs/mir] CFG sanity checks passed ✅");
|
||||
eprintln!("[joinir/funcscanner_append_defs/mir] Found: length(), get(), push(), i+1");
|
||||
|
||||
// Phase 30 F-3: LoopScopeShape 経由の新API を使用
|
||||
if crate::mir::join_ir::env_flag_is_1("NYASH_JOINIR_LOWER_GENERIC") {
|
||||
use crate::mir::join_ir::lowering::generic_case_a::lower_case_a_append_defs_with_scope;
|
||||
use crate::mir::join_ir::lowering::loop_form_intake::intake_loop_form;
|
||||
use crate::mir::join_ir::lowering::loop_scope_shape::LoopScopeShape;
|
||||
|
||||
let header = query.succs(entry).get(0).copied().unwrap_or(entry);
|
||||
let succs_header = query.succs(header);
|
||||
let body = succs_header.get(0).copied().unwrap_or(header);
|
||||
@ -366,20 +371,27 @@ fn lower_from_mir(module: &crate::mir::MirModule) -> Option<JoinModule> {
|
||||
);
|
||||
let var_classes = crate::mir::phi_core::loop_var_classifier::LoopVarClassBox::new();
|
||||
let exit_live = crate::mir::phi_core::loop_exit_liveness::LoopExitLivenessBox::new();
|
||||
if let Some(jm) = crate::mir::join_ir::lowering::generic_case_a::lower_case_a_loop_to_joinir_for_append_defs_minimal(
|
||||
&loop_form,
|
||||
&var_classes,
|
||||
&exit_live,
|
||||
&query,
|
||||
target_func,
|
||||
) {
|
||||
eprintln!(
|
||||
"[joinir/funcscanner_append_defs/generic-hook] generic_case_a produced JoinIR, returning early"
|
||||
);
|
||||
return Some(jm);
|
||||
|
||||
// Phase 30 F-3: LoopFormIntake + LoopScopeShape 経由で呼び出し
|
||||
if let Some(intake) = intake_loop_form(&loop_form, &var_classes, &query, target_func) {
|
||||
if let Some(scope) = LoopScopeShape::from_existing_boxes(
|
||||
&loop_form,
|
||||
&intake,
|
||||
&var_classes,
|
||||
&exit_live,
|
||||
&query,
|
||||
Some("FuncScannerBox.append_defs/2"), // Phase 30 F-3.1: Case-A minimal target
|
||||
) {
|
||||
if let Some(jm) = lower_case_a_append_defs_with_scope(scope) {
|
||||
eprintln!(
|
||||
"[joinir/funcscanner_append_defs/generic-hook] generic_case_a produced JoinIR via _with_scope, returning early"
|
||||
);
|
||||
return Some(jm);
|
||||
}
|
||||
}
|
||||
}
|
||||
eprintln!(
|
||||
"[joinir/funcscanner_append_defs/generic-hook] generic_case_a returned None, falling back to handwritten/MIR path"
|
||||
"[joinir/funcscanner_append_defs/generic-hook] generic_case_a via _with_scope returned None, falling back to handwritten/MIR path"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user