pub enum ValueDef {
BlockParam(Block, u32, Type),
Operator(Operator, ListRef<Value>, ListRef<Type>),
PickOutput(Value, u32, Type),
Alias(Value),
Placeholder(Type),
None,
}
Expand description
A definition of an SSA value.
Variants§
BlockParam(Block, u32, Type)
This value is a block parameter of the given block, with the given parameter position/index, and the given type.
Operator(Operator, ListRef<Value>, ListRef<Type>)
This value is an operator, taking the given arguments, and producing the given result types.
The result of an operator may be a single Type
or a tuple of
types; in the latter case, valid IR must use PickOutput
to
project out individual elements and use them.
PickOutput(Value, u32, Type)
This value projects out one result of a multi-result instruction: given the value, the index in the result tuple, it produces a value of the given type.
Alias(Value)
This value is an alias of another value.
Placeholder(Type)
This value is a placeholder to be filled in later (e.g., during SSA construction, may become a blockparam or an alias). Placeholders have fixed types that cannot change once they are filled in.
None
No value: must be filled in before processing.
Implementations§
Source§impl ValueDef
impl ValueDef
Sourcepub fn ty(&self, types: &ListPool<Type>) -> Option<Type>
pub fn ty(&self, types: &ListPool<Type>) -> Option<Type>
Get the type of this value. Requires the type-pool. If this
value is an operator with zero or multiple result types, this
returns None
.
Sourcepub fn tys<'a>(&'a self, types: &'a ListPool<Type>) -> &'a [Type]
pub fn tys<'a>(&'a self, types: &'a ListPool<Type>) -> &'a [Type]
Get the tuple of types of this value.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ValueDef
impl<'de> Deserialize<'de> for ValueDef
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ValueDef
impl StructuralPartialEq for ValueDef
Auto Trait Implementations§
impl Freeze for ValueDef
impl RefUnwindSafe for ValueDef
impl Send for ValueDef
impl Sync for ValueDef
impl Unpin for ValueDef
impl UnwindSafe for ValueDef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more