pub struct Liveness { /* private fields */ }Expand description
Liveness analysis results for a function.
Implementations§
Source§impl Liveness
impl Liveness
Sourcepub fn live_in(&self, block: BlockId) -> &LiveSet
pub fn live_in(&self, block: BlockId) -> &LiveSet
Returns the values live at the entry of a block.
Sourcepub fn live_out(&self, block: BlockId) -> &LiveSet
pub fn live_out(&self, block: BlockId) -> &LiveSet
Returns the values live at the exit of a block.
Sourcepub fn live_at_inst(
&self,
func: &Function,
block_id: BlockId,
inst_idx: usize,
) -> LivenessInfo
pub fn live_at_inst( &self, func: &Function, block_id: BlockId, inst_idx: usize, ) -> LivenessInfo
Computes liveness at a specific instruction within a block. Returns values live before and after the instruction.
Sourcepub fn last_use_in_block(
&self,
val: ValueId,
block: BlockId,
) -> Option<Option<usize>>
pub fn last_use_in_block( &self, val: ValueId, block: BlockId, ) -> Option<Option<usize>>
Returns the last use location of a value within a specific block, if any.
Returns Some(Some(inst_idx)) if last used at an instruction,
Some(None) if last used in a terminator,
None if the value is not used in this block.
Sourcepub fn is_dead_after(
&self,
val: ValueId,
block: BlockId,
inst_idx: usize,
) -> bool
pub fn is_dead_after( &self, val: ValueId, block: BlockId, inst_idx: usize, ) -> bool
Returns true if the value is dead after the given instruction in the given block.
A value is dead after an instruction if:
- The instruction is the last use of the value within this block, AND
- The value is NOT in live_out (meaning no successor blocks use it)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Liveness
impl RefUnwindSafe for Liveness
impl Send for Liveness
impl Sync for Liveness
impl Unpin for Liveness
impl UnsafeUnpin for Liveness
impl UnwindSafe for Liveness
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more