MLIR  19.0.0git
Public Member Functions | List of all members
mlir::dataflow::LivenessAnalysis Class Reference

An analysis that, by going backwards along the dataflow graph, annotates each value with a boolean storing true iff it is "live". More...

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

+ Inheritance diagram for mlir::dataflow::LivenessAnalysis:

Public Member Functions

void visitOperation (Operation *op, ArrayRef< Liveness * > operands, ArrayRef< const Liveness * > results) override
 For every value, liveness analysis determines whether or not it is "live". More...
 
void visitBranchOperand (OpOperand &operand) override
 
void visitCallOperand (OpOperand &operand) override
 
void setToExitState (Liveness *lattice) override
 Set the given lattice element(s) at control flow exit point(s). More...
 
 SparseBackwardDataFlowAnalysis (DataFlowSolver &solver, SymbolTableCollection &symbolTable)
 
- Public Member Functions inherited from mlir::dataflow::SparseBackwardDataFlowAnalysis< Liveness >
 SparseBackwardDataFlowAnalysis (DataFlowSolver &solver, SymbolTableCollection &symbolTable)
 
virtual void visitExternalCall (CallOpInterface call, ArrayRef< Liveness * > argumentLattices, ArrayRef< const Liveness * > resultLattices)
 Visit a call to an external function. More...
 
- Public Member Functions inherited from mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis
LogicalResult initialize (Operation *top) override
 Initialize the analysis by visiting the operation and everything nested under it. 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...
 

Additional Inherited Members

- Protected Member Functions inherited from mlir::dataflow::SparseBackwardDataFlowAnalysis< Liveness >
LivenessgetLatticeElement (Value value) override
 Get the lattice element for a value. More...
 
void setToExitState (AbstractSparseLattice *lattice) override
 Set the given lattice element(s) at control flow exit point(s). More...
 
void setAllToExitStates (ArrayRef< Liveness * > lattices)
 
- Protected Member Functions inherited from mlir::dataflow::AbstractSparseBackwardDataFlowAnalysis
 AbstractSparseBackwardDataFlowAnalysis (DataFlowSolver &solver, SymbolTableCollection &symbolTable)
 
void setAllToExitStates (ArrayRef< AbstractSparseLattice * > lattices)
 Set the given lattice element(s) at control flow exit point(s). More...
 
SmallVector< AbstractSparseLattice * > getLatticeElements (ValueRange values)
 Get the lattice elements for a range of values. More...
 
void meet (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 program point on this analysis. More...
 
void propagateIfChanged (AnalysisState *state, ChangeResult changed)
 Propagate an update to a state if it changed. More...
 
template<typename PointT >
void registerPointKind ()
 Register a custom program point class. More...
 
template<typename PointT , typename... Args>
PointT * getProgramPoint (Args &&...args)
 Get or create a custom program point. More...
 
template<typename StateT , typename PointT >
StateT * getOrCreate (PointT point)
 Get the analysis state associated with the program point. More...
 
template<typename StateT , typename PointT >
const StateT * getOrCreateFor (ProgramPoint dependent, PointT point)
 Get a read-only analysis state for the given point and create a dependency on dependent. More...
 
const DataFlowConfiggetSolverConfig () const
 Return the configuration of the solver used for this analysis. More...
 

Detailed Description

An analysis that, by going backwards along the dataflow graph, annotates each value with a boolean storing true iff it is "live".

Definition at line 78 of file LivenessAnalysis.h.

Member Function Documentation

◆ setToExitState()

void LivenessAnalysis::setToExitState ( Liveness lattice)
overridevirtual

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

Implements mlir::dataflow::SparseBackwardDataFlowAnalysis< Liveness >.

Definition at line 192 of file LivenessAnalysis.cpp.

References mlir::dataflow::Liveness::markLive().

◆ SparseBackwardDataFlowAnalysis()

Definition at line 471 of file SparseAnalysis.h.

◆ visitBranchOperand()

void LivenessAnalysis::visitBranchOperand ( OpOperand operand)
overridevirtual

◆ visitCallOperand()

void LivenessAnalysis::visitCallOperand ( OpOperand operand)
overridevirtual

◆ visitOperation()

void LivenessAnalysis::visitOperation ( Operation op,
ArrayRef< Liveness * >  operands,
ArrayRef< const Liveness * >  results 
)
overridevirtual

For every value, liveness analysis determines whether or not it is "live".

A value is considered "live" iff it: (1) has memory effects OR (2) is returned by a public function OR (3) is used to compute a value of type (1) or (2). It is also to be noted that a value could be of multiple types (1/2/3) at the same time.

A value "has memory effects" iff it: (1.a) is an operand of an op with memory effects OR (1.b) is a non-forwarded branch operand and its branch op could take the control to a block that has an op with memory effects OR (1.c) is a non-forwarded call operand.

A value A is said to be "used to compute" value B iff B cannot be computed in the absence of A. Thus, in this implementation, we say that value A is used to compute value B iff: (3.a) B is a result of an op with operand A OR (3.b) A is used to compute some value C and C is used to compute B.

Implements mlir::dataflow::SparseBackwardDataFlowAnalysis< Liveness >.

Definition at line 71 of file LivenessAnalysis.cpp.


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