pub enum InstData {
Show 55 variants
IntConst(u64),
FloatConst(u64),
BoolConst(bool),
CharConst(u32),
StringConst(Spur),
UnitConst,
Bin {
op: BinOp,
lhs: InstRef,
rhs: InstRef,
},
Unary {
op: UnaryOp,
operand: InstRef,
},
MakeRef {
operand: InstRef,
is_mut: bool,
},
BareRangeSubscript,
MakeSlice {
base: InstRef,
lo: Option<InstRef>,
hi: Option<InstRef>,
is_mut: bool,
},
Branch {
cond: InstRef,
then_block: InstRef,
else_block: Option<InstRef>,
is_comptime: bool,
},
Loop {
cond: InstRef,
body: InstRef,
},
For {
binding: Spur,
is_mut: bool,
iterable: InstRef,
body: InstRef,
},
InfiniteLoop {
body: InstRef,
},
Match {
scrutinee: InstRef,
arms_start: u32,
arms_len: u32,
},
Break,
Continue,
FnDecl {
directives_start: u32,
directives_len: u32,
is_pub: bool,
is_unchecked: bool,
name: Spur,
params_start: u32,
params_len: u32,
return_type: Spur,
body: InstRef,
has_self: bool,
receiver_mode: u8,
},
ConstDecl {
directives_start: u32,
directives_len: u32,
is_pub: bool,
name: Spur,
ty: Option<Spur>,
init: InstRef,
},
Call {
name: Spur,
args_start: u32,
args_len: u32,
},
Intrinsic {
name: Spur,
args_start: u32,
args_len: u32,
},
TypeIntrinsic {
name: Spur,
type_arg: Spur,
},
TypeInterfaceIntrinsic {
name: Spur,
type_arg: Spur,
type_inst: Option<InstRef>,
interface_arg: Spur,
},
ParamRef {
index: u32,
name: Spur,
},
Ret(Option<InstRef>),
Block {
extra_start: u32,
len: u32,
},
Alloc {
directives_start: u32,
directives_len: u32,
name: Option<Spur>,
is_mut: bool,
ty: Option<Spur>,
init: InstRef,
},
StructDestructure {
type_name: Spur,
fields_start: u32,
fields_len: u32,
init: InstRef,
},
VarRef {
name: Spur,
},
Assign {
name: Spur,
value: InstRef,
},
StructDecl {
directives_start: u32,
directives_len: u32,
is_pub: bool,
posture: Posture,
name: Spur,
fields_start: u32,
fields_len: u32,
methods_start: u32,
methods_len: u32,
},
StructInit {
module: Option<InstRef>,
type_name: Spur,
fields_start: u32,
fields_len: u32,
},
FieldGet {
base: InstRef,
field: Spur,
},
FieldSet {
base: InstRef,
field: Spur,
value: InstRef,
},
EnumDecl {
is_pub: bool,
posture: Posture,
name: Spur,
variants_start: u32,
variants_len: u32,
methods_start: u32,
methods_len: u32,
directives_start: u32,
directives_len: u32,
},
EnumVariant {
module: Option<InstRef>,
type_name: Spur,
variant: Spur,
},
EnumStructVariant {
module: Option<InstRef>,
type_name: Spur,
variant: Spur,
fields_start: u32,
fields_len: u32,
},
ArrayInit {
elems_start: u32,
elems_len: u32,
},
IndexGet {
base: InstRef,
index: InstRef,
},
IndexSet {
base: InstRef,
index: InstRef,
value: InstRef,
},
MethodCall {
receiver: InstRef,
method: Spur,
args_start: u32,
args_len: u32,
},
AssocFnCall {
type_name: Spur,
function: Spur,
args_start: u32,
args_len: u32,
},
InterfaceDecl {
is_pub: bool,
name: Spur,
methods_start: u32,
methods_len: u32,
directives_start: u32,
directives_len: u32,
},
InterfaceMethodSig {
name: Spur,
params_start: u32,
params_len: u32,
return_type: Spur,
receiver_mode: u8,
is_unchecked: bool,
directives_start: u32,
directives_len: u32,
},
DeriveDecl {
name: Spur,
methods_start: u32,
methods_len: u32,
},
Comptime {
expr: InstRef,
},
ComptimeUnrollFor {
binding: Spur,
iterable: InstRef,
body: InstRef,
},
Checked {
expr: InstRef,
},
TypeConst {
type_name: Spur,
},
AnonStructType {
directives_start: u32,
directives_len: u32,
fields_start: u32,
fields_len: u32,
methods_start: u32,
methods_len: u32,
},
AnonEnumType {
directives_start: u32,
directives_len: u32,
variants_start: u32,
variants_len: u32,
methods_start: u32,
methods_len: u32,
},
AnonInterfaceType {
methods_start: u32,
methods_len: u32,
},
TupleInit {
elems_start: u32,
elems_len: u32,
},
AnonFnValue {
method: InstRef,
},
}Expand description
Instruction data - the actual operation.
Variants§
IntConst(u64)
Integer constant
FloatConst(u64)
Floating-point constant, stored as f64 bits for Eq/Hash/Copy compatibility.
Use f64::from_bits() to recover the value.
BoolConst(bool)
Boolean constant
CharConst(u32)
Char constant — Unicode scalar value (ADR-0071).
StringConst(Spur)
String constant (interned string content)
UnitConst
Unit constant (for blocks that produce unit type)
Bin
Binary operation: lhs <op> rhs. Covers arithmetic, comparison,
logical, and bitwise ops. The specific op is in BinOp. Logical
And/Or are short-circuiting and are lowered to control flow
during CFG construction.
Unary
Unary operation: <op> operand. Covers -, !, and ~.
MakeRef
Reference construction (ADR-0062): &x (is_mut = false) or
&mut x (is_mut = true). Operand must be an lvalue. Result type
is Ref(T) or MutRef(T) where T is the operand’s type.
BareRangeSubscript
ADR-0064: a range-shaped subscript that wasn’t borrowed by & or
&mut. There is no slice value without a borrow, so this carries
no operands; sema reports the error and continues.
MakeSlice
Slice construction by borrow over a range subscript (ADR-0064).
Lowered from &arr[range] (is_mut = false) and
&mut arr[range] (is_mut = true). The base must be an lvalue
of array type. lo and hi are the range endpoints; None means
the implicit default (0 for lo, arr.len() for hi).
Branch
Branch: if cond then then_block else else_block
Fields
is_comptime: boolADR-0079 follow-up: when set, sema evaluates cond at
comptime and emits only the chosen branch — the
discarded branch is never analyzed (so it’s free to
reference shapes that don’t apply to the surrounding
type, e.g. @uninit(Self) inside a struct-only branch
when Self is enum). Source form: comptime if cond { … }.
Loop
While loop: while cond { body }
For
For-in loop: for [mut] binding in iterable { body }
Fields
binding: SpurThe loop variable name
InfiniteLoop
Infinite loop: loop { body }
Match
Match expression: match scrutinee { pattern => expr, … } Arms are stored in the extra array using add_match_arms/get_match_arms.
Fields
Break
Break: exits the innermost loop
Continue
Continue: jumps to the next iteration of the innermost loop
FnDecl
Function definition Contains: name symbol, parameters, return type symbol, body instruction ref Directives and params are stored in the extra array.
Fields
is_unchecked: boolWhether this function is marked unchecked (can only be called from checked blocks)
name: Spurreturn_type: SpurConstDecl
Constant declaration
Contains: name symbol, optional type, initializer expression ref
Directives are stored in the extra array.
Used for module re-exports: pub const strings = @import("utils/strings.gruel");
Fields
name: SpurConstant name
Call
Function call Args are stored in the extra array using add_call_args/get_call_args.
Fields
name: SpurFunction name
Intrinsic
Intrinsic call with expression arguments (e.g., @dbg) Args are stored in the extra array using add_inst_refs/get_inst_refs.
Fields
name: SpurIntrinsic name (without @)
TypeIntrinsic
Intrinsic call with a type argument (e.g., @size_of, @align_of)
Fields
name: SpurIntrinsic name (without @)
type_arg: SpurType argument (as an interned string, e.g., “i32”, “Point”, “[i32; 4]”)
TypeInterfaceIntrinsic
Intrinsic call with a type argument and an interface argument
(e.g., @implements(T, Drop)).
type_arg is the interned name when the source has a bare
type name or type expression. type_inst, when Some, is an
arbitrary expression that comptime-evaluates to a Type
value (e.g. f.field_type projecting out of @type_info).
Sema prefers type_inst when set.
Fields
name: SpurIntrinsic name (without @)
type_arg: SpurType argument (interned name).
type_inst: Option<InstRef>Optional comptime-evaluable type expression. When set,
supersedes type_arg.
interface_arg: SpurInterface argument (interned name).
ParamRef
Reference to a function parameter
Ret(Option<InstRef>)
Return value from function (None for return; in unit-returning functions)
Block
Block of instructions (for function bodies) The result is the last instruction in the block
Fields
Alloc
Local variable declaration: allocates storage and initializes If name is None, this is a wildcard pattern that discards the value Directives are stored in the extra array using add_directives/get_directives.
Fields
StructDestructure
Struct destructuring: let TypeName { fields } = expr;
Fields are stored in the extra array as groups of 4 u32s:
[field_name, binding_name (0 = shorthand), is_wildcard, is_mut]
Fields
type_name: SpurStruct type name
VarRef
Variable reference: reads the value of a variable
Fields
name: SpurVariable name
Assign
Assignment: stores a value into a mutable variable
StructDecl
Struct type declaration Directives, fields, and methods are stored in the extra array.
Fields
posture: PostureDeclared ownership posture (ADR-0080). Affine when neither
@mark(copy) nor @mark(linear) appears in the directive list.
name: SpurStruct name
StructInit
Struct literal: creates a new struct instance Fields are stored in the extra array using add_field_inits/get_field_inits.
Fields
module: Option<InstRef>Optional module reference (for qualified struct literals like module.Point { ... })
If Some, the struct is looked up in the module’s exports.
type_name: SpurStruct type name
FieldGet
Field access: reads a field from a struct
FieldSet
Field assignment: writes a value to a struct field
EnumDecl
Enum type declaration Variants are stored in the extra array using add_enum_variant_decls/get_enum_variant_decls. Each variant encodes: [name_spur, field_count, field_type_0, …, field_type_n].
Fields
posture: PostureDeclared ownership posture (ADR-0080). Affine when neither
@mark(copy) nor @mark(linear) appears in the directive list.
name: SpurEnum name
EnumVariant
Enum variant: creates a value of an enum type
Fields
module: Option<InstRef>Optional module reference (for qualified paths like module.Color::Red)
If Some, the enum is looked up in the module’s exports.
type_name: SpurEnum type name
variant: SpurVariant name
EnumStructVariant
Enum struct variant construction: Enum::Variant { field: value, ... }
Fields are stored in the extra array using add_field_inits/get_field_inits.
ArrayInit
Array literal: creates a new array from element values Elements are stored in the extra array using add_inst_refs/get_inst_refs.
IndexGet
Array index read: reads an element from an array
IndexSet
Array index write: writes a value to an array element
Fields
MethodCall
Method call: receiver.method(args) Args are stored in the extra array using add_call_args/get_call_args.
Fields
method: SpurMethod name
AssocFnCall
Associated function call: Type::function(args) Args are stored in the extra array using add_call_args/get_call_args.
InterfaceDecl
Interface declaration (ADR-0056): a structurally typed set of method requirements.
Method signatures are stored as InstRefs to InterfaceMethodSig
instructions in the inst-refs extra array.
Fields
name: SpurInterface name.
InterfaceMethodSig
A single method signature inside an InterfaceDecl.
No body. The receiver is always present (interface methods cannot
be associated functions in MVP); its surface shape (self,
self : MutRef(Self), or self : Ref(Self)) is encoded in
receiver_mode using the byte mapping 0/1/2.
Fields
name: SpurMethod name.
return_type: SpurReturn type symbol (() if none was written).
DeriveDecl
Derive declaration (ADR-0058): derive Name { fn ... }.
Holds a list of method declarations (each emitted as a FnDecl
instruction with has_self set when the method takes self). When a
@derive(Name) directive on a struct or enum names this derive, the
methods are spliced into the host type’s method list with Self
bound to the host.
Fields
name: SpurDerive name (e.g., Drop).
Comptime
Comptime block expression: comptime { expr } The inner expression must be evaluable at compile time.
ComptimeUnrollFor
Comptime unroll for loop: comptime_unroll for binding in iterable { body } The iterable must be evaluable at compile time. The body is duplicated once per iteration with the binding replaced by each element’s value.
Fields
binding: SpurThe loop variable name
Checked
Checked block expression: checked { expr } Unchecked operations (raw pointer manipulation, calling unchecked functions) are only allowed inside checked blocks.
TypeConst
Type constant: a type used as a value expression (e.g., i32 in identity(i32, 42))
The type_name is the symbol for the type (e.g., “i32”, “bool”).
Fields
type_name: SpurThe type name symbol
AnonStructType
Anonymous struct type: a struct type used as a value expression
(e.g., struct { first: T, second: T, fn method(self) -> T { ... } } in comptime type construction)
Fields are stored in the extra array using add_field_decls/get_field_decls.
Methods are stored as InstRefs to FnDecl instructions in the extra array.
Fields
AnonEnumType
Anonymous enum type: an enum type used as a value expression
(e.g., enum { Some(T), None, fn method(self) -> T { ... } } in comptime type construction)
Variants are stored in the extra array using add_enum_variant_decls/get_enum_variant_decls.
Methods are stored as InstRefs to FnDecl instructions in the extra array.
Fields
AnonInterfaceType
Anonymous interface type (ADR-0057): an interface type used as a value expression inside a comptime function body.
The methods are stored as InstRefs to InterfaceMethodSig instructions
in the inst-refs extra array, mirroring InterfaceDecl for named
interfaces.
Fields
TupleInit
Tuple literal: (e0, e1, ..., eN-1) (ADR-0048).
Lowered in sema to a StructInit against a synthesised anon struct
with field names “0”, “1”, … and field types inferred from the elements.
Elements are stored as raw u32 InstRefs in the extra array.
Tuple field access t.N is not a distinct RIR instruction; astgen
lowers it to a regular FieldGet whose field is the stringified index
interned as a Spur. Struct field names are identifiers (never start with
a digit), so synthetic tuple field names cannot collide with user code.
Fields
AnonFnValue
Anonymous function value (ADR-0055). Lowered in sema to a fresh
lambda-tagged anon struct with zero fields and one __call method,
then instantiated as an empty StructInit. The struct type is unique
per-site — sema skips structural dedup for lambda-origin structs so
two same-signature fn(...) expressions produce distinct types.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for InstData
impl<'de> Deserialize<'de> for InstData
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for InstData
impl RefUnwindSafe for InstData
impl Send for InstData
impl Sync for InstData
impl Unpin for InstData
impl UnsafeUnpin for InstData
impl UnwindSafe for InstData
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<'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].