pub enum AirInstData {
Show 63 variants
Const(u64),
FloatConst(u64),
BoolConst(bool),
StringConst(u32),
UnitConst,
TypeConst(Type),
Add(AirRef, AirRef),
Sub(AirRef, AirRef),
Mul(AirRef, AirRef),
Div(AirRef, AirRef),
Mod(AirRef, AirRef),
Eq(AirRef, AirRef),
Ne(AirRef, AirRef),
Lt(AirRef, AirRef),
Gt(AirRef, AirRef),
Le(AirRef, AirRef),
Ge(AirRef, AirRef),
And(AirRef, AirRef),
Or(AirRef, AirRef),
BitAnd(AirRef, AirRef),
BitOr(AirRef, AirRef),
BitXor(AirRef, AirRef),
Shl(AirRef, AirRef),
Shr(AirRef, AirRef),
Neg(AirRef),
Not(AirRef),
BitNot(AirRef),
Branch {
cond: AirRef,
then_value: AirRef,
else_value: Option<AirRef>,
},
Loop {
cond: AirRef,
body: AirRef,
},
InfiniteLoop {
body: AirRef,
},
Match {
scrutinee: AirRef,
arms_start: u32,
arms_len: u32,
},
Break,
Continue,
Alloc {
slot: u32,
init: AirRef,
},
Load {
slot: u32,
},
Store {
slot: u32,
value: AirRef,
had_live_value: bool,
},
ParamStore {
param_slot: u32,
value: AirRef,
},
Ret(Option<AirRef>),
Call {
name: Spur,
args_start: u32,
args_len: u32,
},
CallGeneric {
name: Spur,
type_args_start: u32,
type_args_len: u32,
args_start: u32,
args_len: u32,
},
Intrinsic {
name: Spur,
args_start: u32,
args_len: u32,
},
Param {
index: u32,
},
Block {
stmts_start: u32,
stmts_len: u32,
value: AirRef,
},
StructInit {
struct_id: StructId,
fields_start: u32,
fields_len: u32,
source_order_start: u32,
},
FieldGet {
base: AirRef,
struct_id: StructId,
field_index: u32,
},
FieldSet {
slot: u32,
struct_id: StructId,
field_index: u32,
value: AirRef,
},
ParamFieldSet {
param_slot: u32,
inner_offset: u32,
struct_id: StructId,
field_index: u32,
value: AirRef,
},
ArrayInit {
elems_start: u32,
elems_len: u32,
},
IndexGet {
base: AirRef,
array_type: Type,
index: AirRef,
},
IndexSet {
slot: u32,
array_type: Type,
index: AirRef,
value: AirRef,
},
ParamIndexSet {
param_slot: u32,
array_type: Type,
index: AirRef,
value: AirRef,
},
PlaceRead {
place: AirPlaceRef,
},
PlaceWrite {
place: AirPlaceRef,
value: AirRef,
},
EnumVariant {
enum_id: EnumId,
variant_index: u32,
},
EnumCreate {
enum_id: EnumId,
variant_index: u32,
fields_start: u32,
fields_len: u32,
},
EnumPayloadGet {
base: AirRef,
variant_index: u32,
field_index: u32,
},
IntCast {
value: AirRef,
from_ty: Type,
},
FloatCast {
value: AirRef,
from_ty: Type,
},
IntToFloat {
value: AirRef,
from_ty: Type,
},
FloatToInt {
value: AirRef,
from_ty: Type,
},
Drop {
value: AirRef,
},
StorageLive {
slot: u32,
},
StorageDead {
slot: u32,
},
}Expand description
AIR instruction data - fully typed operations.
Variants§
Const(u64)
Integer constant (typed)
FloatConst(u64)
Floating-point constant, stored as f64 bits via f64::to_bits().
BoolConst(bool)
Boolean constant
StringConst(u32)
String constant (index into string table)
UnitConst
Unit constant
TypeConst(Type)
Type constant - a compile-time type value.
This is used for comptime type parameters (e.g., passing i32 to fn foo(comptime T: type)).
The contained Type is the type being passed as a value.
This instruction has type Type::COMPTIME_TYPE and is erased during specialization.
Add(AirRef, AirRef)
Addition
Sub(AirRef, AirRef)
Subtraction
Mul(AirRef, AirRef)
Multiplication
Div(AirRef, AirRef)
Division
Mod(AirRef, AirRef)
Modulo
Eq(AirRef, AirRef)
Equality
Ne(AirRef, AirRef)
Inequality
Lt(AirRef, AirRef)
Less than
Gt(AirRef, AirRef)
Greater than
Le(AirRef, AirRef)
Less than or equal
Ge(AirRef, AirRef)
Greater than or equal
And(AirRef, AirRef)
Logical AND
Or(AirRef, AirRef)
Logical OR
BitAnd(AirRef, AirRef)
Bitwise AND
BitOr(AirRef, AirRef)
Bitwise OR
BitXor(AirRef, AirRef)
Bitwise XOR
Shl(AirRef, AirRef)
Left shift
Shr(AirRef, AirRef)
Right shift (arithmetic for signed, logical for unsigned)
Neg(AirRef)
Negation
Not(AirRef)
Logical NOT
BitNot(AirRef)
Bitwise NOT
Branch
Conditional branch
Loop
While loop
InfiniteLoop
Infinite loop (produces Never type)
Match
Match expression
Fields
Break
Break: exits the innermost loop
Continue
Continue: jumps to the next iteration of the innermost loop
Alloc
Allocate local variable with initial value Returns the slot index
Load
Load value from local variable
Store
Store value to local variable
Fields
ParamStore
Store value to a parameter (for inout params)
Fields
Ret(Option<AirRef>)
Return from function (None for return; in unit-returning functions)
Call
Function call
Fields
name: SpurFunction name (interned symbol)
CallGeneric
Generic function call - requires specialization before codegen.
This is emitted when calling a function with comptime T: type parameters.
During a post-analysis specialization pass, this is rewritten to a regular
Call to a specialized version of the function (e.g., identity__i32).
The type_args are encoded in the extra array as raw Type discriminant values. The runtime args (non-comptime) are also in the extra array, after type_args.
Fields
name: SpurBase function name (interned symbol)
Intrinsic
Intrinsic call (e.g., @dbg)
Fields
name: SpurIntrinsic name (without @, interned)
Param
Reference to a function parameter
Block
Block expression with statements and final value. Used to group side-effect statements with their result value, enabling demand-driven lowering for short-circuit evaluation.
Fields
StructInit
Create a new struct instance with initialized fields
Fields
FieldGet
Load a field from a struct value
Fields
FieldSet
Store a value to a struct field (for local variables)
Fields
ParamFieldSet
Store a value to a struct field (for parameters, including inout)
Fields
ArrayInit
Create a new array with initialized elements.
The array type is stored in AirInst.ty as Type::new_array(...).
Fields
IndexGet
Load an element from an array.
The array type is stored in AirInst.ty.
Fields
IndexSet
Store a value to an array element.
The array type is stored in AirInst.ty.
Fields
ParamIndexSet
Store a value to an array element of an inout parameter.
The array type is stored in AirInst.ty.
Fields
PlaceRead
Read a value from a memory location.
This unifies Load, IndexGet, and FieldGet into a single instruction
that can handle arbitrarily nested access patterns like arr[i].field.
Eventually, the separate FieldGet/IndexGet instructions will be removed.
Fields
place: AirPlaceRefReference to the place to read from
PlaceWrite
Write a value to a memory location.
This unifies Store, IndexSet, ParamIndexSet, FieldSet, and ParamFieldSet into a single instruction that can handle nested writes. Eventually, the separate *Set instructions will be removed.
EnumVariant
Create an enum variant value (unit variant or any variant of a unit-only enum)
EnumCreate
Create a data enum variant value with associated field values. Used when the enum has at least one data variant. Field AirRefs are stored in the extra array at [fields_start..fields_start+fields_len].
Fields
EnumPayloadGet
Extract a field value from an enum variant’s payload. Used in data variant match arm bodies to bind pattern variables.
Fields
IntCast
Integer cast: convert between integer types with runtime range check. Panics if the value cannot be represented in the target type. The target type is stored in AirInst.ty.
Fields
FloatCast
Float cast: convert between floating-point types (fptrunc/fpext). The target type is stored in AirInst.ty.
IntToFloat
Integer to float conversion (sitofp/uitofp). The target type is stored in AirInst.ty.
Fields
FloatToInt
Float to integer conversion (fptosi/fptoui) with runtime range check. Panics if the value is NaN or out of range of the target integer type. The target type is stored in AirInst.ty.
Drop
Drop a value, running its destructor if the type has one. For trivially droppable types, this is a no-op. The type is stored in the AirInst.ty field.
StorageLive
Marks that a local slot becomes live (storage allocated). Emitted when a variable binding is created. The type is stored in AirInst.ty for drop elaboration.
StorageDead
Marks that a local slot becomes dead (storage can be deallocated). Emitted at scope exit for variables declared in that scope. The type is stored in AirInst.ty for drop elaboration. Drop elaboration will insert a Drop before this if the type needs drop and the value wasn’t moved.
Trait Implementations§
Source§impl Clone for AirInstData
impl Clone for AirInstData
Source§fn clone(&self) -> AirInstData
fn clone(&self) -> AirInstData
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AirInstData
impl RefUnwindSafe for AirInstData
impl Send for AirInstData
impl Sync for AirInstData
impl Unpin for AirInstData
impl UnwindSafe for AirInstData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].