pub struct Engine<'a, 'tcx, A>where
    A: Analysis<'tcx>,{
    tcx: TyCtxt<'tcx>,
    body: &'a Body<'tcx>,
    entry_sets: IndexVec<BasicBlock, A::Domain>,
    pass_name: Option<&'static str>,
    analysis: A,
    apply_statement_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>>,
}
Expand description

A solver for dataflow problems.

Fields§

§tcx: TyCtxt<'tcx>§body: &'a Body<'tcx>§entry_sets: IndexVec<BasicBlock, A::Domain>§pass_name: Option<&'static str>§analysis: A§apply_statement_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>>

Cached, cumulative transfer functions for each block.

Implementations§

source§

impl<'a, 'tcx, A, D, T> Engine<'a, 'tcx, A>where A: GenKillAnalysis<'tcx, Idx = T, Domain = D>, D: Clone + JoinSemiLattice + GenKill<T> + BitSetExt<T>, T: Idx,

source

pub fn new_gen_kill( tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, analysis: A ) -> Self

Creates a new Engine to solve a gen-kill dataflow problem.

source§

impl<'a, 'tcx, A, D> Engine<'a, 'tcx, A>where A: Analysis<'tcx, Domain = D>, D: Clone + JoinSemiLattice,

source

pub fn new_generic(tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, analysis: A) -> Self

Creates a new Engine to solve a dataflow problem with an arbitrary transfer function.

Gen-kill problems should use new_gen_kill, which will coalesce transfer functions for better performance.

source

fn new( tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, analysis: A, apply_statement_trans_for_block: Option<Box<dyn Fn(BasicBlock, &mut A::Domain)>> ) -> Self

source

pub fn pass_name(self, name: &'static str) -> Self

Adds an identifier to the graphviz output for this particular run of a dataflow analysis.

Some analyses are run multiple times in the compilation pipeline. Give them a pass_name to differentiate them. Otherwise, only the results for the latest run will be saved.

source

pub fn iterate_to_fixpoint(self) -> Results<'tcx, A>where A::Domain: DebugWithContext<A>,

Computes the fixpoint for this dataflow problem and returns it.

Auto Trait Implementations§

§

impl<'a, 'tcx, A> !RefUnwindSafe for Engine<'a, 'tcx, A>

§

impl<'a, 'tcx, A> !Send for Engine<'a, 'tcx, A>

§

impl<'a, 'tcx, A> !Sync for Engine<'a, 'tcx, A>

§

impl<'a, 'tcx, A> Unpin for Engine<'a, 'tcx, A>where A: Unpin, <A as AnalysisDomain<'tcx>>::Domain: Unpin,

§

impl<'a, 'tcx, A> !UnwindSafe for Engine<'a, 'tcx, A>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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.

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.