cranelift_codegen::ir::entities

Struct Inst

Source
pub struct Inst(/* private fields */);
Expand description

An opaque reference to an instruction in a Function.

Most usage of Inst is internal. Instructions are returned by InstBuilder instructions that do not return a Value, such as control flow and trap instructions, as well as instructions that return a variable (potentially zero!) number of values, like call or call-indirect instructions. To get the Value of such instructions, use inst_results or its analogue in cranelift_frontend::FuncBuilder.

While the order is stable, it is arbitrary and does not necessarily resemble the layout order.

Implementations§

Source§

impl Inst

Source

pub fn from_u32(x: u32) -> Self

Create a new instance from a u32.

Source

pub fn as_u32(self) -> u32

Return the underlying index value as a u32.

Source

pub fn as_bits(self) -> u32

Return the raw bit encoding for this instance.

Source

pub fn from_bits(x: u32) -> Self

Create a new instance from the raw bit encoding.

Trait Implementations§

Source§

impl Clone for Inst

Source§

fn clone(&self) -> Inst

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 Inst

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Inst

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl EntityRef for Inst

Source§

fn new(index: usize) -> Self

Create a new entity reference from a small integer. This should crash if the requested index is not representable.
Source§

fn index(self) -> usize

Get the index that was used to create this entity reference.
Source§

impl From<Inst> for AnyEntity

Source§

fn from(r: Inst) -> Self

Converts to this type from the input type.
Source§

impl From<Inst> for ProgramPoint

Source§

fn from(inst: Inst) -> Self

Converts to this type from the input type.
Source§

impl Hash for Inst

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Index<Inst> for Insts

Allow immutable access to instructions via indexing.

Source§

type Output = InstructionData

The returned type after indexing.
Source§

fn index(&self, inst: Inst) -> &InstructionData

Performs the indexing (container[index]) operation. Read more
Source§

impl IndexMut<Inst> for Insts

Allow mutable access to instructions via indexing.

Source§

fn index_mut(&mut self, inst: Inst) -> &mut InstructionData

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl Ord for Inst

Source§

fn cmp(&self, other: &Inst) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Inst

Source§

fn eq(&self, other: &Inst) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Inst

Source§

fn partial_cmp(&self, other: &Inst) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl ReservedValue for Inst

Source§

fn reserved_value() -> Inst

Create an instance of the reserved value.
Source§

fn is_reserved_value(&self) -> bool

Checks whether value is the reserved one.
Source§

impl Copy for Inst

Source§

impl Eq for Inst

Source§

impl StructuralPartialEq for Inst

Auto Trait Implementations§

§

impl Freeze for Inst

§

impl RefUnwindSafe for Inst

§

impl Send for Inst

§

impl Sync for Inst

§

impl Unpin for Inst

§

impl UnwindSafe for Inst

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> SparseMapValue<T> for T
where T: EntityRef,

Source§

fn key(&self) -> T

Get the key of this sparse map value. This key is not allowed to change while the value is a member of the map.
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> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.