pub enum CfgInstData {
Show 49 variants
Const(u64),
FloatConst(u64),
BoolConst(bool),
StringConst(u32),
Param {
index: u32,
},
BlockParam {
index: u32,
},
Add(CfgValue, CfgValue),
Sub(CfgValue, CfgValue),
Mul(CfgValue, CfgValue),
Div(CfgValue, CfgValue),
Mod(CfgValue, CfgValue),
Eq(CfgValue, CfgValue),
Ne(CfgValue, CfgValue),
Lt(CfgValue, CfgValue),
Gt(CfgValue, CfgValue),
Le(CfgValue, CfgValue),
Ge(CfgValue, CfgValue),
BitAnd(CfgValue, CfgValue),
BitOr(CfgValue, CfgValue),
BitXor(CfgValue, CfgValue),
Shl(CfgValue, CfgValue),
Shr(CfgValue, CfgValue),
Neg(CfgValue),
Not(CfgValue),
BitNot(CfgValue),
Alloc {
slot: u32,
init: CfgValue,
},
Load {
slot: u32,
},
Store {
slot: u32,
value: CfgValue,
},
ParamStore {
param_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,
},
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,
},
}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)
Param
Reference to a function parameter
BlockParam
Block parameter (like phi, but explicit) Only valid at the start of a block
Add(CfgValue, CfgValue)
Sub(CfgValue, CfgValue)
Mul(CfgValue, CfgValue)
Div(CfgValue, CfgValue)
Mod(CfgValue, CfgValue)
Eq(CfgValue, CfgValue)
Ne(CfgValue, CfgValue)
Lt(CfgValue, CfgValue)
Gt(CfgValue, CfgValue)
Le(CfgValue, CfgValue)
Ge(CfgValue, CfgValue)
BitAnd(CfgValue, CfgValue)
BitOr(CfgValue, CfgValue)
BitXor(CfgValue, CfgValue)
Shl(CfgValue, CfgValue)
Shr(CfgValue, CfgValue)
Neg(CfgValue)
Not(CfgValue)
BitNot(CfgValue)
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)
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
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 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.
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 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].