pub struct Value(pub DefaultKey);Tuple Fields§
§0: DefaultKeyImplementations§
Source§impl Value
impl Value
Sourcepub fn new_argument(context: &mut Context<'_>, arg: BlockArgument) -> Value
pub fn new_argument(context: &mut Context<'_>, arg: BlockArgument) -> Value
Return a new argument 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<'_>,
block: Block,
instruction: InstOp,
) -> Value
pub fn new_instruction( context: &mut Context<'_>, block: Block, instruction: InstOp, ) -> 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_instruction_values(
&self,
context: &mut Context<'_>,
replace_map: &FxHashMap<Value, Value>,
)
pub fn replace_instruction_values( &self, context: &mut Context<'_>, replace_map: &FxHashMap<Value, Value>, )
If this value is an instruction and if any of its parameters is in replace_map as
a key, replace it with the mapped value.
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.
Sourcepub fn get_instruction<'a>(
&self,
context: &'a Context<'_>,
) -> Option<&'a Instruction>
pub fn get_instruction<'a>( &self, context: &'a Context<'_>, ) -> Option<&'a Instruction>
Get a reference to this value as an instruction, iff it is one.
Sourcepub fn get_instruction_mut<'a>(
&self,
context: &'a mut Context<'_>,
) -> Option<&'a mut Instruction>
pub fn get_instruction_mut<'a>( &self, context: &'a mut Context<'_>, ) -> Option<&'a mut Instruction>
Get a mutable reference to this value as an instruction, iff it is one.
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 a reference to this value as a constant, iff it is one.
Sourcepub fn get_argument<'a>(
&self,
context: &'a Context<'_>,
) -> Option<&'a BlockArgument>
pub fn get_argument<'a>( &self, context: &'a Context<'_>, ) -> Option<&'a BlockArgument>
Get a reference to this value as an argument, iff it is one.
Sourcepub fn get_argument_mut<'a>(
&self,
context: &'a mut Context<'_>,
) -> Option<&'a mut BlockArgument>
pub fn get_argument_mut<'a>( &self, context: &'a mut Context<'_>, ) -> Option<&'a mut BlockArgument>
Get a mutable reference to this value as an argument, iff it is 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 match_ptr_type(&self, context: &Context<'_>) -> Option<Type>
pub fn match_ptr_type(&self, context: &Context<'_>) -> Option<Type>
Get the pointer inner type for this value, iff it is a pointer.
Trait Implementations§
Source§impl DebugWithContext for Value
impl DebugWithContext for Value
fn fmt_with_context<'a, 'c>( &'a self, formatter: &mut Formatter<'_>, context: &'c Context<'_>, ) -> Result
fn with_context<'a, 'c, 'eng>( &'a self, context: &'c Context<'eng>, ) -> WithContext<'a, 'c, 'eng, Self>
impl Copy for Value
impl Eq for Value
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> StorageAsMut for T
impl<T> StorageAsMut for T
fn storage<Type>(&mut self) -> StorageMut<'_, Self, Type>where
Type: Mappable,
fn storage_as_mut<Type>(&mut self) -> StorageMut<'_, Self, Type>where
Type: Mappable,
Source§impl<T> StorageAsRef for T
impl<T> StorageAsRef for T
fn storage<Type>(&self) -> StorageRef<'_, Self, Type>where
Type: Mappable,
fn storage_as_ref<Type>(&self) -> StorageRef<'_, Self, Type>where
Type: Mappable,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.