Expand description
Intermediate representation for clojurust program analysis and optimization.
The IR is a control-flow graph of basic blocks containing instructions in A-normal form (all sub-expressions bound to named temporaries). It supports SSA construction via phi nodes at join points.
The IR serves multiple purposes:
- Escape analysis and optimization hints
- IR interpreter (Tier 1 execution)
- Cranelift-based JIT/AOT code generation (Tier 2 execution)
Modules§
- lower
- Pure-Rust ANF lowering, escape analysis, and region optimization.
Structs§
- Block
- A basic block: a linear sequence of instructions followed by a terminator.
- BlockId
- A basic block identifier within an IR function.
- Closure
Template - Template for a closure — the static parts of an
fn*form. - IrBundle
- A bundle of pre-lowered IR functions, keyed by a string identifier.
- IrFunction
- An IR function — the unit of analysis.
- VarId
- A unique variable identifier within an IR function.
Enums§
- Const
- A constant value in the IR. Kept separate from
Valueto avoid requiring GC allocation for IR analysis. - Effect
- Effect classification for IR instructions.
- Inst
- An IR instruction. Each instruction produces at most one result (the
dstfield in variants that have one). - KnownFn
- Built-in functions the IR knows about for precise effect tracking.
- Region
Alloc Kind - The kind of object allocated in a region.
- Terminator
- A block terminator — controls flow between basic blocks.
Constants§
- COMPILER_
ANF_ SOURCE - Clojure source for the ANF lowering namespace.
- COMPILER_
ESCAPE_ SOURCE - Clojure source for the escape analysis namespace.
- COMPILER_
IR_ SOURCE - Clojure source for the IR builder namespace.
- COMPILER_
KNOWN_ SOURCE - Clojure source for the known function resolution namespace.
- COMPILER_
OPTIMIZE_ SOURCE - Clojure source for the optimization pass namespace.
Functions§
- deserialize_
bundle - Deserialize an
IrBundlefrom bytes. - serialize_
bundle - Serialize an
IrBundleto bytes.