AirInstData

Enum AirInstData 

Source
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

Fields

§cond: AirRef
§then_value: AirRef
§else_value: Option<AirRef>
§

Loop

While loop

Fields

§cond: AirRef
§body: AirRef
§

InfiniteLoop

Infinite loop (produces Never type)

Fields

§body: AirRef
§

Match

Match expression

Fields

§scrutinee: AirRef

The value being matched (scrutinee)

§arms_start: u32

Start index into extra array for match arms

§arms_len: u32

Number of match arms

§

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

Fields

§slot: u32

Local variable slot index (0, 1, 2, …)

§init: AirRef

Initial value

§

Load

Load value from local variable

Fields

§slot: u32

Local variable slot index

§

Store

Store value to local variable

Fields

§slot: u32

Local variable slot index

§value: AirRef

Value to store

§had_live_value: bool

True if the slot held a live (non-moved) value before this assignment. When true, the old value must be dropped before the new value is written. When false (value was moved or this is initial allocation), no drop is needed.

§

ParamStore

Store value to a parameter (for inout params)

Fields

§param_slot: u32

Parameter’s ABI slot (relative to params, not locals)

§value: AirRef

Value to store

§

Ret(Option<AirRef>)

Return from function (None for return; in unit-returning functions)

§

Call

Function call

Fields

§name: Spur

Function name (interned symbol)

§args_start: u32

Start index into extra array for arguments

§args_len: u32

Number of arguments

§

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: Spur

Base function name (interned symbol)

§type_args_start: u32

Start index into extra array for type arguments (raw Type values)

§type_args_len: u32

Number of type arguments

§args_start: u32

Start index into extra array for runtime arguments

§args_len: u32

Number of runtime arguments

§

Intrinsic

Intrinsic call (e.g., @dbg)

Fields

§name: Spur

Intrinsic name (without @, interned)

§args_start: u32

Start index into extra array for arguments

§args_len: u32

Number of arguments

§

Param

Reference to a function parameter

Fields

§index: u32

Parameter index (0-based)

§

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

§stmts_start: u32

Start index into extra array for statement refs

§stmts_len: u32

Number of statements

§value: AirRef

The block’s resulting value

§

StructInit

Create a new struct instance with initialized fields

Fields

§struct_id: StructId

The struct type being created

§fields_start: u32

Start index into extra array for field refs (in declaration order)

§fields_len: u32

Number of fields

§source_order_start: u32

Start index into extra array for source order indices Each entry is an index into fields, specifying evaluation order

§

FieldGet

Load a field from a struct value

Fields

§base: AirRef

The struct value

§struct_id: StructId

The struct type

§field_index: u32

Field index (0-based, in declaration order)

§

FieldSet

Store a value to a struct field (for local variables)

Fields

§slot: u32

The struct variable slot

§struct_id: StructId

The struct type

§field_index: u32

Field index (0-based, in declaration order)

§value: AirRef

Value to store

§

ParamFieldSet

Store a value to a struct field (for parameters, including inout)

Fields

§param_slot: u32

The parameter’s ABI slot (relative to params, not locals)

§inner_offset: u32

Offset within the struct for nested field access (e.g., p.inner.x)

§struct_id: StructId

The struct type containing the field being set

§field_index: u32

Field index (0-based, in declaration order)

§value: AirRef

Value to store

§

ArrayInit

Create a new array with initialized elements. The array type is stored in AirInst.ty as Type::new_array(...).

Fields

§elems_start: u32

Start index into extra array for element refs

§elems_len: u32

Number of elements

§

IndexGet

Load an element from an array. The array type is stored in AirInst.ty.

Fields

§base: AirRef

The array value

§array_type: Type

The array type (for bounds checking and element size)

§index: AirRef

Index expression

§

IndexSet

Store a value to an array element. The array type is stored in AirInst.ty.

Fields

§slot: u32

The array variable slot

§array_type: Type

The array type (for bounds checking and element size)

§index: AirRef

Index expression

§value: AirRef

Value to store

§

ParamIndexSet

Store a value to an array element of an inout parameter. The array type is stored in AirInst.ty.

Fields

§param_slot: u32

The parameter’s ABI slot (relative to params, not locals)

§array_type: Type

The array type (for bounds checking and element size)

§index: AirRef

Index expression

§value: AirRef

Value to store

§

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: AirPlaceRef

Reference 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.

Fields

§place: AirPlaceRef

Reference to the place to write to

§value: AirRef

Value to write

§

EnumVariant

Create an enum variant value (unit variant or any variant of a unit-only enum)

Fields

§enum_id: EnumId

The enum type ID

§variant_index: u32

The variant index (0-based)

§

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

§enum_id: EnumId

The enum type ID

§variant_index: u32

The variant index (0-based)

§fields_start: u32

Start index into extra array for field values

§fields_len: u32

Number of field values

§

EnumPayloadGet

Extract a field value from an enum variant’s payload. Used in data variant match arm bodies to bind pattern variables.

Fields

§base: AirRef

The enum value to extract from

§variant_index: u32

The variant index (must match the enclosing arm’s pattern)

§field_index: u32

The field index within the variant

§

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

§value: AirRef

The value to cast

§from_ty: Type

The source type (for determining signedness and size)

§

FloatCast

Float cast: convert between floating-point types (fptrunc/fpext). The target type is stored in AirInst.ty.

Fields

§value: AirRef

The value to cast

§from_ty: Type

The source float type

§

IntToFloat

Integer to float conversion (sitofp/uitofp). The target type is stored in AirInst.ty.

Fields

§value: AirRef

The integer value to convert

§from_ty: Type

The source integer type (for determining signedness)

§

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.

Fields

§value: AirRef

The float value to convert

§from_ty: Type

The source float type

§

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.

Fields

§value: AirRef

The value to drop

§

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.

Fields

§slot: u32

The slot that becomes live

§

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.

Fields

§slot: u32

The slot that becomes dead

Trait Implementations§

Source§

impl Clone for AirInstData

Source§

fn clone(&self) -> AirInstData

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AirInstData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

§

type Proj<U: 'src> = U

§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

§

impl<'p, T> Seq<'p, T> for T
where T: Clone,

§

type Item<'a> = &'a T where T: 'a

The item yielded by the iterator.
§

type Iter<'a> = Once<&'a T> where T: 'a

An iterator over the items within this container, by reference.
§

fn seq_iter(&self) -> <T as Seq<'p, T>>::Iter<'_>

Iterate over the elements of the container.
§

fn contains(&self, val: &T) -> bool
where T: PartialEq,

Check whether an item is contained within this sequence.
§

fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>
where 'p: 'b,

Convert an item of the sequence into a [MaybeRef].
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> OrderedSeq<'_, T> for T
where T: Clone,