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).
Modules§
- 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 - Constraint generator that walks RIR and generates type constraints.
- 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.
- 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.
- 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.
- 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. - 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.
- 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.
- 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.
- Infer
Type - Internal type representation during inference.
- 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).