Files
hakorune/src/mir
tomoaki 41d28330e9 feat(select): Task 2-E complete - VM/LLVM backend support for Select instruction
Phase 256 P1.5: Implement Select instruction (ternary conditional) across entire MIR pipeline

Task 2-E Implementation:
- Added Select ValueId entry to effects() in instruction/methods.rs (pure operation)
- Added Select case to dst_value() for definition tracking
- Added Select case to used_values() for use-def chains (cond, then_val, else_val)
- Fixed non-exhaustive pattern matches in 5 locations:
  * src/mir/instruction/methods.rs: 3 match arms (effects, dst_value, used_values)
  * src/mir/printer_helpers.rs: format_instruction display
  * src/mir/query.rs: reads_of and writes_of MirQuery trait

- Created VM backend: src/llvm_py/instructions/select.py
  * lower_select() implements ternary: dst = cond ? then_val : else_val
  * Converts cond to i1 for boolean test
  * Uses llvmlite builder.select() for LLVM IR generation

- Integrated Select dispatch in instruction_lower.py
  * Imported lower_select module
  * Added select case to instruction dispatch (after barrier, before while)
  * Passes resolver, ValueIds, and CFG context

Compilation Status:  0 errors (cargo build --release succeeded)
MIR Output:  Select instructions present in generated MIR
Next: Investigate SSA undefined value issue in Pattern7 loop_step

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2025-12-20 03:20:55 +09:00
..