cranelift_codegen::data_value

Enum DataValue

Source
pub enum DataValue {
    I8(i8),
    I16(i16),
    I32(i32),
    I64(i64),
    I128(i128),
    F16(Ieee16),
    F32(Ieee32),
    F64(Ieee64),
    F128(Ieee128),
    V128([u8; 16]),
    V64([u8; 8]),
}
Expand description

Represent a data value. Where Value is an SSA reference, DataValue is the type + value that would be referred to by a Value.

Variants§

§

I8(i8)

§

I16(i16)

§

I32(i32)

§

I64(i64)

§

I128(i128)

§

F16(Ieee16)

§

F32(Ieee32)

§

F64(Ieee64)

§

F128(Ieee128)

§

V128([u8; 16])

§

V64([u8; 8])

Implementations§

Source§

impl DataValue

Source

pub fn from_integer( imm: i128, ty: Type, ) -> Result<DataValue, DataValueCastFailure>

Try to cast an immediate integer (a wrapped i64 on most Cranelift instructions) to the given Cranelift Type.

Source

pub fn ty(&self) -> Type

Return the Cranelift IR Type for this DataValue.

Source

pub fn is_vector(&self) -> bool

Return true if the value is a vector (i.e. DataValue::V128).

Source

pub fn to_be(self) -> Self

Converts self to big endian from target’s endianness.

Source

pub fn to_le(self) -> Self

Converts self to little endian from target’s endianness.

Source

pub fn write_to_slice_ne(&self, dst: &mut [u8])

Write a DataValue to a slice in native-endian byte order.

§Panics:

Panics if the slice does not have enough space to accommodate the DataValue

Source

pub fn write_to_slice_be(&self, dst: &mut [u8])

Write a DataValue to a slice in big-endian byte order.

§Panics:

Panics if the slice does not have enough space to accommodate the DataValue

Source

pub fn write_to_slice_le(&self, dst: &mut [u8])

Write a DataValue to a slice in little-endian byte order.

§Panics:

Panics if the slice does not have enough space to accommodate the DataValue

Source

pub fn read_from_slice_ne(src: &[u8], ty: Type) -> Self

Read a DataValue from a slice using a given Type with native-endian byte order.

§Panics:

Panics if the slice does not have enough space to accommodate the DataValue

Source

pub fn read_from_slice_be(src: &[u8], ty: Type) -> Self

Read a DataValue from a slice using a given Type in big-endian byte order.

§Panics:

Panics if the slice does not have enough space to accommodate the DataValue

Source

pub fn read_from_slice_le(src: &[u8], ty: Type) -> Self

Read a DataValue from a slice using a given Type in little-endian byte order.

§Panics:

Panics if the slice does not have enough space to accommodate the DataValue

Source

pub unsafe fn write_value_to(&self, p: *mut u128)

Write a DataValue to a memory location in native-endian byte order.

Source

pub unsafe fn read_value_from(p: *const u128, ty: Type) -> Self

Read a DataValue from a memory location using a given Type in native-endian byte order.

Source

pub fn bitwise_eq(&self, other: &DataValue) -> bool

Performs a bitwise comparison over the contents of DataValue.

Returns true if all bits are equal.

This behaviour is different from PartialEq for NaN floats.

Trait Implementations§

Source§

impl Clone for DataValue

Source§

fn clone(&self) -> DataValue

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 DataValue

Source§

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

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

impl Display for DataValue

Source§

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

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

impl From<[u8; 16]> for DataValue

Source§

fn from(data: [u8; 16]) -> Self

Converts to this type from the input type.
Source§

impl From<[u8; 8]> for DataValue

Source§

fn from(data: [u8; 8]) -> Self

Converts to this type from the input type.
Source§

impl From<Ieee128> for DataValue

Source§

fn from(data: Ieee128) -> Self

Converts to this type from the input type.
Source§

impl From<Ieee16> for DataValue

Source§

fn from(data: Ieee16) -> Self

Converts to this type from the input type.
Source§

impl From<Ieee32> for DataValue

Source§

fn from(data: Ieee32) -> Self

Converts to this type from the input type.
Source§

impl From<Ieee64> for DataValue

Source§

fn from(data: Ieee64) -> Self

Converts to this type from the input type.
Source§

impl From<Offset32> for DataValue

Source§

fn from(o: Offset32) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for DataValue

Source§

fn from(data: i128) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for DataValue

Source§

fn from(data: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for DataValue

Source§

fn from(data: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for DataValue

Source§

fn from(data: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for DataValue

Source§

fn from(data: i8) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for DataValue

Source§

fn eq(&self, other: &Self) -> 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 DataValue

Source§

fn partial_cmp(&self, other: &DataValue) -> 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 TryInto<[u8; 16]> for DataValue

Source§

type Error = DataValueCastFailure

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<[u8; 16], Self::Error>

Performs the conversion.
Source§

impl TryInto<[u8; 8]> for DataValue

Source§

type Error = DataValueCastFailure

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<[u8; 8], Self::Error>

Performs the conversion.
Source§

impl TryInto<Ieee128> for DataValue

Source§

type Error = DataValueCastFailure

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<Ieee128, Self::Error>

Performs the conversion.
Source§

impl TryInto<Ieee16> for DataValue

Source§

type Error = DataValueCastFailure

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<Ieee16, Self::Error>

Performs the conversion.
Source§

impl TryInto<Ieee32> for DataValue

Source§

type Error = DataValueCastFailure

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<Ieee32, Self::Error>

Performs the conversion.
Source§

impl TryInto<Ieee64> for DataValue

Source§

type Error = DataValueCastFailure

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<Ieee64, Self::Error>

Performs the conversion.
Source§

impl TryInto<i128> for DataValue

Source§

type Error = DataValueCastFailure

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<i128, Self::Error>

Performs the conversion.
Source§

impl TryInto<i16> for DataValue

Source§

type Error = DataValueCastFailure

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<i16, Self::Error>

Performs the conversion.
Source§

impl TryInto<i32> for DataValue

Source§

type Error = DataValueCastFailure

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<i32, Self::Error>

Performs the conversion.
Source§

impl TryInto<i64> for DataValue

Source§

type Error = DataValueCastFailure

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<i64, Self::Error>

Performs the conversion.
Source§

impl TryInto<i8> for DataValue

Source§

type Error = DataValueCastFailure

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<i8, Self::Error>

Performs the conversion.

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> 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.