MLIR  20.0.0git
Public Member Functions | Protected Member Functions | List of all members
mlir::dataflow::AbstractSparseForwardDataFlowAnalysis Class Referenceabstract

Base class for sparse forward data-flow analyses. More...

#include "mlir/Analysis/DataFlow/SparseAnalysis.h"

+ Inheritance diagram for mlir::dataflow::AbstractSparseForwardDataFlowAnalysis:

Public Member Functions

LogicalResult initialize (Operation *top) override
 Initialize the analysis by visiting every owner of an SSA value: all operations and blocks. More...
 
LogicalResult visit (ProgramPoint *point) override
 Visit a program point. More...
 
- Public Member Functions inherited from mlir::DataFlowAnalysis
virtual ~DataFlowAnalysis ()
 
 DataFlowAnalysis (DataFlowSolver &solver)
 Create an analysis with a reference to the parent solver. More...
 

Protected Member Functions

 AbstractSparseForwardDataFlowAnalysis (DataFlowSolver &solver)
 
virtual LogicalResult visitOperationImpl (Operation *op, ArrayRef< const AbstractSparseLattice * > operandLattices, ArrayRef< AbstractSparseLattice * > resultLattices)=0
 The operation transfer function. More...
 
virtual void visitExternalCallImpl (CallOpInterface call, ArrayRef< const AbstractSparseLattice * > argumentLattices, ArrayRef< AbstractSparseLattice * > resultLattices)=0
 The transfer function for calls to external functions. More...
 
virtual void visitNonControlFlowArgumentsImpl (Operation *op, const RegionSuccessor &successor, ArrayRef< AbstractSparseLattice * > argLattices, unsigned firstIndex)=0
 Given an operation with 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. More...
 
virtual AbstractSparseLatticegetLatticeElement (Value value)=0
 Get the lattice element of a value. More...
 
const AbstractSparseLatticegetLatticeElementFor (ProgramPoint *point, Value value)
 Get a read-only lattice element for a value and add it as a dependency to a program point. More...
 
virtual void setToEntryState (AbstractSparseLattice *lattice)=0
 Set the given lattice element(s) at control flow entry point(s). More...
 
void setAllToEntryStates (ArrayRef< AbstractSparseLattice * > lattices)
 
void join (AbstractSparseLattice *lhs, const AbstractSparseLattice &rhs)
 Join the lattice element and propagate and update if it changed. More...
 
- Protected Member Functions inherited from mlir::DataFlowAnalysis
void addDependency (AnalysisState *state, ProgramPoint *point)
 Create a dependency between the given analysis state and lattice anchor on this analysis. More...
 
void propagateIfChanged (AnalysisState *state, ChangeResult changed)
 Propagate an update to a state if it changed. More...
 
template<typename AnchorT >
void registerAnchorKind ()
 Register a custom lattice anchor class. More...
 
template<typename AnchorT , typename... Args>
AnchorT * getLatticeAnchor (Args &&...args)
 Get or create a custom lattice anchor. More...
 
template<typename StateT , typename AnchorT >
StateT * getOrCreate (AnchorT anchor)
 Get the analysis state associated with the lattice anchor. More...
 
template<typename StateT , typename AnchorT >
const StateT * getOrCreateFor (ProgramPoint *dependent, AnchorT anchor)
 Get a read-only analysis state for the given point and create a dependency on dependent. More...
 
ProgramPointgetProgramPointBefore (Operation *op)
 Get a uniqued program point instance. More...
 
ProgramPointgetProgramPointBefore (Block *block)
 
ProgramPointgetProgramPointAfter (Operation *op)
 
ProgramPointgetProgramPointAfter (Block *block)
 
const DataFlowConfiggetSolverConfig () const
 Return the configuration of the solver used for this analysis. More...
 

Detailed Description

Base class for sparse forward data-flow analyses.

A sparse analysis implements a transfer function on operations from the lattices of the operands to the lattices of the results. This analysis will propagate lattices across control-flow edges and the callgraph using liveness information.

Visit a program point in sparse forward 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 186 of file SparseAnalysis.h.

Constructor & Destructor Documentation

◆ AbstractSparseForwardDataFlowAnalysis()

AbstractSparseForwardDataFlowAnalysis::AbstractSparseForwardDataFlowAnalysis ( DataFlowSolver solver)
explicitprotected

Definition at line 46 of file SparseAnalysis.cpp.

Member Function Documentation

◆ getLatticeElement()

virtual AbstractSparseLattice* mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::getLatticeElement ( Value  value)
protectedpure virtual

◆ getLatticeElementFor()

const AbstractSparseLattice * AbstractSparseForwardDataFlowAnalysis::getLatticeElementFor ( ProgramPoint point,
Value  value 
)
protected

Get a read-only lattice element for a value and add it as a dependency to a program point.

Definition at line 308 of file SparseAnalysis.cpp.

Referenced by mlir::dataflow::SparseForwardDataFlowAnalysis< StateT >::getLatticeElementFor().

◆ initialize()

LogicalResult AbstractSparseForwardDataFlowAnalysis::initialize ( Operation top)
overridevirtual

Initialize the analysis by visiting every owner of an SSA value: all operations and blocks.

Implements mlir::DataFlowAnalysis.

Definition at line 53 of file SparseAnalysis.cpp.

References getLatticeElement(), mlir::Operation::getRegions(), and setToEntryState().

◆ join()

void AbstractSparseForwardDataFlowAnalysis::join ( AbstractSparseLattice lhs,
const AbstractSparseLattice rhs 
)
protected

Join the lattice element and propagate and update if it changed.

Definition at line 321 of file SparseAnalysis.cpp.

References mlir::dataflow::AbstractSparseLattice::join(), and mlir::DataFlowAnalysis::propagateIfChanged().

Referenced by mlir::dataflow::SparseConstantPropagation::visitOperation().

◆ setAllToEntryStates()

void AbstractSparseForwardDataFlowAnalysis::setAllToEntryStates ( ArrayRef< AbstractSparseLattice * >  lattices)
protected

◆ setToEntryState()

virtual void mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::setToEntryState ( AbstractSparseLattice lattice)
protectedpure virtual

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

Referenced by initialize(), and setAllToEntryStates().

◆ visit()

LogicalResult AbstractSparseForwardDataFlowAnalysis::visit ( ProgramPoint point)
overridevirtual

Visit a program point.

If this is at beginning of block and all control-flow predecessors or callsites are known, then the arguments lattices are propagated from them. If this is after call operation or an operation with region control-flow, then its result lattices are set accordingly. Otherwise, the operation transfer function is invoked.

Implements mlir::DataFlowAnalysis.

Definition at line 88 of file SparseAnalysis.cpp.

References mlir::ProgramPoint::getBlock(), mlir::ProgramPoint::getPrevOp(), and mlir::ProgramPoint::isBlockStart().

◆ visitExternalCallImpl()

virtual void mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::visitExternalCallImpl ( CallOpInterface  call,
ArrayRef< const AbstractSparseLattice * >  argumentLattices,
ArrayRef< AbstractSparseLattice * >  resultLattices 
)
protectedpure virtual

The transfer function for calls to external functions.

◆ visitNonControlFlowArgumentsImpl()

virtual void mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::visitNonControlFlowArgumentsImpl ( Operation op,
const RegionSuccessor successor,
ArrayRef< AbstractSparseLattice * >  argLattices,
unsigned  firstIndex 
)
protectedpure virtual

Given an operation with 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).

◆ visitOperationImpl()

virtual LogicalResult mlir::dataflow::AbstractSparseForwardDataFlowAnalysis::visitOperationImpl ( Operation op,
ArrayRef< const AbstractSparseLattice * >  operandLattices,
ArrayRef< AbstractSparseLattice * >  resultLattices 
)
protectedpure virtual

The operation transfer function.

Given the operand lattices, this function is expected to set the result lattices.


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