LLZK 0.1.0
Veridise's ZK Language IR
Loading...
Searching...
No Matches
llzk::dataflow::AbstractDenseForwardDataFlowAnalysis Class Referenceabstract

LLZK: This class has been ported from the MLIR DenseAnalysis utilities to allow for the use of custom LLZK symbol lookup logic. More...

#include <DenseAnalysis.h>

Inheritance diagram for llzk::dataflow::AbstractDenseForwardDataFlowAnalysis:
[legend]
Collaboration diagram for llzk::dataflow::AbstractDenseForwardDataFlowAnalysis:
[legend]

Public Member Functions

mlir::LogicalResult initialize (mlir::Operation *top) override
 Initialize the analysis by visiting every program point whose execution may modify the program state; that is, every operation and block.
mlir::LogicalResult visit (mlir::ProgramPoint *point) override
 Visit a program point that modifies the state of the program.

Protected Member Functions

virtual mlir::LogicalResult visitOperationImpl (mlir::Operation *op, const AbstractDenseLattice &before, AbstractDenseLattice *after)=0
 Propagate the dense lattice before the execution of an operation to the lattice after its execution.
virtual AbstractDenseLatticegetLattice (mlir::LatticeAnchor anchor)=0
 Get the dense lattice on the given lattice anchor.
const AbstractDenseLatticegetLatticeFor (mlir::ProgramPoint *dependent, mlir::LatticeAnchor anchor)
 Get the dense lattice on the given lattice anchor and add dependent as its dependency.
virtual void setToEntryState (AbstractDenseLattice *lattice)=0
 Set the dense lattice at control flow entry point and propagate an update if it changed.
void join (AbstractDenseLattice *lhs, const AbstractDenseLattice &rhs)
 Join a lattice with another and propagate an update if it changed.
virtual mlir::LogicalResult processOperation (mlir::Operation *op)
 Visit an operation.
virtual void visitRegionBranchControlFlowTransfer (mlir::RegionBranchOpInterface, std::optional< unsigned > regionFrom, std::optional< unsigned > regionTo, const AbstractDenseLattice &before, AbstractDenseLattice *after)
 Propagate the dense lattice forward along the control flow edge from regionFrom to regionTo regions of the branch operation.
virtual void visitCallControlFlowTransfer (mlir::CallOpInterface, CallControlFlowAction action, const AbstractDenseLattice &before, AbstractDenseLattice *after)
 Propagate the dense lattice forward along the call control flow edge, which can be either entering or exiting the callee.
void visitRegionBranchOperation (mlir::ProgramPoint *point, mlir::RegionBranchOpInterface branch, AbstractDenseLattice *after)
 Visit a program point within a region branch operation with predecessors in it.

Protected Attributes

mlir::SymbolTableCollection tables
 LLZK: Added for use of symbol helper caching.

Detailed Description

LLZK: This class has been ported from the MLIR DenseAnalysis utilities to allow for the use of custom LLZK symbol lookup logic.

The class has been left as unmodified as possible, with explicit comments added where modifications have been made.

Base class for dense forward data-flow analyses. Dense data-flow analysis attaches a lattice to program points and implements a transfer function from the lattice before each operation to the lattice after. The lattice contains information about the state of the program at that program point.

Visit a program point in forward dense data-flow analysis will invoke the transfer function of the operation preceding the program point iterator. Visit a program point at the begining of block will visit the block itself.

Definition at line 72 of file DenseAnalysis.h.

Member Function Documentation

◆ getLattice()

virtual AbstractDenseLattice * llzk::dataflow::AbstractDenseForwardDataFlowAnalysis::getLattice ( mlir::LatticeAnchor anchor)
protectedpure virtual

◆ getLatticeFor()

const AbstractDenseLattice * llzk::dataflow::AbstractDenseForwardDataFlowAnalysis::getLatticeFor ( mlir::ProgramPoint * dependent,
mlir::LatticeAnchor anchor )
protected

Get the dense lattice on the given lattice anchor and add dependent as its dependency.

That is, every time the lattice after anchor is updated, the dependent program point must be visited, and the newly triggered visit might update the lattice on dependent.

Definition at line 287 of file DenseAnalysis.cpp.

◆ initialize()

LogicalResult llzk::dataflow::AbstractDenseForwardDataFlowAnalysis::initialize ( mlir::Operation * top)
override

Initialize the analysis by visiting every program point whose execution may modify the program state; that is, every operation and block.

Definition at line 65 of file DenseAnalysis.cpp.

◆ join()

void llzk::dataflow::AbstractDenseForwardDataFlowAnalysis::join ( AbstractDenseLattice * lhs,
const AbstractDenseLattice & rhs )
inlineprotected

Join a lattice with another and propagate an update if it changed.

Definition at line 111 of file DenseAnalysis.h.

◆ processOperation()

LogicalResult llzk::dataflow::AbstractDenseForwardDataFlowAnalysis::processOperation ( mlir::Operation * op)
protectedvirtual

Visit an operation.

If this is a call operation or region control-flow operation, then the state after the execution of the operation is set by control-flow or the callgraph. Otherwise, this function invokes the operation transfer function.

Definition at line 138 of file DenseAnalysis.cpp.

◆ setToEntryState()

virtual void llzk::dataflow::AbstractDenseForwardDataFlowAnalysis::setToEntryState ( AbstractDenseLattice * lattice)
protectedpure virtual

Set the dense lattice at control flow entry point and propagate an update if it changed.

Implemented in llzk::dataflow::DenseForwardDataFlowAnalysis< LatticeT >, and llzk::dataflow::DenseForwardDataFlowAnalysis< IntervalAnalysisLattice >.

◆ visit()

LogicalResult llzk::dataflow::AbstractDenseForwardDataFlowAnalysis::visit ( mlir::ProgramPoint * point)
override

Visit a program point that modifies the state of the program.

If the program point is at the beginning of a block, then the state is propagated from control-flow predecessors or callsites. If the operation before program point iterator is a call operation or region control-flow operation, then the state after the execution of the operation is set by control-flow or the callgraph. Otherwise, this function invokes the operation transfer function before the program point iterator.

Definition at line 83 of file DenseAnalysis.cpp.

◆ visitCallControlFlowTransfer()

virtual void llzk::dataflow::AbstractDenseForwardDataFlowAnalysis::visitCallControlFlowTransfer ( mlir::CallOpInterface ,
CallControlFlowAction action,
const AbstractDenseLattice & before,
AbstractDenseLattice * after )
inlineprotectedvirtual

Propagate the dense lattice forward along the call control flow edge, which can be either entering or exiting the callee.

Default implementation for enter and exit callee actions just meets the states, meaning that operations implementing CallOpInterface don't have any effect on the lattice that isn't already expressed by the interface itself. Default implementation for the external callee action additionally sets the "after" lattice to the entry state.

Reimplemented in llzk::dataflow::DenseForwardDataFlowAnalysis< LatticeT >, and llzk::dataflow::DenseForwardDataFlowAnalysis< IntervalAnalysisLattice >.

Definition at line 143 of file DenseAnalysis.h.

◆ visitOperationImpl()

virtual mlir::LogicalResult llzk::dataflow::AbstractDenseForwardDataFlowAnalysis::visitOperationImpl ( mlir::Operation * op,
const AbstractDenseLattice & before,
AbstractDenseLattice * after )
protectedpure virtual

◆ visitRegionBranchControlFlowTransfer()

virtual void llzk::dataflow::AbstractDenseForwardDataFlowAnalysis::visitRegionBranchControlFlowTransfer ( mlir::RegionBranchOpInterface ,
std::optional< unsigned > regionFrom,
std::optional< unsigned > regionTo,
const AbstractDenseLattice & before,
AbstractDenseLattice * after )
inlineprotectedvirtual

Propagate the dense lattice forward along the control flow edge from regionFrom to regionTo regions of the branch operation.

nullopt values correspond to control flow branches originating at or targeting the branch operation itself. Default implementation just joins the states, meaning that operations implementing RegionBranchOpInterface don't have any effect on the lattice that isn't already expressed by the interface itself.

Reimplemented in llzk::dataflow::DenseForwardDataFlowAnalysis< LatticeT >, and llzk::dataflow::DenseForwardDataFlowAnalysis< IntervalAnalysisLattice >.

Definition at line 128 of file DenseAnalysis.h.

◆ visitRegionBranchOperation()

void llzk::dataflow::AbstractDenseForwardDataFlowAnalysis::visitRegionBranchOperation ( mlir::ProgramPoint * point,
mlir::RegionBranchOpInterface branch,
AbstractDenseLattice * after )
protected

Visit a program point within a region branch operation with predecessors in it.

LLZK: Removing use of PredecessorState because it does not work with LLZK's lookup logic.

This can either be an entry block of one of the regions of the parent operation itself.

Definition at line 239 of file DenseAnalysis.cpp.

Member Data Documentation

◆ tables

mlir::SymbolTableCollection llzk::dataflow::AbstractDenseForwardDataFlowAnalysis::tables
protected

LLZK: Added for use of symbol helper caching.

Definition at line 164 of file DenseAnalysis.h.


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