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
BlockParam
Block parameter (like phi, but explicit) Only valid at the start of a block
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.
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
Load
Load value from local variable
Store
Store value to local variable
ParamStore
Store value to a parameter (for inout params)
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.
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.
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.
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: SpurFunction name (interned symbol)
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: SpurIntrinsic name (interned symbol)
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
FieldSet
ParamFieldSet
Store a value to a struct field (for parameters, including inout)
Fields
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.
IndexSet
Store a value to an array element.
Fields
ParamIndexSet
Store a value to an array element of an inout parameter
Fields
EnumVariant
Create an enum variant (discriminant value) for unit-only enums.
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: EnumIdEnumPayloadGet
Extract a field value from an enum variant’s payload. Used in data variant match arm bodies to bind pattern variables.
Fields
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.
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
FloatCast
Float cast: convert between floating-point types (fptrunc/fpext). The target type is stored in CfgInst.ty.
IntToFloat
Integer to float conversion (sitofp/uitofp). The target type is stored in CfgInst.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 CfgInst.ty.
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.
StorageLive
Marks that a local slot becomes live (storage allocated). The slot is now valid to write to.
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.
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
interface_id: InterfaceIdThe 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].
Trait Implementations§
Source§impl Clone for CfgInstData
impl Clone for CfgInstData
Source§fn clone(&self) -> CfgInstData
fn clone(&self) -> CfgInstData
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 CfgInstData
impl RefUnwindSafe for CfgInstData
impl Send for CfgInstData
impl Sync for CfgInstData
impl Unpin for CfgInstData
impl UnsafeUnpin for CfgInstData
impl UnwindSafe for CfgInstData
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].