Enum MirInstr

Source
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: MirLocalId

Destination local receiving the unit constant. Destination local receiving the result.

§

ConstInt

Write integer constant into dst.

Fields

§dst: MirLocalId

Destination local receiving the integer constant. Destination local receiving the result.

§value: i64

Constant integer value.

§

ConstFloat

Write floating-point constant into dst.

Fields

§dst: MirLocalId

Destination local receiving the floating-point constant.

§value: f64

Constant floating-point value.

§

ConstString

Write string constant into dst.

Fields

§dst: MirLocalId

Destination local receiving the string constant. Destination local receiving the result.

§value: String

Constant string contents.

§

ConstBool

Write boolean constant into dst.

Fields

§dst: MirLocalId

Destination local receiving the boolean constant. Destination local receiving the result.

§value: bool

Constant boolean value.

§

ConstNull

Write null pointer constant into dst.

Fields

§dst: MirLocalId

Destination local receiving the null pointer value. Destination local receiving the result.

§

PointerNew

Allocate pointer payload and wrap in nullable handle.

Fields

§src: MirLocalId

Source local providing the pointee value. Source local supplying the stored value.

§dst: MirLocalId

Destination 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: MirLocalId

Destination 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: MirLocalId

Destination local receiving the result.

§source_pos: Option<MirSourcePos>

Optional source position for the allocation site.

§

MakeStruct

Build struct literal value.

Fields

§name: String

Struct constructor name to instantiate.

§fields: Vec<(String, MirLocalId)>

Field values keyed by field name.

§dst: MirLocalId

Destination local receiving the result.

§source_pos: Option<MirSourcePos>

Optional source position for the allocation site.

§

MakeEnum

Build enum literal value.

Fields

§enum_name: String

Enum constructor name to instantiate.

§variant: String

Variant constructor name to instantiate.

§payload: Vec<MirAggregateArg>

Variant payload argument values.

§dst: MirLocalId

Destination local receiving the result.

§source_pos: Option<MirSourcePos>

Optional source position for the allocation site.

§

ReadField

Read field from struct value.

Fields

§base: MirLocalId

Base local supplying the aggregate value.

§field: String

Field name being read from the aggregate.

§dst: MirLocalId

Destination local receiving the result.

§

FieldBorrowRo

Borrow struct/tuple field read-only.

Fields

§base: MirLocalId

Base local supplying the aggregate value.

§field: String

Field name being borrowed from the aggregate.

§dst: MirLocalId

Destination local receiving the result.

§

FieldBorrowMut

Borrow struct/tuple field mutably.

Fields

§base: MirLocalId

Base local supplying the aggregate value.

§field: String

Field name being borrowed from the aggregate.

§dst: MirLocalId

Destination local receiving the result.

§

EnumIsVariant

Test whether enum value currently stores a specific variant.

Fields

§value: MirLocalId

Enum local being inspected.

§enum_name: String

Enum constructor name being tested.

§variant: String

Variant constructor name being tested.

§payload_len: usize

Number of payload fields declared on the tested variant.

§dst: MirLocalId

Destination local receiving the result.

§

EnumGetField

Extract one enum payload field by variant/index.

Fields

§value: MirLocalId

Enum local being inspected.

§enum_name: String

Enum constructor name being extracted from.

§variant: String

Variant constructor name being extracted from.

§index: usize

Payload field index within the variant.

§dst: MirLocalId

Destination local receiving the extracted field.

§

Copy

Logical copy from src into dst.

Fields

§src: MirLocalId

Source local being copied. Source local supplying the stored value.

§dst: MirLocalId

Destination local receiving the copied value.

§

Move

Ownership move from src into dst.

Fields

§src: MirLocalId

Source local being moved. Source local supplying the stored value.

§dst: MirLocalId

Destination local receiving the moved value.

§

AssignLocal

Assign local storage from src into dst.

Fields

§src: MirLocalId

Source local being assigned from. Source local supplying the stored value.

§dst: MirLocalId

Destination local being assigned to.

§

StoreRef

Store value through mutable reference local.

Fields

§src: MirLocalId

Source local supplying the stored value.

§dst_ref: MirLocalId

Destination mutable reference local.

§

AssignFieldPath

Assign through a struct field path rooted at base.

Fields

§base: MirLocalId

Base local supplying the aggregate value.

§fields: Vec<String>

Field path traversed from the base local.

§src: MirLocalId

Source 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: MirLocalId

Local whose heap ownership should be released.

§

Call

Internal function call.

Fields

§callee: MirFuncId

Function id of the callee.

§args: Vec<MirCallArg>

Positional call arguments.

§dst: MirLocalId

Destination local receiving the result.

§

CallExtern

Extern/runtime symbol call.

Fields

§symbol: String

Canonical symbol name of the extern/runtime function.

§args: Vec<MirCallArg>

Positional call arguments.

§dst: MirLocalId

Destination local receiving the result.

§

CallIntrinsic

Builtin intrinsic call.

Fields

§intrinsic: MirIntrinsic

Intrinsic to invoke.

§args: Vec<MirCallArg>

Positional call arguments.

§dst: MirLocalId

Destination local receiving the result.

§source_pos: Option<MirSourcePos>

Optional source position for the call site.

§

CollectionLen

Collection length query.

Fields

§collection: MirLocalId

Collection local being queried or borrowed from.

§dst: MirLocalId

Destination local receiving the result.

§

IndexBorrowRo

Borrow collection element read-only.

Fields

§collection: MirLocalId

Collection local being queried or borrowed from.

§index: MirLocalId

Index local selecting an element.

§dst: MirLocalId

Destination local receiving the result.

§

IndexBorrowMut

Borrow collection element mutably.

Fields

§collection: MirLocalId

Collection local being queried or borrowed from.

§index: MirLocalId

Index local selecting an element.

§dst: MirLocalId

Destination local receiving the result.

§

SliceBorrowRo

Borrow collection range read-only as a slice.

Fields

§collection: MirLocalId

Collection local being queried or borrowed from.

§start: Option<MirLocalId>

Optional start bound local.

§end: Option<MirLocalId>

Optional end bound local.

§dst: MirLocalId

Destination local receiving the result.

§

SliceBorrowMut

Borrow collection range mutably as a slice.

Fields

§collection: MirLocalId

Collection local being queried or borrowed from.

§start: Option<MirLocalId>

Optional start bound local.

§end: Option<MirLocalId>

Optional end bound local.

§dst: MirLocalId

Destination local receiving the result.

§

PointerIsSome

Test whether nullable pointer is non-null.

Fields

§pointer: MirLocalId

Pointer local being inspected or borrowed from.

§dst: MirLocalId

Destination local receiving the result.

§

PointerBorrowRo

Borrow nullable pointer payload read-only.

Fields

§pointer: MirLocalId

Pointer local being inspected or borrowed from.

§dst: MirLocalId

Destination local receiving the result.

§

PointerBorrowMut

Borrow nullable pointer payload mutably.

Fields

§pointer: MirLocalId

Pointer local being inspected or borrowed from.

§dst: MirLocalId

Destination local receiving the result.

§

DerefCopy

Copy value from a reference local.

Fields

§src: MirLocalId

Source reference local being dereferenced.

§dst: MirLocalId

Destination local receiving the copied value.

§

NumCast

Numeric value cast to another scalar numeric type.

Fields

§src: MirLocalId

Source local supplying the input value.

§dst: MirLocalId

Destination local receiving the cast result.

§

CheckedIntCast

Checked integer cast that traps when value does not fit destination range.

Fields

§src: MirLocalId

Source local supplying the input value.

§dst: MirLocalId

Destination local receiving the cast result.

§

IntLt

Integer less-than comparison.

Fields

§lhs: MirLocalId

Left-hand operand local.

§rhs: MirLocalId

Right-hand operand local.

§dst: MirLocalId

Destination local receiving the result.

§

IntGt

Integer greater-than comparison.

Fields

§lhs: MirLocalId

Left-hand operand local.

§rhs: MirLocalId

Right-hand operand local.

§dst: MirLocalId

Destination local receiving the result.

§

IntLtEq

Integer less-than-or-equal comparison.

Fields

§lhs: MirLocalId

Left-hand operand local.

§rhs: MirLocalId

Right-hand operand local.

§dst: MirLocalId

Destination local receiving the result.

§

IntGtEq

Integer greater-than-or-equal comparison.

Fields

§lhs: MirLocalId

Left-hand operand local.

§rhs: MirLocalId

Right-hand operand local.

§dst: MirLocalId

Destination local receiving the result.

§

IntEq

Integer equality comparison.

Fields

§lhs: MirLocalId

Left-hand operand local.

§rhs: MirLocalId

Right-hand operand local.

§dst: MirLocalId

Destination local receiving the result.

§

IntNeq

Integer inequality comparison.

Fields

§lhs: MirLocalId

Left-hand operand local.

§rhs: MirLocalId

Right-hand operand local.

§dst: MirLocalId

Destination local receiving the result.

§

IntAdd

Integer addition.

Fields

§lhs: MirLocalId

Left-hand operand local.

§rhs: MirLocalId

Right-hand operand local.

§dst: MirLocalId

Destination local receiving the result.

§

IntSub

Integer subtraction.

Fields

§lhs: MirLocalId

Left-hand operand local.

§rhs: MirLocalId

Right-hand operand local.

§dst: MirLocalId

Destination local receiving the result.

§

IntMul

Integer multiplication.

Fields

§lhs: MirLocalId

Left-hand operand local.

§rhs: MirLocalId

Right-hand operand local.

§dst: MirLocalId

Destination local receiving the result.

§

IntDiv

Integer division.

Fields

§lhs: MirLocalId

Left-hand operand local.

§rhs: MirLocalId

Right-hand operand local.

§dst: MirLocalId

Destination local receiving the result.

§

IntMod

Integer modulo.

Fields

§lhs: MirLocalId

Left-hand operand local.

§rhs: MirLocalId

Right-hand operand local.

§dst: MirLocalId

Destination local receiving the result.

Trait Implementations§

Source§

impl Clone for MirInstr

Source§

fn clone(&self) -> MirInstr

Returns a copy 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 MirInstr

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.

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.

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.