feat(mir): Phase 63-6-1/2 MIR Phi type_hint field & JoinIR propagation
Phase 63-6-1: MirInstruction::Phi に type_hint フィールド追加 - Added `type_hint: Option<MirType>` field to Phi instruction - Updated 21 files with type_hint initialization (all set to None for legacy paths) - Pattern matching updated across codebase (11 files) - Test code updated (basic_block.rs) Phase 63-6-2: JoinIR→MIR Bridge で型ヒント伝播実装 - Modified convert.rs: Select → MIR now creates PHI with type_hint - Removed Copy instructions from then/else blocks - PHI instruction at merge block receives type_hint from JoinIR Select - Test verification: ✅ Type hint propagation successful (Some(Integer)) Modified files: - instruction.rs: Added type_hint field definition - join_ir_vm_bridge/convert.rs: Select lowering with PHI + type_hint - 19 other files: type_hint field initialization Test results: - ✅ test_type_hint_propagation_simple: Type hint = Some(Integer) confirmed - ✅ 7/8 if_select tests passing (1 race condition, passes individually) Next: Phase 63-6-3 (lifecycle.rs で型ヒント使用) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -163,6 +163,7 @@ impl LoopFormOps for LoopFormJsonOps<'_> {
|
||||
if let MirInstruction::Phi {
|
||||
dst,
|
||||
inputs: phi_inputs,
|
||||
.. // Phase 63-6: Ignore type_hint
|
||||
} = inst
|
||||
{
|
||||
if *dst == phi_id {
|
||||
|
||||
@ -273,6 +273,7 @@ pub fn try_parse_v1_to_module(json: &str) -> Result<Option<MirModule>, String> {
|
||||
block_ref.add_instruction(MirInstruction::Phi {
|
||||
dst: ValueId::new(dst),
|
||||
inputs: pairs,
|
||||
type_hint: None, // Phase 63-6
|
||||
});
|
||||
max_value_id = max_value_id.max(dst + 1);
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ pub fn emit_mir_json_for_harness(
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if let I::Phi { dst, inputs } = inst {
|
||||
if let I::Phi { dst, inputs, .. } = inst {
|
||||
let incoming: Vec<_> = inputs
|
||||
.iter()
|
||||
.map(|(b, v)| json!([v.as_u32(), b.as_u32()]))
|
||||
@ -642,7 +642,7 @@ pub fn emit_mir_json_for_harness_bin(
|
||||
let mut emitted_defs: std::collections::HashSet<u32> =
|
||||
std::collections::HashSet::new();
|
||||
for inst in &bb.instructions {
|
||||
if let I::Phi { dst, inputs } = inst {
|
||||
if let I::Phi { dst, inputs, .. } = inst {
|
||||
let incoming: Vec<_> = inputs
|
||||
.iter()
|
||||
.map(|(b, v)| json!([v.as_u32(), b.as_u32()]))
|
||||
|
||||
@ -179,6 +179,7 @@ pub fn parse_mir_v0_to_module(json: &str) -> Result<MirModule, String> {
|
||||
block_ref.add_instruction(MirInstruction::Phi {
|
||||
dst: ValueId::new(dst),
|
||||
inputs: pairs,
|
||||
type_hint: None, // Phase 63-6
|
||||
});
|
||||
max_value_id = max_value_id.max(dst + 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user