LLZK 2.0.0
An open-source IR for Zero Knowledge (ZK) circuits
Loading...
Searching...
No Matches

The dataflow analysis that computes the set of references that LLZK operations use and produce. More...

#include <ConstraintDependencyGraph.h>

Inheritance diagram for llzk::SourceRefAnalysis:
[legend]
Collaboration diagram for llzk::SourceRefAnalysis:
[legend]

Public Types

using Lattice = SourceRefLattice
using OperandValues = mlir::DenseMap<mlir::Value, const Lattice *>
using Base = dataflow::SparseForwardDataFlowAnalysis<Lattice>

Public Member Functions

mlir::LogicalResult visitOperation (mlir::Operation *op, mlir::ArrayRef< const Lattice * > operands, mlir::ArrayRef< Lattice * > results) override
 Propagate SourceRef lattice values from operands to results.
void visitExternalCall (mlir::CallOpInterface call, mlir::ArrayRef< const Lattice * > argumentLattices, mlir::ArrayRef< Lattice * > resultLattices) override
 Visit a call operation to an externally defined function given the lattices of its arguments.
 SparseForwardDataFlowAnalysis (mlir::DataFlowSolver &s)
Public Member Functions inherited from llzk::dataflow::SparseForwardDataFlowAnalysis< SourceRefLattice >
 SparseForwardDataFlowAnalysis (mlir::DataFlowSolver &s)
virtual void visitNonControlFlowArguments (mlir::Operation *, const mlir::RegionSuccessor &successor, mlir::ArrayRef< SourceRefLattice * > 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.

Static Public Member Functions

static const LatticegetLattice (mlir::DataFlowSolver &solver, mlir::Value val)
static SourceRefLatticeValue getValueState (mlir::DataFlowSolver &solver, mlir::Value val)
static mlir::FailureOr< SourceRefLatticeValuegetWriteTargetState (mlir::DataFlowSolver &solver, mlir::Operation *op)

Protected Member Functions

void setToEntryState (Lattice *lattice) override
 Set the given lattice element(s) at control flow entry point(s).
Protected Member Functions inherited from llzk::dataflow::SparseForwardDataFlowAnalysis< SourceRefLattice >
SourceRefLatticegetLatticeElement (mlir::Value value) override
 Get the lattice element for a value.
const SourceRefLatticegetLatticeElementFor (mlir::ProgramPoint *point, mlir::Value value)
 Get the lattice element for a value and create a dependency on the provided program point.
void setAllToEntryStates (mlir::ArrayRef< SourceRefLattice * > 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.
virtual void setToEntryState (AbstractSparseLattice *lattice)=0
 Set the given lattice element(s) at control flow entry point(s).
void setAllToEntryStates (mlir::ArrayRef< AbstractSparseLattice * > lattices)
void join (AbstractSparseLattice *lhs, const AbstractSparseLattice &rhs)
 Join the lattice element and propagate and update if it changed.

Static Protected Member Functions

static mlir::ChangeResult fallbackOpUpdate (mlir::Operation *op, const OperandValues &operandVals, mlir::ArrayRef< Lattice * > results)
static SourceRefLatticeValue arraySubdivisionOpUpdate (array::ArrayAccessOpInterface op, const OperandValues &operandVals)

Additional Inherited Members

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

Detailed Description

The dataflow analysis that computes the set of references that LLZK operations use and produce.

The analysis is simple: any operation will simply output a union of its input references, regardless of what type of operation it performs, as the analysis is operator-insensitive.

Definition at line 36 of file ConstraintDependencyGraph.h.

Member Typedef Documentation

◆ Base

◆ Lattice

◆ OperandValues

using llzk::SourceRefAnalysis::OperandValues = mlir::DenseMap<mlir::Value, const Lattice *>

Definition at line 39 of file ConstraintDependencyGraph.h.

Member Function Documentation

◆ arraySubdivisionOpUpdate()

SourceRefLatticeValue llzk::SourceRefAnalysis::arraySubdivisionOpUpdate ( array::ArrayAccessOpInterface op,
const OperandValues & operandVals )
staticprotected

Definition at line 260 of file ConstraintDependencyGraph.cpp.

◆ fallbackOpUpdate()

ChangeResult llzk::SourceRefAnalysis::fallbackOpUpdate ( mlir::Operation * op,
const OperandValues & operandVals,
mlir::ArrayRef< Lattice * > results )
staticprotected

Definition at line 246 of file ConstraintDependencyGraph.cpp.

◆ getLattice()

const SourceRefAnalysis::Lattice * llzk::SourceRefAnalysis::getLattice ( mlir::DataFlowSolver & solver,
mlir::Value val )
static

Definition at line 54 of file ConstraintDependencyGraph.cpp.

◆ getValueState()

SourceRefLatticeValue llzk::SourceRefAnalysis::getValueState ( mlir::DataFlowSolver & solver,
mlir::Value val )
static

Definition at line 58 of file ConstraintDependencyGraph.cpp.

◆ getWriteTargetState()

mlir::FailureOr< SourceRefLatticeValue > llzk::SourceRefAnalysis::getWriteTargetState ( mlir::DataFlowSolver & solver,
mlir::Operation * op )
static

Definition at line 66 of file ConstraintDependencyGraph.cpp.

◆ setToEntryState()

void llzk::SourceRefAnalysis::setToEntryState ( Lattice * lattice)
overrideprotectedvirtual

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

Implements llzk::dataflow::SparseForwardDataFlowAnalysis< SourceRefLattice >.

Definition at line 123 of file ConstraintDependencyGraph.cpp.

◆ SparseForwardDataFlowAnalysis()

llzk::dataflow::SparseForwardDataFlowAnalysis< Lattice >::SparseForwardDataFlowAnalysis ( mlir::DataFlowSolver & s)
inlineexplicit

Definition at line 158 of file SparseAnalysis.h.

◆ visitExternalCall()

void llzk::SourceRefAnalysis::visitExternalCall ( mlir::CallOpInterface ,
mlir::ArrayRef< const Lattice * > ,
mlir::ArrayRef< Lattice * > resultLattices )
overridevirtual

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

Reimplemented from llzk::dataflow::SparseForwardDataFlowAnalysis< SourceRefLattice >.

Definition at line 192 of file ConstraintDependencyGraph.cpp.

◆ visitOperation()

LogicalResult llzk::SourceRefAnalysis::visitOperation ( mlir::Operation * op,
mlir::ArrayRef< const Lattice * > operands,
mlir::ArrayRef< Lattice * > results )
overridevirtual

Propagate SourceRef lattice values from operands to results.

Parameters
op

Implements llzk::dataflow::SparseForwardDataFlowAnalysis< SourceRefLattice >.

Definition at line 129 of file ConstraintDependencyGraph.cpp.


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