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<'_>]) -> Self
pub fn analyze(stmts: &[Stmt<'_>]) -> Self
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.