Skip to main content

BlockRef

Struct BlockRef 

Source
pub struct BlockRef<'str, 'ctx, R = ModuleView<'ctx, 'str>> {
    pub id: BlockId,
    /* private fields */
}

Fields§

§id: BlockId

Implementations§

Source§

impl<'s, 'ctx: 's, 'str: 'ctx, R> BlockRef<'str, 'ctx, R>
where R: QCodeView<'ctx, 'str>,

Source

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

Iterates over outgoing (edge_id, successor_block_id) pairs.

Routed through its QCodeView (this block’s incident edge set and each edge’s endpoints) rather than the jstd graph traits, so it reads correctly when the owning function is checked out. On the module path it yields exactly what Node::children did: the same incident-edge set, filtered to edges leaving this block.

Source

pub fn predecessors(&'s self) -> impl Iterator<Item = (EdgeId, BlockId)> + 's

Iterates over incoming (edge_id, predecessor_block_id) pairs. See successors for the routing rationale.

Source

pub fn name(&'s self) -> Option<&'ctx str>

Source

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

Returns the machine address of this block, if it has one.

Source

pub fn comment(&'s self) -> Option<&'ctx str>

Source

pub fn params( &'s self, ) -> impl Iterator<Item = BlockParamRef<'str, 'ctx, R>> + 's

Iterates over this block’s parameters in declaration order.

Source

pub fn num_params(&'s self) -> usize

Returns the number of parameters declared on this block.

Source

pub fn instructions(&'s self) -> InstructionIter<'str, 'ctx, R>

Iterates over the instructions in this block

Source

pub fn iter(&'s self) -> InstructionIter<'str, 'ctx, R>

Iterates over the instructions in this block alias for instructions()

Source

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

Source

pub fn instruction_count(&'s self) -> usize

How many instructions this block holds.

Separate from instruction_ids because that qualifies every id into a fresh Vec, and a caller that wants only the count should not allocate for it — the JIT reads this per block execution.

Source

pub fn is_empty(&'s self) -> bool

Does this block have any instructions?

Source

pub fn is_terminated(&'s self) -> bool

Does this block finish with a terminator instruction?

Source

pub fn parent(&'s self) -> Option<FunctionRef<'str, 'ctx, R>>

Source

pub fn function(&'s self) -> Option<FunctionRef<'str, 'ctx, R>>

Source§

impl<'str, 'ctx, R> BlockRef<'str, 'ctx, R>

Source

pub fn new(view: R, id: BlockId) -> Self

Source

pub fn id(&self) -> ValueId

Source§

impl<'str, 'ctx> BlockRef<'str, 'ctx>

Source

pub fn from_id(ctx: &'ctx Context<'str>, id: BlockId) -> Self

Trait Implementations§

Source§

impl<'str, 'ctx, R: Clone> Clone for BlockRef<'str, 'ctx, R>

Source§

fn clone(&self) -> BlockRef<'str, 'ctx, R>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'str, 'ctx, R: Copy> Copy for BlockRef<'str, 'ctx, R>

Source§

impl<'str: 'ctx, 'ctx, R> Display for BlockRef<'str, 'ctx, R>
where R: QCodeView<'ctx, 'str>,

Source§

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

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

impl<'str, 'ctx, R> From<BlockRef<'str, 'ctx, R>> for ValueRef<'str, 'ctx, R>

Source§

fn from(bb_ref: BlockRef<'str, 'ctx, R>) -> Self

Converts to this type from the input type.
Source§

impl<'str: 'ctx, 'ctx, R> IntoIterator for &BlockRef<'str, 'ctx, R>
where R: QCodeView<'ctx, 'str>,

Source§

type Item = InstructionRef<'str, 'ctx, R>

The type of the elements being iterated over.
Source§

type IntoIter = InstructionIter<'str, 'ctx, R>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'str: 'ctx, 'ctx, R> Named for BlockRef<'str, 'ctx, R>
where R: QCodeView<'ctx, 'str>,

Source§

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

Source§

impl<'str: 'ctx, 'ctx, R> Value<'str, 'ctx> for BlockRef<'str, 'ctx, R>
where R: QCodeView<'ctx, 'str>,

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> WithCtx<'s, 'ctx, 'str> for BlockRef<'str, 'ctx>

Source§

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

Auto Trait Implementations§

§

impl<'str, 'ctx, R> Freeze for BlockRef<'str, 'ctx, R>
where R: Freeze,

§

impl<'str, 'ctx, R> RefUnwindSafe for BlockRef<'str, 'ctx, R>
where R: RefUnwindSafe,

§

impl<'str, 'ctx, R> Send for BlockRef<'str, 'ctx, R>
where R: Send,

§

impl<'str, 'ctx, R> Sync for BlockRef<'str, 'ctx, R>
where R: Sync,

§

impl<'str, 'ctx, R> Unpin for BlockRef<'str, 'ctx, R>
where R: Unpin,

§

impl<'str, 'ctx, R> UnsafeUnpin for BlockRef<'str, 'ctx, R>
where R: UnsafeUnpin,

§

impl<'str, 'ctx, R> UnwindSafe for BlockRef<'str, 'ctx, R>
where R: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.