Skip to main content

BlockMutRef

Type Alias BlockMutRef 

Source
pub type BlockMutRef<'str, 'ctx> = BaseRef<&'ctx mut Context<'str>, BlockId>;

Aliased Type§

pub struct BlockMutRef<'str, 'ctx> {
    pub id: BlockId,
    /* private fields */
}

Fields§

§id: BlockId

Implementations§

Source§

impl<'str, 'ctx> BlockMutRef<'str, 'ctx>

Source

pub fn num_params(&self) -> usize

Source

pub fn instruction_ids(&self) -> Vec<InstructionId>

Source

pub fn instructions(&self) -> impl Iterator<Item = InstructionRef<'str, '_>>

Source

pub fn address(&self) -> Option<u64>

Source

pub fn successors(&self) -> impl Iterator<Item = (EdgeId, BlockId)>

Source

pub fn with_address(self, addr: u64) -> Self

Builder-style address assignment. Panics if addr is already mapped. Use set_address for fallible assignment.

Source

pub fn with_address_indexed( self, addresses: &mut AddressIndex, addr: u64, ) -> Self

Indexed construction variant of with_address.

Source

pub fn in_function(self, fun_id: FunctionId) -> Self

Source

pub fn with_id(&mut self, id: BlockId) -> &mut Self

Source

pub fn reborrow(&mut self) -> BlockMutRef<'str, '_>

Reborrows this BlockMutRef, shortening the lifetime.

Source

pub fn parent_mut(&mut self) -> Option<FunctionMutRef<'str, '_>>

Source

pub fn as_ref(&self) -> BlockRef<'str, '_>

Source

pub fn push_param(&mut self, size: usize) -> BlockParamMutRef<'str, '_>

Declares a new parameter on this block with the given size in bytes.

The parameter is appended to the block’s params list and its parent is set to this block. It does NOT appear in instructions. Returns a mutable reference whose ValueId can be used as an operand.

Source

pub fn push_existing_param(&mut self, id: BlockParamId)

Appends an already-created block parameter to the parameters list

Source

pub fn insert_insn_after( &mut self, after_id: InstructionId, insn_id: InstructionId, )

Inserts an instruction after the instruction identified by after_id in this block. Panics if after_id is not an instruction in this block.

Source

pub fn retain_insns(&mut self, f: impl FnMut(&InstructionId) -> bool)

Retains only the instructions for which f returns true, deleting the removed instructions.

Source

pub fn pop_insn(&mut self)

Removes the last instruction from this block.

Source

pub fn extend_insns(&mut self, insns: &[InstructionId])

Appends a slice of instruction ids to this block.

Source

pub fn set_address(&mut self, addr: u64) -> Result<()>

Associates this block with addr in the context address map. Names the block after addr if it doesn’t already have a name. Returns Err if another value is already mapped to addr.

Source

pub fn set_address_indexed( &mut self, addresses: &mut AddressIndex, addr: u64, ) -> Result<()>

Assigns an address through a caller-owned construction index.

Trait Implementations§

Source§

impl Display for BlockMutRef<'_, '_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Named for BlockMutRef<'_, '_>

Source§

fn name(&self) -> Option<&str>

Source§

impl<'str, 'ctx> Value<'str, 'ctx> for BlockMutRef<'str, 'ctx>

Source§

fn id(&self) -> ValueId

The context-unique identifier for this value.
Source§

fn size(&self) -> usize

The size of this value’s output in bytes, or 0 for non-data values (terminators, blocks, functions).
Source§

impl<'s, 'ctx: 's, 'str: 'ctx> WithCtxMut<'s, 'str> for BlockMutRef<'str, 'ctx>

Source§

fn ctx_mut(&'s mut self) -> &'s mut Context<'str>