Skip to main content

DetachedMut

Struct DetachedMut 

Source
pub struct DetachedMut<'a, 'str> {
    pub body: &'a mut FunctionBody<'str>,
    pub shared: &'a Shared<'str>,
    pub interfaces: &'a Registry<FunctionId, FunctionInterface<'str>>,
}
Expand description

The exclusive mutation host for a detached (minted, not-yet-installed) function body. See the module docs: all verbs are body-local.

Fields§

§body: &'a mut FunctionBody<'str>

The detached body being built (no registry identity until install).

§shared: &'a Shared<'str>

The module’s shared IR state, read-only (types/literals minted through the interners’ &self paths).

§interfaces: &'a Registry<FunctionId, FunctionInterface<'str>>

Every function’s published interface (never checked out).

Implementations§

Source§

impl<'a, 'str> DetachedMut<'a, 'str>

Source

pub fn new( body: &'a mut FunctionBody<'str>, shared: &'a Shared<'str>, interfaces: &'a Registry<FunctionId, FunctionInterface<'str>>, ) -> Self

Wrap body over the module’s shared state and interface registry.

Source

pub fn shr(&self) -> &Shared<'str>

The module’s shared IR state (Shared) (read).

Source

pub fn make_block(&mut self) -> LocalBlockId

Mint a fresh empty block into the detached body.

Source

pub fn set_root(&mut self, root: LocalBlockId)

Set the detached body’s entry block.

Source

pub fn block(&self, block: LocalBlockId) -> &BasicBlock<'str>

A read of block block’s payload (params/instructions/edges).

Source

pub fn add_cfg_edge(&mut self, from: LocalBlockId, to: LocalBlockId) -> EdgeId

Add a directed CFG edge from -> to.

Source

pub fn push_mnemonic_with_type( &mut self, mnemonic: Mnemonic, type_id: TypeId, ) -> LocalInsnId

Mint an instruction with mnemonic and an explicit result type_id.

Source

pub fn append_insn(&mut self, block: LocalBlockId, insn: LocalInsnId)

Append an already-minted instruction to the end of block.

Source

pub fn push_block_param( &mut self, block: LocalBlockId, param: BlockParam<'str>, ) -> LocalParamId

Declare a block parameter, wiring it into block’s parameter list.

Source

pub fn replace_instruction_mnemonic( &mut self, insn: LocalInsnId, mnemonic: Mnemonic, )

Replace instruction insn’s mnemonic in place, keeping reverse-uses synced.

Source

pub fn mnemonic(&self, insn: LocalInsnId) -> &Mnemonic

Instruction insn’s mnemonic (read).

Source

pub fn type_of(&self, id: LocalValueId) -> TypeId

The result type of a body-local operand.

Source

pub fn rename_block( &mut self, block: LocalBlockId, name: Cow<'str, str>, ) -> Result<()>

Set and register block’s name in the body’s local name table.

Source

pub fn builder(&mut self, block: LocalBlockId) -> Builder<'str, '_>

A builder positioned at block, driving the id-less local push surface.

Auto Trait Implementations§

§

impl<'a, 'str> !UnwindSafe for DetachedMut<'a, 'str>

§

impl<'a, 'str> Freeze for DetachedMut<'a, 'str>

§

impl<'a, 'str> RefUnwindSafe for DetachedMut<'a, 'str>

§

impl<'a, 'str> Send for DetachedMut<'a, 'str>

§

impl<'a, 'str> Sync for DetachedMut<'a, 'str>

§

impl<'a, 'str> Unpin for DetachedMut<'a, 'str>

§

impl<'a, 'str> UnsafeUnpin for DetachedMut<'a, 'str>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.