cranelift_codegen::ir::instructions

Struct OpcodeConstraints

Source
pub struct OpcodeConstraints { /* private fields */ }
Expand description

Value type constraints for a given opcode.

The InstructionFormat determines the constraints on most operands, but Value operands and results are not determined by the format. Every Opcode has an associated OpcodeConstraints object that provides the missing details.

Implementations§

Source§

impl OpcodeConstraints

Source

pub fn use_typevar_operand(self) -> bool

Can the controlling type variable for this opcode be inferred from the designated value input operand? This also implies that this opcode is polymorphic.

Source

pub fn requires_typevar_operand(self) -> bool

Is it necessary to look at the designated value input operand in order to determine the controlling type variable, or is it good enough to use the first return type?

Most polymorphic instructions produce a single result with the type of the controlling type variable. A few polymorphic instructions either don’t produce any results, or produce results with a fixed type. These instructions return true.

Source

pub fn num_fixed_results(self) -> usize

Get the number of fixed result values produced by this opcode. This does not include variable_args produced by calls.

Source

pub fn num_fixed_value_arguments(self) -> usize

Get the number of fixed input values required by this opcode.

This does not include variable_args arguments on call and branch instructions.

The number of fixed input values is usually implied by the instruction format, but instruction formats that use a ValueList put both fixed and variable arguments in the list. This method returns the minimum number of values required in the value list.

Source

pub fn result_type(self, n: usize, ctrl_type: Type) -> Type

Get the value type of result number n, having resolved the controlling type variable to ctrl_type.

Source

pub fn value_argument_constraint( self, n: usize, ctrl_type: Type, ) -> ResolvedConstraint

Get the value type of input value number n, having resolved the controlling type variable to ctrl_type.

Unlike results, it is possible for some input values to vary freely within a specific ValueTypeSet. This is represented with the ArgumentConstraint::Free variant.

Source

pub fn ctrl_typeset(self) -> Option<ValueTypeSet>

Get the typeset of allowed types for the controlling type variable in a polymorphic instruction.

Source

pub fn is_polymorphic(self) -> bool

Is this instruction polymorphic?

Trait Implementations§

Source§

impl Clone for OpcodeConstraints

Source§

fn clone(&self) -> OpcodeConstraints

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 Copy for OpcodeConstraints

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.