pub struct Value(pub Index);
Tuple Fields
0: Index
Implementations
sourceimpl Value
impl Value
sourcepub fn new_constant(context: &mut Context, constant: Constant) -> Value
pub fn new_constant(context: &mut Context, constant: Constant) -> Value
Return a new constant Value
.
sourcepub fn new_instruction(context: &mut Context, instruction: Instruction) -> Value
pub fn new_instruction(context: &mut Context, instruction: Instruction) -> Value
Return a new instruction Value
.
sourcepub fn add_metadatum(
self,
context: &mut Context,
md_idx: Option<MetadataIndex>
) -> Self
pub fn add_metadatum(
self,
context: &mut Context,
md_idx: Option<MetadataIndex>
) -> Self
Add some metadata to this value.
As a convenience the md_idx
argument is an Option
, in which case this function is a
no-op.
If there is no existing metadata then the new metadata are added alone. Otherwise the new metadatum are added to the list of metadata.
sourcepub fn get_metadata(&self, context: &Context) -> Option<MetadataIndex>
pub fn get_metadata(&self, context: &Context) -> Option<MetadataIndex>
Return this value’s metadata.
sourcepub fn is_constant(&self, context: &Context) -> bool
pub fn is_constant(&self, context: &Context) -> bool
Return whether this is a constant value.
sourcepub fn is_terminator(&self, context: &Context) -> bool
pub fn is_terminator(&self, context: &Context) -> bool
Return whether this value is an instruction, and specifically a ‘terminator’.
A terminator is always the last instruction in a block (and may not appear anywhere else) and is either a branch or return.
sourcepub fn replace_instruction_value(
&self,
context: &mut Context,
old_val: Value,
new_val: Value
)
pub fn replace_instruction_value(
&self,
context: &mut Context,
old_val: Value,
new_val: Value
)
If this value is an instruction and if any of its parameters is old_val
then replace them
with new_val
.
sourcepub fn replace(&self, context: &mut Context, other: ValueDatum)
pub fn replace(&self, context: &mut Context, other: ValueDatum)
Replace this value with another one, in-place.
pub fn get_instruction_mut<'a>(
&self,
context: &'a mut Context
) -> Option<&'a mut Instruction>
sourcepub fn get_constant<'a>(&self, context: &'a Context) -> Option<&'a Constant>
pub fn get_constant<'a>(&self, context: &'a Context) -> Option<&'a Constant>
Get reference to the Constant inside this value, if it’s one.
sourcepub fn get_type(&self, context: &Context) -> Option<Type>
pub fn get_type(&self, context: &Context) -> Option<Type>
Get the type for this value, if found.
Arguments and constants always have a type, but only some instructions do.
sourcepub fn get_stripped_ptr_type(&self, context: &Context) -> Option<Type>
pub fn get_stripped_ptr_type(&self, context: &Context) -> Option<Type>
Get the type for this value with any pointer stripped, if found.
Trait Implementations
sourceimpl PartialEq<Value> for Value
impl PartialEq<Value> for Value
impl Copy for Value
impl Eq for Value
impl StructuralEq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more