LLZK 0.1.0
Veridise's ZK Language IR
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 call, mlir::ArrayRef< const StateT * > argumentLattices, mlir::ArrayRef< StateT * > resultLattices)
 Visit a call operation to an externally defined function given the lattices of its arguments.
virtual void visitNonControlFlowArguments (mlir::Operation *op, 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 by visiting every owner of an SSA value: all operations and blocks.
mlir::LogicalResult visit (mlir::ProgramPoint *point) override
 Visit a program point.

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 &solver)
const AbstractSparseLatticegetLatticeElementFor (mlir::ProgramPoint *point, mlir::Value value)
 Get a read-only lattice element for a value and add it as a dependency to a program point.
void setAllToEntryStates (mlir::ArrayRef< AbstractSparseLattice * > lattices)
void join (AbstractSparseLattice *lhs, const AbstractSparseLattice &rhs)
 Join the lattice element and propagate and update if it changed.

Additional Inherited Members

Protected Attributes inherited from llzk::dataflow::AbstractSparseForwardDataFlowAnalysis
mlir::SymbolTableCollection tables
 LLZK: Added for use of symbol helper caching.

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 151 of file SparseAnalysis.h.

Constructor & Destructor Documentation

◆ SparseForwardDataFlowAnalysis()

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

Definition at line 158 of file SparseAnalysis.h.

Member Function Documentation

◆ getLatticeElement()

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

Get the lattice element for a value.

Implements llzk::dataflow::AbstractSparseForwardDataFlowAnalysis.

Definition at line 192 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 196 of file SparseAnalysis.h.

◆ setAllToEntryStates()

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

Definition at line 204 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).

◆ visitExternalCall()

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

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

Definition at line 169 of file SparseAnalysis.h.

◆ visitNonControlFlowArguments()

template<typename StateT>
virtual void llzk::dataflow::SparseForwardDataFlowAnalysis< StateT >::visitNonControlFlowArguments ( mlir::Operation * op,
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 182 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.

Implemented in llzk::IntervalDataFlowAnalysis.


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