pub trait SparseForwardDataFlowAnalysis: 'static {
type Lattice: BuildableAnalysisState + SparseLattice;
// Required methods
fn visit_operation(
&self,
op: &Operation,
operands: &[AnalysisStateGuard<'_, Self::Lattice>],
results: &mut [AnalysisStateGuardMut<'_, Self::Lattice>],
solver: &mut DataFlowSolver,
) -> Result<(), Report>;
fn set_to_entry_state(
&self,
lattice: &mut AnalysisStateGuardMut<'_, Self::Lattice>,
);
// Provided methods
fn debug_name(&self) -> &'static str { ... }
fn visit_external_call(
&self,
call: &dyn CallOpInterface,
arguments: &[AnalysisStateGuard<'_, Self::Lattice>],
results: &mut [AnalysisStateGuardMut<'_, Self::Lattice>],
solver: &mut DataFlowSolver,
) { ... }
fn visit_non_control_flow_arguments(
&self,
op: &Operation,
successor: &RegionSuccessor<'_>,
arguments: &mut [AnalysisStateGuardMut<'_, Self::Lattice>],
first_index: usize,
solver: &mut DataFlowSolver,
) { ... }
}
Expand description
The base trait for sparse forward data-flow analyses.
A sparse analysis implements a transfer function on operations from the lattices of the operands to the lattices of the results. This analysis will propagate lattices across control-flow edges and the callgraph using liveness information.
Visiting a program point in sparse forward 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§
Sourcefn visit_operation(
&self,
op: &Operation,
operands: &[AnalysisStateGuard<'_, Self::Lattice>],
results: &mut [AnalysisStateGuardMut<'_, Self::Lattice>],
solver: &mut DataFlowSolver,
) -> Result<(), Report>
fn visit_operation( &self, op: &Operation, operands: &[AnalysisStateGuard<'_, Self::Lattice>], results: &mut [AnalysisStateGuardMut<'_, Self::Lattice>], solver: &mut DataFlowSolver, ) -> Result<(), Report>
The operation transfer function.
Given the operand lattices, this function is expected to set the result lattices.
Sourcefn set_to_entry_state(
&self,
lattice: &mut AnalysisStateGuardMut<'_, Self::Lattice>,
)
fn set_to_entry_state( &self, lattice: &mut AnalysisStateGuardMut<'_, Self::Lattice>, )
Set the given lattice element(s) at control flow entry point(s).
Provided Methods§
fn debug_name(&self) -> &'static str
Sourcefn visit_external_call(
&self,
call: &dyn CallOpInterface,
arguments: &[AnalysisStateGuard<'_, Self::Lattice>],
results: &mut [AnalysisStateGuardMut<'_, Self::Lattice>],
solver: &mut DataFlowSolver,
)
fn visit_external_call( &self, call: &dyn CallOpInterface, arguments: &[AnalysisStateGuard<'_, Self::Lattice>], results: &mut [AnalysisStateGuardMut<'_, Self::Lattice>], solver: &mut DataFlowSolver, )
The transfer function for calls to external functions.
Sourcefn visit_non_control_flow_arguments(
&self,
op: &Operation,
successor: &RegionSuccessor<'_>,
arguments: &mut [AnalysisStateGuardMut<'_, Self::Lattice>],
first_index: usize,
solver: &mut DataFlowSolver,
)
fn visit_non_control_flow_arguments( &self, op: &Operation, successor: &RegionSuccessor<'_>, arguments: &mut [AnalysisStateGuardMut<'_, Self::Lattice>], first_index: usize, solver: &mut DataFlowSolver, )
Given an operation with region control-flow, the lattices of the operands, and a region successor, compute the lattice values for block arguments that are not accounted for by the branching control flow (ex. the bounds of loops).
By default, this method marks all such lattice elements as having reached a pessimistic fixpoint.
first_index
is the index of the first element of arguments
that is set by control-flow.