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:
nyash-codex
2025-11-30 04:35:40 +09:00
parent 360ad48d93
commit c6edbaaf3a
21 changed files with 55 additions and 33 deletions

View File

@ -604,7 +604,7 @@ impl MirBuilder {
.map(|f| f.signature.name.clone());
let _dbg_region_id = self.debug_current_region_id();
// P0: PHI の軽量補強と観測は、関数ブロック取得前に実施して借用競合を避ける
if let MirInstruction::Phi { dst, inputs } = &instruction {
if let MirInstruction::Phi { dst, inputs, .. } = &instruction {
origin::phi::propagate_phi_meta(self, *dst, inputs);
observe::ssa::emit_phi(self, *dst, inputs);
}
@ -815,7 +815,7 @@ impl MirBuilder {
if let Some(block_data) = function.get_block_mut(block) {
// Find PHI instruction with matching dst
for inst in &mut block_data.instructions {
if let MirInstruction::Phi { dst, inputs } = inst {
if let MirInstruction::Phi { dst, inputs, .. } = inst {
if *dst == phi_id {
*inputs = new_inputs;
return Ok(());