Struct cranelift_codegen::ir::constant::ConstantPool
source · pub struct ConstantPool { /* private fields */ }
Expand description
Maintains the mapping between a constant handle (i.e. Constant
) and
its constant data (i.e. ConstantData
).
Implementations§
source§impl ConstantPool
impl ConstantPool
sourcepub fn insert(&mut self, constant_value: ConstantData) -> Constant
pub fn insert(&mut self, constant_value: ConstantData) -> Constant
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.
sourcepub fn get(&self, constant_handle: Constant) -> &ConstantData
pub fn get(&self, constant_handle: Constant) -> &ConstantData
Retrieve the constant data given a handle.
sourcepub fn set(&mut self, constant_handle: Constant, constant_value: ConstantData)
pub fn set(&mut self, constant_handle: Constant, constant_value: ConstantData)
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.
sourcepub fn iter(&self) -> impl Iterator<Item = (&Constant, &ConstantData)>
pub fn iter(&self) -> impl Iterator<Item = (&Constant, &ConstantData)>
Iterate over the constants in insertion order.
sourcepub fn entries_mut(&mut self) -> impl Iterator<Item = &mut ConstantData>
pub fn entries_mut(&mut self) -> impl Iterator<Item = &mut ConstantData>
Iterate over mutable entries in the constant pool in insertion order.
Trait Implementations§
source§impl Clone for ConstantPool
impl Clone for ConstantPool
source§fn clone(&self) -> ConstantPool
fn clone(&self) -> ConstantPool
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more