Commit Graph

4 Commits

Author SHA1 Message Date
d7b8f79a75 feat(phase131): LLVM backend re-enable & PHI ordering bug discovery
Phase 131: JoinIR → LLVM individual fixes (minimal scope)

## Modifications

### 1. LLVM Backend Re-enable 
- Built with --features llvm to enable real LLVM execution
- Verified Python/llvmlite environment (llvmlite 0.45.1)
- Fixed llvmlite deprecated API: removed llvm.initialize() call
- Successfully moved from Mock backend to real LLVM harness execution

### 2. PHI Instruction Ordering Bug Discovery ⚠️
- Discovered critical bug: PHI nodes placed AFTER terminator instructions
- LLVM IR constraint: PHI must be at block start, before any non-PHI
- Root cause: finalize_phis() in llvm_builder.py emits PHIs after block termination
- Affects all 6 tests with control flow merges

### 3. ConsoleBox LLVM Integration ⚠️
- Confirmed ConsoleBox not registered in Rust VM environment
- Deferred to Phase 132 (prerequisite issue)

## Results

Modified files:
- src/llvm_py/llvm_builder.py: Removed deprecated llvm.initialize()
- docs/development/current/main/phase130_joinir_llvm_baseline.md: Added Phase 131 results
- CURRENT_TASK.md: Added Phase 131 completion report

Test results:
-  peek_expr_block.hako: LLVM execution success (Result: 1)
-  6/7 tests: PHI ordering bug (requires Phase 132 refactoring)

## Success Criteria

-  LLVM backend minimal re-enable (1/7 test passing)
- ⚠️ PHI ordering bug discovered and documented
- ⚠️ ConsoleBox integration deferred to Phase 132

## Phase 132 Handoff

Priority 1: Fix PHI instruction ordering bug (finalize_phis() refactoring)
Priority 2: Resolve ConsoleBox registration issue
Priority 3: Enable remaining test cases for LLVM

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 11:04:29 +09:00
aad3a9bb9f docs(phase130): Update checklist with commit hash 2025-12-04 10:52:21 +09:00
43d5911051 docs(phase130): JoinIR→LLVM ベースライン確立
Phase 130完了: JoinIR → LLVM 経路の現状を観測・記録

実施内容:
- 代表ケース7本選定(selfhost/hako_check/JoinIR各系統)
- Rust VM / LLVM harness 両経路でテスト実行
- 実行結果を表形式で記録(観測専用、修正なし)
- Phase 131への引き継ぎ事項を整理

テスト結果:
- Rust VM: 6/7 PASS (85.7%)
  - peek_expr_block, loop_min_while, phase123_simple_if,
    phase123_while_loop, joinir_if_select_simple, joinir_min_loop
  - FAIL: esc_dirname_smoke (ConsoleBox未登録)
- LLVM harness: 0/7実行 (Mock backend、要--features llvm)
  - MIRコンパイルは全て成功
  - 実LLVM実行は未対応

検出された問題点:
1. LLVM Backend未対応(最重要)
   - --features llvm ビルドが必要
   - Mock backend実行中
2. ConsoleBox未登録問題
   - Rust VM環境での登録不備
   - Phase 15.5方針との衝突
3. JoinIR → LLVM経路の不明確性
   - MIR → LLVM IR lowering未検証

成果物:
- docs/development/current/main/phase130_joinir_llvm_baseline.md
  - 代表ケース選定理由・実行コマンド整理
  - 実行結果詳細・問題点分析
  - Phase 131引き継ぎ事項
- CURRENT_TASK.md: Phase 130セクション追加
- 30-Backlog.md: Phase 131予告追加

次フェーズ: Phase 131 - JoinIR→LLVM 個別修正ライン
2025-12-04 10:52:10 +09:00
bdc6b8eefa docs(phase130): JoinIR → LLVM ベースライン確立(指示書作成) 2025-12-04 10:43:54 +09:00