Atoll narrows a checked program through two intermediate representations, not three.
| Representation | Owns | Deliberately leaves out |
|---|---|---|
| HIR | Resolved source meaning, types, dispatch, effects, patterns, and origins | Physical frames and WebAssembly values |
atoll-codegen’s core IR |
Monomorphic SSA: control flow, storage, ownership, layout, and the calling convention | Surface syntax and unresolved types |
This replaced a MIR / WasmIR pair. The old split had one representation choose control flow and ownership and a second lower those to primitive WebAssembly values, with a canonicalization step between them — which meant every fact that mattered to both had to be stated twice, in two vocabularies, and the two could disagree. The chapters describing them have been removed along with the crates.
checked HIR
-- specialize types and calls (atoll-mono) -->
monomorphic HIR
-- lower to SSA over values, not slots (lower_hir) -->
core IR
-- insert retain/release (rc), optimize (opt), verify -->
core IR, ownership explicit
-- destruct SSA, reloop, stackify, encode (emit) -->
WebAssemblyWhere the detail lives
crates/atoll-codegen/docs/ is the design of record for everything right
of monomorphic HIR. It is written for someone changing the compiler, and it is
maintained alongside the code rather than as a description of it:
| Document | Subject |
|---|---|
memory-model.md |
ownership, pins, collections, closures, the release walk, trial deletion, and the ABI: the calling convention, frames and continuations, the scalar opcodes and the intrinsics |
numerics.md |
the numeric methods written in Atoll, and the differential tests |
optimizer.md |
which passes run at which level, in what order, and the test that holds each |
This section covers what a reader of the language needs: the handoff rule, identity, and the error policy. It does not restate the backend’s internals.
Handoff rule
A producer must establish every invariant its consumer relies on. A consumer may validate that contract, but it must not silently reconstruct an omitted decision.
Semantic analysis chooses which method or trait witness a call uses. Lowering chooses the calling convention for that resolved target and whether the callee may suspend. The encoder does not repeat overload resolution, inspect a semantic type registry, or guess whether a call can suspend.
Identity
Identifiers are representation-local. A HirExprId and a core-IR ValueId can
have the same numeric spelling without identifying the same thing. Cross-layer
tools use explicit provenance maps:
AST origin
↓
HIR node + Origin
↓
core IR op/terminator → HIR node and source range
↓
encoded offset → source/debug recordIDs are dense handles into arenas or vectors. They are not stable public file formats, hashes, or addresses.
Error policy
Recovery nodes are allowed while the front end is collecting diagnostics. They prevent one source error from cascading into dozens of unrelated messages. They do not authorize code generation.
An error-severity front-end diagnostic closes the backend gate. A verifier failure is a compiler defect or a backend diagnostic, not a request to emit a placeholder value. No successful artifact may contain an unresolved HIR type, an unfinished terminator, or an invalid use.
Normative scope
These chapters specify node and function shapes that passes may rely on; identity, ordering, and range rules; control-flow and suspension semantics; provenance and synthetic-node classification; and verifier obligations.
They do not promise a stable serialization format for compiler internals. Rust enum layout, debug-print syntax, pass-private facts, and numeric IDs may change without changing the Atoll language or runtime ABI. The stable external formats — the source language, runtime ABI, module metadata, and debugger protocol — are documented in their own sections.
Use the Compiler Pipeline for stage orchestration and Provenance for the end-to-end source mapping.