Expand description
Optimization pipeline primitives (spec §10.2): constant folding + common-subexpression
elimination over the hash-consed ExprDAG.
Functions§
- const_
fold - Constant folding (spec §10.2 item 1): runs the simplify engine over the DAG and returns the
canonical folded expression. Level-2 rules (0x, 1x, constant arithmetic, math constants)
already live in
crate::simplify::simplify. - cse
- CSE (spec §10.2 item 3): returns the canonical
ExprIdfor a subexpression. Because theExprPoolhash-conses identical nodes, repeated subexpressions already share oneExprId; this function documents and asserts that invariant (returnsidunchanged). It exists as the stable entry point the JIT pipeline calls before codegen. - optimize
- Full local optimization run (spec §10.2):
const_foldthencse. Used by the JIT compiler before translating the DAG to bytecode.