v3.ssa.optimize
fn optimize #
fn optimize(mut m ssa.Module)
optimize runs the default, backend-safe optimization pipeline. Structural SSA construction (mem2reg / phi elimination) is opt-in via the environment so the proven arm64 lowering path is unchanged unless explicitly requested: V3_MEM2REG=1 enable alloca promotion + phi insertion V3_PHI_ELIM=1 additionally lower phis to assign copies V3_VERIFY=1 structured verify after each pass (V3_VERIFY_STRICT=1 = fatal)
fn optimize_with_options #
fn optimize_with_options(mut m ssa.Module, opts OptimizeOptions)
optimize_with_options supports optimize with options handling for optimize.
fn verify #
fn verify(m &ssa.Module) []VerifyError
verify performs comprehensive validation of SSA invariants and returns every error found (empty slice == valid). v3 stores branch/phi/switch targets as raw block ids, so block operands are validated as block ids, not block values.
fn verify_and_panic #
fn verify_and_panic(m &ssa.Module, pass_name string)
verify_and_panic runs verification and panics on critical errors only.
fn verify_and_panic_with_options #
fn verify_and_panic_with_options(m &ssa.Module, pass_name string, opts VerifyPanicOptions)
verify_and_panic_with_options runs verification with an explicit warning policy. Declaration-only functions (C externs / prototypes) are always accepted.
struct OptimizeOptions #
struct OptimizeOptions {
pub:
mem2reg bool // promote scalar allocas to SSA values + phi nodes
eliminate_phis bool // lower phis to `assign` copies (for backends without phi)
verify_each_pass bool // run the structured verifier after every structural pass
strict_verify bool // treat historically-noncritical verifier findings as fatal
}
OptimizeOptions controls optimize options behavior used by optimize.
struct VerifyError #
struct VerifyError {
pub:
msg string
func_id int = -1
func_name string
block_id int = -1
val_id int = -1
}
VerifyError is a structured SSA verification failure. Unlike verify_ssa() (which panics on the first problem), the structured API collects every error so callers can decide which are fatal.
fn (VerifyError) str #
fn (e VerifyError) str() string
str returns the string form for VerifyError.
struct VerifyPanicOptions #
struct VerifyPanicOptions {
pub:
allow_noncritical bool
}
VerifyPanicOptions controls verify panic options behavior used by optimize.