[][src]Struct cranelift_codegen_meta::cdsl::ast::Var

pub(crate) struct Var {
    pub name: String,
    pub src_def: Option<DefIndex>,
    pub dst_def: Option<DefIndex>,
    type_var: Option<TypeVar>,
    is_original_type_var: bool,
}

A free variable.

When variables are used in XForms with source and destination patterns, they are classified as follows:

Input values: Uses in the source pattern with no preceding def. These may appear as inputs in the destination pattern too, but no new inputs can be introduced.

Output values: Variables that are defined in both the source and destination pattern. These values may have uses outside the source pattern, and the destination pattern must compute the same value.

Intermediate values: Values that are defined in the source pattern, but not in the destination pattern. These may have uses outside the source pattern, so the defining instruction can't be deleted immediately.

Temporary values are defined only in the destination pattern.

Fields

name: Stringsrc_def: Option<DefIndex>

The Def defining this variable in a source pattern.

dst_def: Option<DefIndex>

The Def defining this variable in a destination pattern.

type_var: Option<TypeVar>

TypeVar representing the type of this variable.

is_original_type_var: bool

Is this the original type variable, or has it be redefined with set_typevar?

Methods

impl Var[src]

fn new(name: String) -> Self[src]

pub fn is_input(&self) -> bool[src]

Is this an input value to the src pattern?

pub fn is_output(&self) -> bool[src]

Is this an output value, defined in both src and dst patterns?

pub fn is_intermediate(&self) -> bool[src]

Is this an intermediate value, defined only in the src pattern?

pub fn is_temp(&self) -> bool[src]

Is this a temp value, defined only in the dst pattern?

pub fn get_def(&self, position: PatternPosition) -> Option<DefIndex>[src]

Get the def of this variable according to the position.

pub fn set_def(&mut self, position: PatternPosition, def: DefIndex)[src]

pub fn get_or_create_typevar(&mut self) -> TypeVar[src]

Get the type variable representing the type of this variable.

pub fn get_typevar(&self) -> Option<TypeVar>[src]

pub fn set_typevar(&mut self, tv: TypeVar)[src]

pub fn has_free_typevar(&self) -> bool[src]

Check if this variable has a free type variable. If not, the type of this variable is computed from the type of another variable.

pub fn to_rust_code(&self) -> String[src]

fn rust_type(&self) -> String[src]

Trait Implementations

impl Debug for Var[src]

Auto Trait Implementations

impl !RefUnwindSafe for Var

impl !Send for Var

impl !Sync for Var

impl Unpin for Var

impl !UnwindSafe for Var

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.