pub struct DeadCodeEliminator { /* private fields */ }Expand description
The dead code elimination pass for TLExpr trees.
Run with DeadCodeEliminator::run for a full fixed-point iteration,
or run_pass for a single traversal.
Implementations§
Source§impl DeadCodeEliminator
impl DeadCodeEliminator
Sourcepub fn is_free(&self, var: &str, expr: &TLExpr) -> bool
pub fn is_free(&self, var: &str, expr: &TLExpr) -> bool
Returns true if var appears free (as a predicate argument or
inside a binder that does not shadow it) anywhere in expr.
Variable occurrences in TLExpr live in two places:
Term::Var(name)insidePredargsAllDifferent { variables }variable name lists- Any binder (
Exists,ForAll,Let,Lambda,LeastFixpoint, etc.) that introduces a new scope — we stop counting the variable as free inside the scope if the binder’s name equalsvar.
Source§impl DeadCodeEliminator
impl DeadCodeEliminator
Sourcepub fn count_nodes(expr: &TLExpr) -> u64
pub fn count_nodes(expr: &TLExpr) -> u64
Count the total number of nodes in an expression tree.
Every node (leaf or internal) counts as 1.
Source§impl DeadCodeEliminator
impl DeadCodeEliminator
Sourcepub fn with_default() -> Self
pub fn with_default() -> Self
Create a new eliminator with default configuration.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DeadCodeEliminator
impl RefUnwindSafe for DeadCodeEliminator
impl Send for DeadCodeEliminator
impl Sync for DeadCodeEliminator
impl Unpin for DeadCodeEliminator
impl UnsafeUnpin for DeadCodeEliminator
impl UnwindSafe for DeadCodeEliminator
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