pub enum MirInstr {
Show 47 variants
ConstUnit {
dst: MirLocalId,
},
ConstInt {
dst: MirLocalId,
value: i64,
},
ConstFloat {
dst: MirLocalId,
value: f64,
},
ConstString {
dst: MirLocalId,
value: String,
},
ConstBool {
dst: MirLocalId,
value: bool,
},
ConstNull {
dst: MirLocalId,
},
PointerNew {
src: MirLocalId,
dst: MirLocalId,
},
MakeArray {
items: Vec<MirAggregateArg>,
dst: MirLocalId,
source_pos: Option<MirSourcePos>,
},
MakeTuple {
items: Vec<MirAggregateArg>,
dst: MirLocalId,
source_pos: Option<MirSourcePos>,
},
MakeStruct {
name: String,
fields: Vec<(String, MirLocalId)>,
dst: MirLocalId,
source_pos: Option<MirSourcePos>,
},
MakeEnum {
enum_name: String,
variant: String,
payload: Vec<MirAggregateArg>,
dst: MirLocalId,
source_pos: Option<MirSourcePos>,
},
ReadField {
base: MirLocalId,
field: String,
dst: MirLocalId,
},
FieldBorrowRo {
base: MirLocalId,
field: String,
dst: MirLocalId,
},
FieldBorrowMut {
base: MirLocalId,
field: String,
dst: MirLocalId,
},
EnumIsVariant {
value: MirLocalId,
enum_name: String,
variant: String,
payload_len: usize,
dst: MirLocalId,
},
EnumGetField {
value: MirLocalId,
enum_name: String,
variant: String,
index: usize,
dst: MirLocalId,
},
Copy {
src: MirLocalId,
dst: MirLocalId,
},
Move {
src: MirLocalId,
dst: MirLocalId,
},
AssignLocal {
src: MirLocalId,
dst: MirLocalId,
},
StoreRef {
src: MirLocalId,
dst_ref: MirLocalId,
},
AssignFieldPath {
base: MirLocalId,
fields: Vec<String>,
src: MirLocalId,
},
ReleaseHeap {
local: MirLocalId,
},
Call {
callee: MirFuncId,
args: Vec<MirCallArg>,
dst: MirLocalId,
},
CallExtern {
symbol: String,
args: Vec<MirCallArg>,
dst: MirLocalId,
},
CallIntrinsic {
intrinsic: MirIntrinsic,
args: Vec<MirCallArg>,
dst: MirLocalId,
source_pos: Option<MirSourcePos>,
},
CollectionLen {
collection: MirLocalId,
dst: MirLocalId,
},
IndexBorrowRo {
collection: MirLocalId,
index: MirLocalId,
dst: MirLocalId,
},
IndexBorrowMut {
collection: MirLocalId,
index: MirLocalId,
dst: MirLocalId,
},
SliceBorrowRo {
collection: MirLocalId,
start: Option<MirLocalId>,
end: Option<MirLocalId>,
dst: MirLocalId,
},
SliceBorrowMut {
collection: MirLocalId,
start: Option<MirLocalId>,
end: Option<MirLocalId>,
dst: MirLocalId,
},
PointerIsSome {
pointer: MirLocalId,
dst: MirLocalId,
},
PointerBorrowRo {
pointer: MirLocalId,
dst: MirLocalId,
},
PointerBorrowMut {
pointer: MirLocalId,
dst: MirLocalId,
},
DerefCopy {
src: MirLocalId,
dst: MirLocalId,
},
NumCast {
src: MirLocalId,
dst: MirLocalId,
},
CheckedIntCast {
src: MirLocalId,
dst: MirLocalId,
},
IntLt {
lhs: MirLocalId,
rhs: MirLocalId,
dst: MirLocalId,
},
IntGt {
lhs: MirLocalId,
rhs: MirLocalId,
dst: MirLocalId,
},
IntLtEq {
lhs: MirLocalId,
rhs: MirLocalId,
dst: MirLocalId,
},
IntGtEq {
lhs: MirLocalId,
rhs: MirLocalId,
dst: MirLocalId,
},
IntEq {
lhs: MirLocalId,
rhs: MirLocalId,
dst: MirLocalId,
},
IntNeq {
lhs: MirLocalId,
rhs: MirLocalId,
dst: MirLocalId,
},
IntAdd {
lhs: MirLocalId,
rhs: MirLocalId,
dst: MirLocalId,
},
IntSub {
lhs: MirLocalId,
rhs: MirLocalId,
dst: MirLocalId,
},
IntMul {
lhs: MirLocalId,
rhs: MirLocalId,
dst: MirLocalId,
},
IntDiv {
lhs: MirLocalId,
rhs: MirLocalId,
dst: MirLocalId,
},
IntMod {
lhs: MirLocalId,
rhs: MirLocalId,
dst: MirLocalId,
},
}Expand description
MIR instruction set used by lowering and codegen.
This is the canonical instruction representation stored in blocks.
Variants§
ConstUnit
Write unit constant into dst.
Fields
dst: MirLocalIdDestination local receiving the unit constant. Destination local receiving the result.
ConstInt
Write integer constant into dst.
Fields
dst: MirLocalIdDestination local receiving the integer constant. Destination local receiving the result.
ConstFloat
Write floating-point constant into dst.
Fields
dst: MirLocalIdDestination local receiving the floating-point constant.
ConstString
Write string constant into dst.
Fields
dst: MirLocalIdDestination local receiving the string constant. Destination local receiving the result.
ConstBool
Write boolean constant into dst.
Fields
dst: MirLocalIdDestination local receiving the boolean constant. Destination local receiving the result.
ConstNull
Write null pointer constant into dst.
Fields
dst: MirLocalIdDestination local receiving the null pointer value. Destination local receiving the result.
PointerNew
Allocate pointer payload and wrap in nullable handle.
Fields
src: MirLocalIdSource local providing the pointee value. Source local supplying the stored value.
dst: MirLocalIdDestination local receiving the pointer handle. Destination local receiving the result.
MakeArray
Build array literal from items into dst.
Fields
items: Vec<MirAggregateArg>Aggregate arguments used to build the array.
dst: MirLocalIdDestination local receiving the result.
source_pos: Option<MirSourcePos>Optional source position for the allocation site.
MakeTuple
Build tuple literal from items into dst.
Fields
items: Vec<MirAggregateArg>Aggregate arguments used to build the tuple.
dst: MirLocalIdDestination local receiving the result.
source_pos: Option<MirSourcePos>Optional source position for the allocation site.
MakeStruct
Build struct literal value.
Fields
fields: Vec<(String, MirLocalId)>Field values keyed by field name.
dst: MirLocalIdDestination local receiving the result.
source_pos: Option<MirSourcePos>Optional source position for the allocation site.
MakeEnum
Build enum literal value.
Fields
payload: Vec<MirAggregateArg>Variant payload argument values.
dst: MirLocalIdDestination local receiving the result.
source_pos: Option<MirSourcePos>Optional source position for the allocation site.
ReadField
Read field from struct value.
Fields
base: MirLocalIdBase local supplying the aggregate value.
dst: MirLocalIdDestination local receiving the result.
FieldBorrowRo
Borrow struct/tuple field read-only.
Fields
base: MirLocalIdBase local supplying the aggregate value.
dst: MirLocalIdDestination local receiving the result.
FieldBorrowMut
Borrow struct/tuple field mutably.
Fields
base: MirLocalIdBase local supplying the aggregate value.
dst: MirLocalIdDestination local receiving the result.
EnumIsVariant
Test whether enum value currently stores a specific variant.
Fields
value: MirLocalIdEnum local being inspected.
dst: MirLocalIdDestination local receiving the result.
EnumGetField
Extract one enum payload field by variant/index.
Fields
value: MirLocalIdEnum local being inspected.
dst: MirLocalIdDestination local receiving the extracted field.
Copy
Logical copy from src into dst.
Fields
src: MirLocalIdSource local being copied. Source local supplying the stored value.
dst: MirLocalIdDestination local receiving the copied value.
Move
Ownership move from src into dst.
Fields
src: MirLocalIdSource local being moved. Source local supplying the stored value.
dst: MirLocalIdDestination local receiving the moved value.
AssignLocal
Assign local storage from src into dst.
Fields
src: MirLocalIdSource local being assigned from. Source local supplying the stored value.
dst: MirLocalIdDestination local being assigned to.
StoreRef
Store value through mutable reference local.
Fields
src: MirLocalIdSource local supplying the stored value.
dst_ref: MirLocalIdDestination mutable reference local.
AssignFieldPath
Assign through a struct field path rooted at base.
Fields
base: MirLocalIdBase local supplying the aggregate value.
src: MirLocalIdSource local supplying the stored value.
ReleaseHeap
Release one retained heap ownership for local.
Lowering defines this instruction now so later ownership passes can place releases explicitly without changing MIR shape again.
Fields
local: MirLocalIdLocal whose heap ownership should be released.
Call
Internal function call.
Fields
args: Vec<MirCallArg>Positional call arguments.
dst: MirLocalIdDestination local receiving the result.
CallExtern
Extern/runtime symbol call.
Fields
args: Vec<MirCallArg>Positional call arguments.
dst: MirLocalIdDestination local receiving the result.
CallIntrinsic
Builtin intrinsic call.
Fields
intrinsic: MirIntrinsicIntrinsic to invoke.
args: Vec<MirCallArg>Positional call arguments.
dst: MirLocalIdDestination local receiving the result.
source_pos: Option<MirSourcePos>Optional source position for the call site.
CollectionLen
Collection length query.
Fields
collection: MirLocalIdCollection local being queried or borrowed from.
dst: MirLocalIdDestination local receiving the result.
IndexBorrowRo
Borrow collection element read-only.
Fields
collection: MirLocalIdCollection local being queried or borrowed from.
index: MirLocalIdIndex local selecting an element.
dst: MirLocalIdDestination local receiving the result.
IndexBorrowMut
Borrow collection element mutably.
Fields
collection: MirLocalIdCollection local being queried or borrowed from.
index: MirLocalIdIndex local selecting an element.
dst: MirLocalIdDestination local receiving the result.
SliceBorrowRo
Borrow collection range read-only as a slice.
Fields
collection: MirLocalIdCollection local being queried or borrowed from.
start: Option<MirLocalId>Optional start bound local.
end: Option<MirLocalId>Optional end bound local.
dst: MirLocalIdDestination local receiving the result.
SliceBorrowMut
Borrow collection range mutably as a slice.
Fields
collection: MirLocalIdCollection local being queried or borrowed from.
start: Option<MirLocalId>Optional start bound local.
end: Option<MirLocalId>Optional end bound local.
dst: MirLocalIdDestination local receiving the result.
PointerIsSome
Test whether nullable pointer is non-null.
Fields
pointer: MirLocalIdPointer local being inspected or borrowed from.
dst: MirLocalIdDestination local receiving the result.
PointerBorrowRo
Borrow nullable pointer payload read-only.
Fields
pointer: MirLocalIdPointer local being inspected or borrowed from.
dst: MirLocalIdDestination local receiving the result.
PointerBorrowMut
Borrow nullable pointer payload mutably.
Fields
pointer: MirLocalIdPointer local being inspected or borrowed from.
dst: MirLocalIdDestination local receiving the result.
DerefCopy
Copy value from a reference local.
Fields
src: MirLocalIdSource reference local being dereferenced.
dst: MirLocalIdDestination local receiving the copied value.
NumCast
Numeric value cast to another scalar numeric type.
Fields
src: MirLocalIdSource local supplying the input value.
dst: MirLocalIdDestination local receiving the cast result.
CheckedIntCast
Checked integer cast that traps when value does not fit destination range.
Fields
src: MirLocalIdSource local supplying the input value.
dst: MirLocalIdDestination local receiving the cast result.
IntLt
Integer less-than comparison.
Fields
lhs: MirLocalIdLeft-hand operand local.
rhs: MirLocalIdRight-hand operand local.
dst: MirLocalIdDestination local receiving the result.
IntGt
Integer greater-than comparison.
Fields
lhs: MirLocalIdLeft-hand operand local.
rhs: MirLocalIdRight-hand operand local.
dst: MirLocalIdDestination local receiving the result.
IntLtEq
Integer less-than-or-equal comparison.
Fields
lhs: MirLocalIdLeft-hand operand local.
rhs: MirLocalIdRight-hand operand local.
dst: MirLocalIdDestination local receiving the result.
IntGtEq
Integer greater-than-or-equal comparison.
Fields
lhs: MirLocalIdLeft-hand operand local.
rhs: MirLocalIdRight-hand operand local.
dst: MirLocalIdDestination local receiving the result.
IntEq
Integer equality comparison.
Fields
lhs: MirLocalIdLeft-hand operand local.
rhs: MirLocalIdRight-hand operand local.
dst: MirLocalIdDestination local receiving the result.
IntNeq
Integer inequality comparison.
Fields
lhs: MirLocalIdLeft-hand operand local.
rhs: MirLocalIdRight-hand operand local.
dst: MirLocalIdDestination local receiving the result.
IntAdd
Integer addition.
Fields
lhs: MirLocalIdLeft-hand operand local.
rhs: MirLocalIdRight-hand operand local.
dst: MirLocalIdDestination local receiving the result.
IntSub
Integer subtraction.
Fields
lhs: MirLocalIdLeft-hand operand local.
rhs: MirLocalIdRight-hand operand local.
dst: MirLocalIdDestination local receiving the result.
IntMul
Integer multiplication.
Fields
lhs: MirLocalIdLeft-hand operand local.
rhs: MirLocalIdRight-hand operand local.
dst: MirLocalIdDestination local receiving the result.
IntDiv
Integer division.
Fields
lhs: MirLocalIdLeft-hand operand local.
rhs: MirLocalIdRight-hand operand local.
dst: MirLocalIdDestination local receiving the result.
IntMod
Integer modulo.
Fields
lhs: MirLocalIdLeft-hand operand local.
rhs: MirLocalIdRight-hand operand local.
dst: MirLocalIdDestination local receiving the result.