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:
@ -542,7 +542,7 @@ impl super::MirBuilder {
|
||||
values.insert(*v);
|
||||
}
|
||||
}
|
||||
MirInstruction::Phi { dst, inputs } => {
|
||||
MirInstruction::Phi { dst, inputs, type_hint: None } => {
|
||||
values.insert(*dst);
|
||||
for (_, val) in inputs {
|
||||
values.insert(*val);
|
||||
@ -651,12 +651,13 @@ impl super::MirBuilder {
|
||||
MirInstruction::Return { value } => MirInstruction::Return {
|
||||
value: value.map(remap_value),
|
||||
},
|
||||
MirInstruction::Phi { dst, inputs } => MirInstruction::Phi {
|
||||
MirInstruction::Phi { dst, inputs, type_hint: None } => MirInstruction::Phi {
|
||||
dst: remap_value(*dst),
|
||||
inputs: inputs
|
||||
.iter()
|
||||
.map(|(bb, val)| (remap_block(*bb), remap_value(*val)))
|
||||
.collect(),
|
||||
type_hint: None, // Phase 63-6: Preserve no type hint during remapping
|
||||
},
|
||||
MirInstruction::Copy { dst, src } => MirInstruction::Copy {
|
||||
dst: remap_value(*dst),
|
||||
|
||||
@ -130,6 +130,7 @@ impl super::MirBuilder {
|
||||
self.emit_instruction(super::MirInstruction::Phi {
|
||||
dst: result_val,
|
||||
inputs: phi_inputs,
|
||||
type_hint: None, // Phase 63-6: Legacy path, no type hint
|
||||
})?;
|
||||
}
|
||||
Ok(result_val)
|
||||
|
||||
@ -32,7 +32,7 @@ impl<'a> PhiBuilderOps for ToplevelOps<'a> {
|
||||
self.0.current_span,
|
||||
);
|
||||
} else {
|
||||
self.0.emit_instruction(MirInstruction::Phi { dst, inputs })?;
|
||||
self.0.emit_instruction(MirInstruction::Phi { dst, inputs, type_hint: None })?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -91,6 +91,7 @@ impl MirBuilder {
|
||||
self.emit_instruction(MirInstruction::Phi {
|
||||
dst: merged,
|
||||
inputs,
|
||||
type_hint: None, // Phase 63-6: Legacy path, no type hint
|
||||
})?;
|
||||
}
|
||||
self.variable_map.insert(pin_name.clone(), merged);
|
||||
|
||||
Reference in New Issue
Block a user