SparseBackwardDataFlowAnalysis

Trait SparseBackwardDataFlowAnalysis 

Source
pub trait SparseBackwardDataFlowAnalysis: 'static {
    type Lattice: BuildableAnalysisState + SparseLattice;

    // Required methods
    fn visit_operation(
        &self,
        op: &Operation,
        operands: &mut [AnalysisStateGuardMut<'_, Self::Lattice>],
        results: &[AnalysisStateGuard<'_, Self::Lattice>],
        solver: &mut DataFlowSolver,
    ) -> Result<(), Report>;
    fn visit_branch_operand(
        &self,
        operand: &OpOperandImpl,
        solver: &mut DataFlowSolver,
    );
    fn visit_call_operand(
        &self,
        operand: &OpOperandImpl,
        solver: &mut DataFlowSolver,
    );
    fn set_to_exit_state(
        &self,
        lattice: &mut AnalysisStateGuardMut<'_, Self::Lattice>,
    );

    // Provided methods
    fn debug_name(&self) -> &'static str { ... }
    fn visit_external_call(
        &self,
        call: &dyn CallOpInterface,
        arguments: &mut [AnalysisStateGuardMut<'_, Self::Lattice>],
        results: &[AnalysisStateGuard<'_, Self::Lattice>],
        solver: &mut DataFlowSolver,
    ) { ... }
}
Expand description

A sparse (backward) data-flow analysis for propagating SSA value lattices backwards across the IR by implementing transfer functions for operations.

Visiting a program point in sparse backward data-flow analysis will invoke the transfer function of the operation preceding the program point. Visiting a program point at the begining of block will visit the block itself.

Required Associated Types§

Required Methods§

Source

fn visit_operation( &self, op: &Operation, operands: &mut [AnalysisStateGuardMut<'_, Self::Lattice>], results: &[AnalysisStateGuard<'_, Self::Lattice>], solver: &mut DataFlowSolver, ) -> Result<(), Report>

The operation transfer function.

Given the result lattices, this function is expected to set the operand lattices.

Source

fn visit_branch_operand( &self, operand: &OpOperandImpl, solver: &mut DataFlowSolver, )

Visit operands on branch instructions that are not forwarded.

Source

fn visit_call_operand( &self, operand: &OpOperandImpl, solver: &mut DataFlowSolver, )

Visit operands on call instructions that are not forwarded.

Source

fn set_to_exit_state( &self, lattice: &mut AnalysisStateGuardMut<'_, Self::Lattice>, )

Set the given lattice element(s) at control flow exit point(s).

Provided Methods§

Source

fn debug_name(&self) -> &'static str

Source

fn visit_external_call( &self, call: &dyn CallOpInterface, arguments: &mut [AnalysisStateGuardMut<'_, Self::Lattice>], results: &[AnalysisStateGuard<'_, Self::Lattice>], solver: &mut DataFlowSolver, )

The transfer function for calls to external functions.

This function is expected to set lattice values of the call operands. By default, this calls [visit_call_operand] for all operands.

Implementors§