Expand description
Analyzed Intermediate Representation (AIR) - Typed IR.
AIR is the second IR in the Gruel compiler pipeline. It is generated from RIR after semantic analysis and type checking.
Key characteristics:
- Fully typed: all types are resolved
- Per-function: generated lazily for each function
- Ready for codegen: can be lowered directly to machine code
Inspired by Zig’s AIR (Analyzed Intermediate Representation).
Re-exports§
pub use layout::DiscriminantStrategy;pub use layout::Layout;pub use layout::NicheRange;pub use layout::layout_of;
Modules§
- layout
- Type layout abstraction (ADR-0069).
- specialize
- Generic function specialization pass.
Structs§
- Air
- The complete AIR for a function.
- AirCall
Arg - An argument in a function call (AIR level).
- AirInst
- A single AIR instruction.
- AirPlace
- A memory location that can be read from or written to.
- AirPlace
Ref - A reference to a place in AIR - stored as index into the places array.
- AirRef
- A reference to an instruction in the AIR.
- Analysis
State Remapping - Remapping information for updating AIR after merging.
- Analyzed
Function - Result of analyzing a function.
- Array
Type Id - A unique identifier for an array type.
This is needed because Type is Copy, so we can’t use Box
for the element type. - Constraint
Context - Context for constraint generation within a single function.
- Constraint
Generator - This is Phase 1 of HM inference: constraint generation. The constraints
are later solved by the
Unifierto determine concrete types. - Enum
Data - Data for an enum type in the intern pool.
- EnumDef
- Definition of an enum type.
- EnumId
- A unique identifier for an enum definition.
- Enum
Variant Def - A single variant in an enum definition.
- Expr
Info - Result of constraint generation for an expression.
- Function
Analysis State - Per-function mutable state during semantic analysis.
- Function
Analyzer - Per-function mutable state during semantic analysis.
- Function
Analyzer Output - Output from analyzing a single function.
- Function
Info - Information about a function.
- Function
Output Remapping - Remapping information for updating AIR after merging.
- Function
Sig - Information about a function during constraint generation.
- Gather
Output - Output from the declaration gathering phase.
- Interface
Def - Definition of an interface (ADR-0056).
- Interface
Id - A unique identifier for an interface declaration (ADR-0056).
- Interface
Method Req - A single required method signature inside an
InterfaceDef. - Interned
Type - Interned type index - 32 bits, Copy, cheap comparison.
- Local
VarInfo - Information about a local variable during constraint generation.
- Merged
Analysis State - Merged state from multiple function analyses.
- Merged
Function Output - Merge multiple function analyzer outputs into a single result.
- Method
Info - Information about a method in an impl block.
- Method
Sig - Information about a method during constraint generation.
- Module
Def - Definition of a module (imported file).
- Module
Id - A unique identifier for a module (imported file).
- Module
Registry - Thread-safe registry for modules.
- MutRef
Type Id - A unique identifier for a
MutRef(T)type (ADR-0062). MirrorsPtrMutTypeId. - MutSlice
Type Id - A unique identifier for a
MutSlice(T)type (ADR-0064). - Param
Arena - Central storage for all function/method parameter data.
- Param
Range - A range of parameters in the
ParamArena. - Param
VarInfo - Information about a function parameter during constraint generation.
- PtrConst
Type Id - A unique identifier for a
ptr const Ttype. This is needed because Type is Copy, so we can’t use Boxfor the pointee type. - PtrMut
Type Id - A unique identifier for a
ptr mut Ttype. This is needed because Type is Copy, so we can’t use Boxfor the pointee type. - RefType
Id - A unique identifier for a
Ref(T)type (ADR-0062). MirrorsPtrConstTypeId— uses pool indices for type interning. - Sema
- Semantic analyzer that converts RIR to AIR.
- Sema
Context - Context for semantic analysis, designed for parallel function analysis.
- Sema
Context Inference Context - Pre-computed type information for constraint generation.
- Sema
Output - Output from semantic analysis.
- Slice
Type Id - A unique identifier for a
Slice(T)type (ADR-0064). - Struct
Data - Data for a struct type in the intern pool.
- Struct
Def - Definition of a struct type.
- Struct
Field - A field in a struct definition.
- Struct
Id - A unique identifier for a struct definition.
- Substitution
- A substitution mapping type variables to their resolved types.
- Type
- A type in the Gruel type system.
- Type
Intern Pool - Thread-safe intern pool for all composite types.
- Type
Intern Pool Stats - Statistics about the intern pool contents.
- Type
VarAllocator - Allocator for fresh type variables.
- Type
VarId - Unique identifier for a type variable.
- Unification
Error - An error that occurred during unification.
- Unifier
- Unification engine for type inference.
Enums§
- AirArg
Mode - Argument passing mode in AIR. Mirrors
AirParamMode. - AirInst
Data - AIR instruction data - fully typed operations.
- AirParam
Mode - Parameter passing mode in AIR.
- AirPattern
- A pattern in a match expression (AIR level - typed).
- AirPlace
Base - The base of a place - where the memory location starts.
- AirProjection
- A projection applied to a place to reach a nested location.
- Const
Value - A value that can be computed at compile time.
- Constraint
- A type constraint generated during analysis.
- IfaceTy
- A type slot inside an interface method signature (ADR-0060).
- Infer
Type - Internal type representation during inference.
- Module
Path - Represents a parsed import path with its resolution strategy.
- Receiver
Mode - Receiver mode for an interface method (ADR-0060).
- Type
Data - Type data stored in the intern pool.
- Type
Kind - The kind of a type - used for pattern matching.
- Unify
Result - Result of unifying two types.
Constants§
- PARAM_
SLOT_ MARKER - Sentinel value used to encode parameter slots in AIR instructions.
Functions§
- parse_
array_ type_ syntax - Parse array type syntax “[T; N]” and return (element_type_str, length).
Type Aliases§
- Interface
Vtables - Vtable witnesses keyed by
(struct_id, interface_id). The value is the conforming type’s method-key list in interface declaration order; codegen looks each one up in the function map to build the vtable global.