Commit Graph

6 Commits

Author SHA1 Message Date
bee0c7f8e1 phase29am(p1): flatten seq-of-effects in core loop body 2025-12-29 16:54:22 +09:00
2dbc4b5968 phase29am(p0): implement coreplan if/exit lowering 2025-12-29 16:43:41 +09:00
0664526d99 feat(plan): Phase 273 P3 - Plan Lowering SSOT Finalize
Phase 273 P3 完成: CoreLoopPlan SSOT 化、legacy fallback 撤去

Changes:
- CoreLoopPlan: Option<...> → 必須フィールド化(構造で "揺れ" を消す)
  - block_effects, phis, frag, final_values が必須に
  - legacy fields 削除 (header_effects, step_effects, carriers, loop_var_name)
- Lowerer: lower_loop_legacy() 撤去、generalized 経路のみ
  - emit_scan_with_init_edgecfg() 参照が完全に消えた
- Normalizer: Pattern6/7 両方が generalized fields のみを使用
- Verifier: generalized 専用の不変条件追加 (V7-V9)
  - V7: PHI non-empty
  - V8: frag.entry == header_bb
  - V9: block_effects contains header_bb

Acceptance Criteria:
-  Lowerer から pattern 固有参照が消えている
-  Pattern6/7 が generalized CoreLoopPlan を使用
-  legacy fallback 撤去、欠落時は型エラー (Fail-Fast)
-  VM テスト PASS (phase254/256/258)
-  LLVM テスト PASS (phase256/258)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 00:01:58 +09:00
d16800741f feat(plan): Phase 273 P2 Step 1-2 - CoreLoopPlan generalization
Generalize CoreLoopPlan for Pattern7+ support:

New structures (mod.rs):
- CorePhiInfo: PHI info with block, dst, inputs, tag
- CoreLoopPlan new optional fields:
  - block_effects: Vec<(BasicBlockId, Vec<CoreEffectPlan>)>
  - phis: Vec<CorePhiInfo>
  - frag: Frag (EdgeCFG)
  - final_values: Vec<(String, ValueId)>

Normalizer (normalizer.rs):
- Pattern6 now populates all new fields
- Frag construction matches emit_scan_with_init_edgecfg
- SSOT ordering: preheader → header → body → step

Lowerer (lowerer.rs):
- lower_loop() dispatches to generalized or legacy path
- lower_loop_generalized(): emit blocks → PHI → emit_frag()
- lower_loop_legacy(): backward compatible fallback

Test: phase258_p0_index_of_string_vm PASS (exit=6)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 23:18:51 +09:00
ec792983cc feat(plan): Phase 273 P2 Step 0 - CoreEffectPlan side effect support
Prepare CoreEffectPlan::MethodCall for Pattern7 (split) support:
- dst: ValueId → Option<ValueId> (for void methods like push)
- effects: EffectMask field added (PURE+Io vs MUT)

Changes:
- plan/mod.rs: MethodCall struct updated
- plan/lowerer.rs: emit_effect() uses dst/effects from plan
- plan/normalizer.rs: MethodCall with explicit effects
- plan/verifier.rs: Handle Option<ValueId> dst

Test: phase258_p0_index_of_string_vm PASS (exit=6)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 23:07:49 +09:00
960241795d feat(mir/llvm): Phase 273 P0-P1 DomainPlan→CorePlan + LLVM arg fix
Phase 273 P0-P1: Two-layer plan architecture
- DomainPlan: Pattern-specific knowledge (ScanWithInit)
- CorePlan: Fixed vocabulary (Seq, Loop, If, Effect, Exit)
- ValueId references only (String expressions forbidden)
- Pipeline: Extractor→Normalizer→Verifier→Lowerer

New plan/ module:
- mod.rs: Type definitions, SSOT spec
- normalizer.rs: DomainPlan→CorePlan + ID allocation
- verifier.rs: V1-V6 invariant checks (fail-fast)
- lowerer.rs: CorePlan→MIR (pattern-agnostic)

LLVM fix (ChatGPT):
- function_lower.py: Fix argument reference bug
- Phase 258 index_of_string now PASS on LLVM backend

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 22:42:56 +09:00