pub trait GenKillAnalysis<'tcx>: Analysis<'tcx> {
    type Idx: Idx;

    // Required methods
    fn domain_size(&self, body: &Body<'tcx>) -> usize;
    fn statement_effect(
        &mut self,
        trans: &mut impl GenKill<Self::Idx>,
        statement: &Statement<'tcx>,
        location: Location
    );
    fn terminator_effect<'mir>(
        &mut self,
        trans: &mut Self::Domain,
        terminator: &'mir Terminator<'tcx>,
        location: Location
    ) -> TerminatorEdges<'mir, 'tcx>;
    fn call_return_effect(
        &mut self,
        trans: &mut impl GenKill<Self::Idx>,
        block: BasicBlock,
        return_places: CallReturnPlaces<'_, 'tcx>
    );

    // Provided methods
    fn before_statement_effect(
        &mut self,
        _trans: &mut impl GenKill<Self::Idx>,
        _statement: &Statement<'tcx>,
        _location: Location
    ) { ... }
    fn before_terminator_effect(
        &mut self,
        _trans: &mut impl GenKill<Self::Idx>,
        _terminator: &Terminator<'tcx>,
        _location: Location
    ) { ... }
    fn switch_int_edge_effects<G: GenKill<Self::Idx>>(
        &mut self,
        _block: BasicBlock,
        _discr: &Operand<'tcx>,
        _edge_effects: &mut impl SwitchIntEdgeEffects<G>
    ) { ... }
}
Expand description

A gen/kill dataflow problem.

Each method in this trait has a corresponding one in Analysis. However, these methods only allow modification of the dataflow state via “gen” and “kill” operations. By defining transfer functions for each statement in this way, the transfer function for an entire basic block can be computed efficiently.

Analysis is automatically implemented for all implementers of GenKillAnalysis.

Required Associated Types§

Required Methods§

source

fn domain_size(&self, body: &Body<'tcx>) -> usize

source

fn statement_effect( &mut self, trans: &mut impl GenKill<Self::Idx>, statement: &Statement<'tcx>, location: Location )

See Analysis::apply_statement_effect.

source

fn terminator_effect<'mir>( &mut self, trans: &mut Self::Domain, terminator: &'mir Terminator<'tcx>, location: Location ) -> TerminatorEdges<'mir, 'tcx>

See Analysis::apply_terminator_effect.

source

fn call_return_effect( &mut self, trans: &mut impl GenKill<Self::Idx>, block: BasicBlock, return_places: CallReturnPlaces<'_, 'tcx> )

See Analysis::apply_call_return_effect.

Provided Methods§

source

fn before_statement_effect( &mut self, _trans: &mut impl GenKill<Self::Idx>, _statement: &Statement<'tcx>, _location: Location )

See Analysis::apply_before_statement_effect.

source

fn before_terminator_effect( &mut self, _trans: &mut impl GenKill<Self::Idx>, _terminator: &Terminator<'tcx>, _location: Location )

See Analysis::apply_before_terminator_effect.

source

fn switch_int_edge_effects<G: GenKill<Self::Idx>>( &mut self, _block: BasicBlock, _discr: &Operand<'tcx>, _edge_effects: &mut impl SwitchIntEdgeEffects<G> )

See Analysis::apply_switch_int_edge_effects.

Implementors§