LLZK 3.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches
llzk::dataflow::SparseForwardDataFlowAnalysis< StateT > Class Template Referenceabstract

A sparse forward data-flow analysis for propagating SSA value lattices across the IR by implementing transfer functions for operations. More...

#include <SparseAnalysis.h>

Inheritance diagram for llzk::dataflow::SparseForwardDataFlowAnalysis< StateT >:
[legend]
Collaboration diagram for llzk::dataflow::SparseForwardDataFlowAnalysis< StateT >:
[legend]

Public Member Functions

 SparseForwardDataFlowAnalysis (mlir::DataFlowSolver &s)
virtual mlir::LogicalResult visitOperation (mlir::Operation *op, mlir::ArrayRef< const StateT * > operands, mlir::ArrayRef< StateT * > results)=0
 Visit an operation with the lattices of its operands.
virtual void visitExternalCall (mlir::CallOpInterface, mlir::ArrayRef< const StateT * >, mlir::ArrayRef< StateT * > resultLattices)
 Visit a call operation to an externally defined function given the lattices of its arguments.
virtual void visitNonControlFlowArguments (mlir::Operation *, const mlir::RegionSuccessor &successor, mlir::ArrayRef< StateT * > argLattices, unsigned firstIndex)
 Given an operation with possible 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.
Public Member Functions inherited from llzk::dataflow::AbstractSparseForwardDataFlowAnalysis
mlir::LogicalResult initialize (mlir::Operation *top) override
 Initialize the analysis while preserving the program-order visitation of the old LLZK sparse analysis port.
mlir::LogicalResult visit (mlir::ProgramPoint *point) override
 Delegate block starts and result-producing operations to upstream MLIR.

Protected Member Functions

StateT * getLatticeElement (mlir::Value value) override
 Get the lattice element for a value.
const StateT * getLatticeElementFor (mlir::ProgramPoint *point, mlir::Value value)
 Get the lattice element for a value and create a dependency on the provided program point.
virtual void setToEntryState (StateT *lattice)=0
 Set the given lattice element(s) at control-flow entry point(s).
void setAllToEntryStates (mlir::ArrayRef< StateT * > lattices)
Protected Member Functions inherited from llzk::dataflow::AbstractSparseForwardDataFlowAnalysis
 AbstractSparseForwardDataFlowAnalysis (mlir::DataFlowSolver &s)

Additional Inherited Members

Protected Attributes inherited from llzk::dataflow::AbstractSparseForwardDataFlowAnalysis
mlir::SymbolTableCollection tables
 LLZK: Kept as a compatibility cache for analyses that derived from the old ported class and used this protected member.

Detailed Description

template<typename StateT>
class llzk::dataflow::SparseForwardDataFlowAnalysis< StateT >

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

StateT is expected to be a subclass of AbstractSparseLattice.

Definition at line 126 of file SparseAnalysis.h.

Constructor & Destructor Documentation

◆ SparseForwardDataFlowAnalysis()

template<typename StateT>
llzk::dataflow::SparseForwardDataFlowAnalysis< StateT >::SparseForwardDataFlowAnalysis ( mlir::DataFlowSolver & s)
inlineexplicit

Definition at line 133 of file SparseAnalysis.h.

Member Function Documentation

◆ getLatticeElement()

template<typename StateT>
StateT * llzk::dataflow::SparseForwardDataFlowAnalysis< StateT >::getLatticeElement ( mlir::Value value)
inlineoverrideprotected

Get the lattice element for a value.

Definition at line 168 of file SparseAnalysis.h.

◆ getLatticeElementFor()

template<typename StateT>
const StateT * llzk::dataflow::SparseForwardDataFlowAnalysis< StateT >::getLatticeElementFor ( mlir::ProgramPoint * point,
mlir::Value value )
inlineprotected

Get the lattice element for a value and create a dependency on the provided program point.

Definition at line 172 of file SparseAnalysis.h.

◆ setAllToEntryStates()

template<typename StateT>
void llzk::dataflow::SparseForwardDataFlowAnalysis< StateT >::setAllToEntryStates ( mlir::ArrayRef< StateT * > lattices)
inlineprotected

Definition at line 180 of file SparseAnalysis.h.

◆ setToEntryState()

template<typename StateT>
virtual void llzk::dataflow::SparseForwardDataFlowAnalysis< StateT >::setToEntryState ( StateT * lattice)
protectedpure virtual

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

Implemented in llzk::SourceRefAnalysis.

◆ visitExternalCall()

template<typename StateT>
virtual void llzk::dataflow::SparseForwardDataFlowAnalysis< StateT >::visitExternalCall ( mlir::CallOpInterface ,
mlir::ArrayRef< const StateT * > ,
mlir::ArrayRef< StateT * > resultLattices )
inlinevirtual

Visit a call operation to an externally defined function given the lattices of its arguments.

Reimplemented in llzk::SourceRefAnalysis.

Definition at line 145 of file SparseAnalysis.h.

◆ visitNonControlFlowArguments()

template<typename StateT>
virtual void llzk::dataflow::SparseForwardDataFlowAnalysis< StateT >::visitNonControlFlowArguments ( mlir::Operation * ,
const mlir::RegionSuccessor & successor,
mlir::ArrayRef< StateT * > argLattices,
unsigned firstIndex )
inlinevirtual

Given an operation with possible 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. firstIndex is the index of the first element of argLattices that is set by control-flow.

Definition at line 158 of file SparseAnalysis.h.

◆ visitOperation()

template<typename StateT>
virtual mlir::LogicalResult llzk::dataflow::SparseForwardDataFlowAnalysis< StateT >::visitOperation ( mlir::Operation * op,
mlir::ArrayRef< const StateT * > operands,
mlir::ArrayRef< StateT * > results )
pure virtual

Visit an operation with the lattices of its operands.

This function is expected to set the lattices of the operation's results. LLZK also invokes this hook for live, non-call, non-region-branch operations with no results.

Implemented in llzk::IntervalDataFlowAnalysis, and llzk::SourceRefAnalysis.


The documentation for this class was generated from the following file: