feat(phase32): L-2.1 Stage-1 UsingResolver JoinIR integration + cleanup
Phase 32 L-2.1 complete implementation: 1. Stage-1 UsingResolver main line JoinIR connection - CFG-based LoopForm construction for resolve_for_source/5 - LoopToJoinLowerer integration with handwritten fallback - JSON snapshot tests 6/6 PASS 2. JoinIR/VM Bridge improvements - Simplified join_ir_vm_bridge.rs dispatch logic - Enhanced json.rs serialization - PHI core boxes cleanup (local_scope_inspector, loop_exit_liveness, loop_var_classifier) 3. Stage-1 CLI enhancements - Extended args.rs, groups.rs, mod.rs for new options - Improved stage1_bridge module (args, env, mod) - Updated stage1_cli.hako 4. MIR builder cleanup - Simplified if_form.rs control flow - Removed dead code from loop_builder.rs - Enhanced phi_merge.rs 5. Runner module updates - json_v0_bridge/lowering.rs improvements - dispatch.rs, selfhost.rs, modes/vm.rs cleanup 6. Documentation updates - CURRENT_TASK.md, AGENTS.md - Various docs/ updates 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
use super::{MirBuilder, ValueId};
|
||||
use crate::ast::{ASTNode, BinaryOperator};
|
||||
use crate::ast::ASTNode;
|
||||
use crate::mir::loop_api::LoopBuilderApi; // for current_block()
|
||||
|
||||
impl MirBuilder {
|
||||
@ -13,35 +13,7 @@ impl MirBuilder {
|
||||
) -> Result<ValueId, String> {
|
||||
// Reserve a deterministic join id for debug region labeling
|
||||
let join_id = self.debug_next_join_id();
|
||||
// Heuristic pre-pin: if condition is a comparison, evaluate its operands now and pin them
|
||||
// so that subsequent branches can safely reuse these values across blocks.
|
||||
// This leverages existing variable_map merges (PHI) at the merge block.
|
||||
if crate::config::env::mir_pre_pin_compare_operands() {
|
||||
if let ASTNode::BinaryOp {
|
||||
operator,
|
||||
left,
|
||||
right,
|
||||
..
|
||||
} = &condition
|
||||
{
|
||||
match operator {
|
||||
BinaryOperator::Equal
|
||||
| BinaryOperator::NotEqual
|
||||
| BinaryOperator::Less
|
||||
| BinaryOperator::LessEqual
|
||||
| BinaryOperator::Greater
|
||||
| BinaryOperator::GreaterEqual => {
|
||||
if let Ok(lhs_v) = self.build_expression((**left).clone()) {
|
||||
let _ = self.pin_to_slot(lhs_v, "@if_lhs");
|
||||
}
|
||||
if let Ok(rhs_v) = self.build_expression((**right).clone()) {
|
||||
let _ = self.pin_to_slot(rhs_v, "@if_rhs");
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Pre-pin heuristic was deprecated; keep operands as-is for predictability.
|
||||
|
||||
let condition_val = self.build_expression(condition)?;
|
||||
let condition_val = self.local_cond(condition_val);
|
||||
|
||||
@ -110,6 +110,7 @@ impl<'a> PhiMergeHelper<'a> {
|
||||
///
|
||||
/// # Returns
|
||||
/// Ok(()) on success, Err(String) on failure
|
||||
#[allow(dead_code)] // Reserved: explicit dst PHI merge for future use
|
||||
pub fn merge_with_dst(
|
||||
&mut self,
|
||||
dst: ValueId,
|
||||
|
||||
Reference in New Issue
Block a user