Struct cranelift_codegen::ir::constant::ConstantPool [−][src]
Maintains the mapping between a constant handle (i.e. Constant
) and
its constant data (i.e. ConstantData
).
Implementations
impl ConstantPool
[src]
pub fn new() -> Self
[src]
Create a new constant pool instance.
pub fn clear(&mut self)
[src]
Empty the constant pool of all data.
pub fn insert(&mut self, constant_value: ConstantData) -> Constant
[src]
Insert constant data into the pool, returning a handle for later referencing; when constant data is inserted that is a duplicate of previous constant data, the existing handle will be returned.
pub fn get(&self, constant_handle: Constant) -> &ConstantData
[src]
Retrieve the constant data given a handle.
pub fn set(&mut self, constant_handle: Constant, constant_value: ConstantData)
[src]
Link a constant handle to its value. This does not de-duplicate data but does avoid
replacing any existing constant values. use set
to tie a specific const42
to its value;
use insert
to add a value and return the next available const
entity.
pub fn set_offset(
&mut self,
constant_handle: Constant,
constant_offset: ConstantOffset
)
[src]
&mut self,
constant_handle: Constant,
constant_offset: ConstantOffset
)
Assign an offset to a given constant, where the offset is the number of bytes from the beginning of the function to the beginning of the constant data inside the pool.
pub fn get_offset(&self, constant_handle: Constant) -> ConstantOffset
[src]
Retrieve the offset of a given constant, where the offset is the number of bytes from the beginning of the function to the beginning of the constant data inside the pool.
pub fn iter(&self) -> impl Iterator<Item = (&Constant, &ConstantData)>
[src]
Iterate over the constants in insertion order.
pub fn entries_mut(&mut self) -> impl Iterator<Item = &mut ConstantPoolEntry>
[src]
Iterate over mutable entries in the constant pool in insertion order.
pub fn len(&self) -> usize
[src]
Return the number of constants in the pool.
pub fn byte_size(&self) -> usize
[src]
Return the combined size of all of the constant values in the pool.
Trait Implementations
impl Clone for ConstantPool
[src]
fn clone(&self) -> ConstantPool
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl RefUnwindSafe for ConstantPool
impl Send for ConstantPool
impl Sync for ConstantPool
impl Unpin for ConstantPool
impl UnwindSafe for ConstantPool
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,