LLZK 0.1.0
Veridise's ZK Language IR
Loading...
Searching...
No Matches
llzk::SourceRefAnalysis Class Reference

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 Member Functions

void visitCallControlFlowTransfer (mlir::CallOpInterface call, dataflow::CallControlFlowAction action, const SourceRefLattice &before, SourceRefLattice *after) override
 Hook for customizing the behavior of lattice propagation along the call control flow edges.
mlir::LogicalResult visitOperation (mlir::Operation *op, const SourceRefLattice &before, SourceRefLattice *after) override
 Propagate SourceRef lattice values from operands to results.
Public Member Functions inherited from llzk::dataflow::DenseForwardDataFlowAnalysis< SourceRefLattice >
virtual void visitRegionBranchControlFlowTransfer (mlir::RegionBranchOpInterface branch, std::optional< unsigned > regionFrom, std::optional< unsigned > regionTo, const SourceRefLattice &before, SourceRefLattice *after)
 Hook for customizing the behavior of lattice propagation along the control flow edges between regions and their parent op.
Public Member Functions inherited from llzk::dataflow::AbstractDenseForwardDataFlowAnalysis
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

void setToEntryState (SourceRefLattice *lattice) override
 Set the dense lattice at control flow entry point and propagate an update if it changed.
mlir::ChangeResult fallbackOpUpdate (mlir::Operation *op, const SourceRefLattice::ValueMap &operandVals, const SourceRefLattice &before, SourceRefLattice *after)
void arraySubdivisionOpUpdate (array::ArrayAccessOpInterface op, const SourceRefLattice::ValueMap &operandVals, const SourceRefLattice &before, SourceRefLattice *after)
Protected Member Functions inherited from llzk::dataflow::DenseForwardDataFlowAnalysis< SourceRefLattice >
SourceRefLatticegetLattice (mlir::LatticeAnchor anchor) override
 Get the dense lattice on this lattice anchor.
mlir::LogicalResult visitOperationImpl (mlir::Operation *op, const AbstractDenseLattice &before, AbstractDenseLattice *after) final
 Type-erased wrappers that convert the abstract dense lattice to a derived lattice and invoke the virtual hooks operating on the derived lattice.
Protected Member Functions inherited from llzk::dataflow::AbstractDenseForwardDataFlowAnalysis
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.

Additional Inherited Members

Protected Attributes inherited from llzk::dataflow::AbstractDenseForwardDataFlowAnalysis
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 35 of file ConstraintDependencyGraph.h.

Member Function Documentation

◆ arraySubdivisionOpUpdate()

void llzk::SourceRefAnalysis::arraySubdivisionOpUpdate ( array::ArrayAccessOpInterface op,
const SourceRefLattice::ValueMap & operandVals,
const SourceRefLattice & before,
SourceRefLattice * after )
protected

Definition at line 223 of file ConstraintDependencyGraph.cpp.

◆ fallbackOpUpdate()

mlir::ChangeResult llzk::SourceRefAnalysis::fallbackOpUpdate ( mlir::Operation * op,
const SourceRefLattice::ValueMap & operandVals,
const SourceRefLattice & before,
SourceRefLattice * after )
protected

Definition at line 204 of file ConstraintDependencyGraph.cpp.

◆ setToEntryState()

void llzk::SourceRefAnalysis::setToEntryState ( SourceRefLattice * lattice)
inlineoverrideprotectedvirtual

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

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

Definition at line 53 of file ConstraintDependencyGraph.h.

◆ visitCallControlFlowTransfer()

void llzk::SourceRefAnalysis::visitCallControlFlowTransfer ( mlir::CallOpInterface call,
dataflow::CallControlFlowAction action,
const SourceRefLattice & before,
SourceRefLattice * after )
overridevirtual

Hook for customizing the behavior of lattice propagation along the call control flow edges.

Two types of (forward) propagation are possible here:

  • action == CallControlFlowAction::Enter indicates that:
    • before is the state before the call operation;
    • after is the state at the beginning of the callee entry block;
  • action == CallControlFlowAction::Exit indicates that:
    • before is the state at the end of a callee exit block;
    • after is the state after the call operation. By default, the after state is simply joined with the before state. Concrete analyses can override this behavior or delegate to the parent call for the default behavior. Specifically, if the call op may affect the lattice prior to entering the callee, the custom behavior can be added for action == CallControlFlowAction::Enter. If the call op may affect the lattice post exiting the callee, the custom behavior can be added for action == CallControlFlowAction::Exit.

action == CallControlFlowAction::Enter indicates that:

  • before is the state before the call operation;
  • after is the state at the beginning of the callee entry block;

action == CallControlFlowAction::Exit indicates that:

  • before is the state at the end of a callee exit block;
  • after is the state after the call operation.

action == CallControlFlowAction::External indicates that:

  • before is the state before the call operation.
  • after is the state after the call operation, since there is no callee body to enter into.

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

Definition at line 41 of file ConstraintDependencyGraph.cpp.

◆ visitOperation()

mlir::LogicalResult llzk::SourceRefAnalysis::visitOperation ( mlir::Operation * op,
const SourceRefLattice & before,
SourceRefLattice * after )
overridevirtual

Propagate SourceRef lattice values from operands to results.

Parameters
op
before
after

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

Definition at line 128 of file ConstraintDependencyGraph.cpp.


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