Skip to main content

CfgInstData

Enum CfgInstData 

Source
pub enum CfgInstData {
Show 39 variants Const(u64), FloatConst(u64), BoolConst(bool), StringConst(u32), BytesConst(u32), Param { index: u32, }, BlockParam { index: u32, }, Bin(BinOp, CfgValue, CfgValue), Unary(UnaryOp, CfgValue), MakeRef { place: Place, is_mut: bool, }, MakeSlice(Box<MakeSliceData>), Alloc { slot: u32, init: CfgValue, }, Load { slot: u32, }, Store { slot: u32, value: CfgValue, }, ParamStore { param_slot: u32, value: CfgValue, }, RefStore { slot: u32, value: CfgValue, }, PlaceRead { place: Place, }, PlaceWrite { place: Place, value: CfgValue, }, Call { name: Spur, args_start: u32, args_len: u32, }, Intrinsic { name: Spur, args_start: u32, args_len: u32, }, StructInit { struct_id: StructId, fields_start: u32, fields_len: u32, }, FieldSet { slot: u32, struct_id: StructId, field_index: u32, value: CfgValue, }, ParamFieldSet { param_slot: u32, inner_offset: u32, struct_id: StructId, field_index: u32, value: CfgValue, }, ArrayInit { elements_start: u32, elements_len: u32, }, IndexSet { slot: u32, array_type: Type, index: CfgValue, value: CfgValue, }, ParamIndexSet { param_slot: u32, array_type: Type, index: CfgValue, value: CfgValue, }, EnumVariant { enum_id: EnumId, variant_index: u32, }, EnumCreate { enum_id: EnumId, variant_index: u32, fields_start: u32, fields_len: u32, }, EnumPayloadGet { base: CfgValue, variant_index: u32, field_index: u32, }, GetDiscriminant { base: CfgValue, }, IntCast { value: CfgValue, from_ty: Type, }, FloatCast { value: CfgValue, from_ty: Type, }, IntToFloat { value: CfgValue, from_ty: Type, }, FloatToInt { value: CfgValue, from_ty: Type, }, Drop { value: CfgValue, }, StorageLive { slot: u32, }, StorageDead { slot: u32, }, MakeInterfaceRef { value: CfgValue, struct_id: StructId, interface_id: InterfaceId, }, MethodCallDyn { interface_id: InterfaceId, slot: u32, recv: CfgValue, args_start: u32, args_len: u32, },
}
Expand description

CFG instruction data.

Unlike AIR, there are NO control flow instructions here. Control flow is handled entirely by terminators.

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)

§

BytesConst(u32)

Byte-blob constant (index into the bytes table). Typed as Slice(u8); lowered to a binary-baked global at codegen.

§

Param

Reference to a function parameter

Fields

§index: u32
§

BlockParam

Block parameter (like phi, but explicit) Only valid at the start of a block

Fields

§index: u32
§

Bin(BinOp, CfgValue, CfgValue)

Binary operation: arithmetic, comparison, or bitwise. Short-circuit And/Or (from RIR/AIR) are lowered to control flow during CFG construction and never appear here.

§

Unary(UnaryOp, CfgValue)

Unary operation: -, !, or ~.

§

MakeRef

Reference construction (ADR-0062): produce the address of a place. is_mut is informational; codegen produces the same alloca pointer (or GEP for projected places) for both immutable and mutable references — the borrow checker has already enforced exclusivity at sema time.

Fields

§place: Place
§is_mut: bool
§

MakeSlice(Box<MakeSliceData>)

Slice construction (ADR-0064): produce a fat pointer {ptr, len} over a sub-range of an array place. The payload is boxed to keep CfgInstData small.

§

Alloc

Allocate local variable with initial value

Fields

§slot: u32
§

Load

Load value from local variable

Fields

§slot: u32
§

Store

Store value to local variable

Fields

§slot: u32
§value: CfgValue
§

ParamStore

Store value to a parameter (for inout params)

Fields

§param_slot: u32
§value: CfgValue
§

RefStore

Bare-name write-through for a MutRef(T)-typed local binding (ADR-0076 Phase 3). Loads the pointer held in the local slot and stores value (typed as the referent T) through that pointer.

Fields

§slot: u32
§value: CfgValue
§

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.

Fields

§place: Place
§

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.

Fields

§place: Place
§value: CfgValue
§

Call

Function call. Arguments are stored in the Cfg’s call_args array. Use Cfg::get_call_args(args_start, args_len) to retrieve them.

Fields

§name: Spur

Function name (interned symbol)

§args_start: u32

Start index into Cfg’s call_args array

§args_len: u32

Number of arguments

§

Intrinsic

Intrinsic call (e.g., @dbg). Arguments are stored in the Cfg’s extra array. Use Cfg::get_extra(args_start, args_len) to retrieve them.

Fields

§name: Spur

Intrinsic name (interned symbol)

§args_start: u32

Start index into Cfg’s extra array

§args_len: u32

Number of arguments

§

StructInit

Struct initialization. Field values are stored in the Cfg’s extra array. Use Cfg::get_extra(fields_start, fields_len) to retrieve them.

Fields

§struct_id: StructId
§fields_start: u32

Start index into Cfg’s extra array

§fields_len: u32

Number of fields

§

FieldSet

Fields

§slot: u32
§struct_id: StructId
§field_index: u32
§value: CfgValue
§

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

§struct_id: StructId
§field_index: u32
§value: CfgValue
§

ArrayInit

Array initialization. Element values are stored in the Cfg’s extra array. Use Cfg::get_extra(elements_start, elements_len) to retrieve them. The array type is stored in CfgInst.ty.

Fields

§elements_start: u32

Start index into Cfg’s extra array

§elements_len: u32

Number of elements

§

IndexSet

Store a value to an array element.

Fields

§slot: u32
§array_type: Type

The array type (for bounds checking and element size)

§index: CfgValue
§value: CfgValue
§

ParamIndexSet

Store a value to an array element of an inout parameter

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

Index expression

§value: CfgValue

Value to store

§

EnumVariant

Create an enum variant (discriminant value) for unit-only enums.

Fields

§enum_id: EnumId
§variant_index: u32
§

EnumCreate

Create a data enum variant with associated field values. Used when the enum has at least one data variant. Field values are stored in the Cfg’s extra array.

Fields

§enum_id: EnumId
§variant_index: u32
§fields_start: u32

Start index into Cfg’s extra array for field CfgValues

§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: CfgValue

The enum value to extract from

§variant_index: u32

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

§field_index: u32

The field index within the variant

§

GetDiscriminant

Extract the discriminant of an enum value as a plain integer. For data enums the LLVM layout is { disc, payload_union } and codegen emits extract_value 0; for unit-only enums the value is the discriminant and codegen is the identity. Used by ADR-0052 cascading pattern dispatch when an enum arm has refutable nested fields — the standalone discriminant check cannot flow into a normal Eq against a struct value.

Fields

§base: CfgValue

The enum value to inspect.

§

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 CfgInst.ty.

Fields

§value: CfgValue

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 CfgInst.ty.

Fields

§value: CfgValue

The value to cast

§from_ty: Type

The source float type

§

IntToFloat

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

Fields

§value: CfgValue

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 CfgInst.ty.

Fields

§value: CfgValue

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 that will be elided.

Fields

§value: CfgValue
§

StorageLive

Marks that a local slot becomes live (storage allocated). The slot is now valid to write to.

Fields

§slot: u32
§

StorageDead

Marks that a local slot becomes dead (storage can be deallocated). The slot is now invalid to read from. Drop elaboration inserts Drop before this if the type needs drop.

Fields

§slot: u32
§

MakeInterfaceRef

Coerce a concrete value to an interface fat pointer (ADR-0056).

Lowered by codegen to a literal { data_ptr, vtable_ptr } struct value. The data pointer addresses the source value (which must outlive this coercion); the vtable pointer is a global constant keyed on (struct_id, interface_id).

Fields

§value: CfgValue

The source value to wrap. Codegen takes its address.

§struct_id: StructId

The concrete struct type of value.

§interface_id: InterfaceId

The target interface.

§

MethodCallDyn

Dynamic-dispatch method call (ADR-0056). Args (excluding the receiver) are stored in the call_args extra array at [args_start..+args_len].

Fields

§interface_id: InterfaceId
§slot: u32
§args_start: u32
§args_len: u32

Trait Implementations§

Source§

impl Clone for CfgInstData

Source§

fn clone(&self) -> CfgInstData

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 CfgInstData

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,