Files
hakorune/lang/src/opt/readme.md

18 lines
661 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# selfhost/opt — Optimization/Preparation Boxes
Purpose
- Provide small, opt-in preparation/optimization stages implemented in Hakorune.
- First step: AotPrepBox — MIR(JSON) normalize + safe local const-fold for single-block const/binop/ret.
Responsibilities
- JSON normalization via shared MirIoBox (canonicalization hook).
- Behavior-preserving, local transforms only; FailFast for unsupported shapes.
Non-Responsibilities
- Global CFG rewrites, SSA rebuild, or MIR semantics changes.
Gates
- Runner uses HAKO_AOT_PREP=1 to save “prepared” MIR sidecar after emitexe.
- Later we may switch compile input behind a dedicated flag once stable.