pub struct LivenessResult { /* private fields */ }Expand description
Liveness analysis result for a whole program.
For each user-defined function, stores a per-statement live_after set:
live_after[i] is the set of variables live immediately after top-level
statement i in that function’s body.
Used by codegen to decide when an argument can be moved into a call instead of cloned: if a variable is not live after the call statement, the old value is never read again and ownership can be transferred.
Implementations§
Source§impl LivenessResult
impl LivenessResult
Sourcepub fn analyze(stmts: &[Stmt<'_>]) -> LivenessResult
pub fn analyze(stmts: &[Stmt<'_>]) -> LivenessResult
Compute liveness for every FunctionDef in stmts.
Algorithm: backward dataflow over the top-level statement list of each
function body. Return is treated as a terminator — variables used in
subsequent (dead-code) statements do not affect liveness before the
Return.
Auto Trait Implementations§
impl Freeze for LivenessResult
impl RefUnwindSafe for LivenessResult
impl Send for LivenessResult
impl Sync for LivenessResult
impl Unpin for LivenessResult
impl UnsafeUnpin for LivenessResult
impl UnwindSafe for LivenessResult
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