MLIR  19.0.0git
Public Types | Public Member Functions | List of all members
mlir::dataflow::Lattice< ValueT > Class Template Reference

This class represents a lattice holding a specific value of type ValueT. More...

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

+ Inheritance diagram for mlir::dataflow::Lattice< ValueT >:

Public Types

using LatticeT = Lattice< ValueT >
 
template<typename T , typename... Args>
using has_meet = decltype(std::declval< T >().meet())
 Trait to check if T provides a meet method. More...
 
template<typename T >
using lattice_has_meet = llvm::is_detected< has_meet, T >
 

Public Member Functions

Value getPoint () const
 Return the program point this lattice is located at. More...
 
ValueT & getValue ()
 Return the value held by this lattice. More...
 
const ValueT & getValue () const
 
ChangeResult join (const AbstractSparseLattice &rhs) override
 Join the information contained in the 'rhs' lattice into this lattice. More...
 
ChangeResult meet (const AbstractSparseLattice &rhs) override
 Meet (intersect) the information contained in the 'rhs' lattice with this lattice. More...
 
ChangeResult join (const ValueT &rhs)
 Join the information contained in the 'rhs' value into this lattice. More...
 
template<typename VT , std::enable_if_t< lattice_has_meet< VT >::value > >
ChangeResult meet (const VT &rhs)
 Meet (intersect) the information contained in the 'rhs' value with this lattice. More...
 
template<typename VT >
ChangeResult meet (const VT &rhs)
 
void print (raw_ostream &os) const override
 Print the lattice element. More...
 
 AbstractSparseLattice (Value value)
 Lattices can only be created for values. More...
 
- Public Member Functions inherited from mlir::dataflow::AbstractSparseLattice
 AbstractSparseLattice (Value value)
 Lattices can only be created for values. More...
 
Value getPoint () const
 Return the program point this lattice is located at. More...
 
void onUpdate (DataFlowSolver *solver) const override
 When the lattice gets updated, propagate an update to users of the value using its use-def chain to subscribed analyses. More...
 
void useDefSubscribe (DataFlowAnalysis *analysis)
 Subscribe an analysis to updates of the lattice. More...
 
- Public Member Functions inherited from mlir::AnalysisState
virtual ~AnalysisState ()
 
 AnalysisState (ProgramPoint point)
 Create the analysis state at the given program point. More...
 
ProgramPoint getPoint () const
 Returns the program point this state is located at. More...
 
LLVM_DUMP_METHOD void dump () const
 
void addDependency (ProgramPoint dependent, DataFlowAnalysis *analysis)
 Add a dependency to this analysis state on a program point and an analysis. More...
 

Additional Inherited Members

- Protected Attributes inherited from mlir::AnalysisState
ProgramPoint point
 The program point to which the state belongs. More...
 

Detailed Description

template<typename ValueT>
class mlir::dataflow::Lattice< ValueT >

This class represents a lattice holding a specific value of type ValueT.

Lattice values (ValueT) are required to adhere to the following:

Definition at line 85 of file SparseAnalysis.h.

Member Typedef Documentation

◆ has_meet

template<typename ValueT >
template<typename T , typename... Args>
using mlir::dataflow::Lattice< ValueT >::has_meet = decltype(std::declval<T>().meet())

Trait to check if T provides a meet method.

Needed since for forward analysis, lattices will only have a join, no meet, but we want to use the same Lattice class for both directions.

Definition at line 135 of file SparseAnalysis.h.

◆ lattice_has_meet

template<typename ValueT >
template<typename T >
using mlir::dataflow::Lattice< ValueT >::lattice_has_meet = llvm::is_detected<has_meet, T>

Definition at line 137 of file SparseAnalysis.h.

◆ LatticeT

template<typename ValueT >
using mlir::dataflow::Lattice< ValueT >::LatticeT = Lattice<ValueT>

Definition at line 99 of file SparseAnalysis.h.

Member Function Documentation

◆ AbstractSparseLattice()

template<typename ValueT >
mlir::dataflow::AbstractSparseLattice::AbstractSparseLattice
inline

Lattices can only be created for values.

Definition at line 37 of file SparseAnalysis.h.

◆ getPoint()

template<typename ValueT >
Value mlir::dataflow::Lattice< ValueT >::getPoint ( ) const
inline

Return the program point this lattice is located at.

Definition at line 90 of file SparseAnalysis.h.

References mlir::AnalysisState::point.

Referenced by mlir::dataflow::IntegerRangeAnalysis::setToEntryState().

◆ getValue() [1/2]

template<typename ValueT >
ValueT& mlir::dataflow::Lattice< ValueT >::getValue ( )
inline

Return the value held by this lattice.

This requires that the value is initialized.

Definition at line 94 of file SparseAnalysis.h.

Referenced by mlir::dataflow::Lattice< ValueT >::getValue(), mlir::dataflow::Lattice< ValueT >::join(), and mlir::dataflow::Lattice< ValueT >::meet().

◆ getValue() [2/2]

template<typename ValueT >
const ValueT& mlir::dataflow::Lattice< ValueT >::getValue ( ) const
inline

Definition at line 95 of file SparseAnalysis.h.

References mlir::dataflow::Lattice< ValueT >::getValue().

◆ join() [1/2]

template<typename ValueT >
ChangeResult mlir::dataflow::Lattice< ValueT >::join ( const AbstractSparseLattice< ValueT > &  rhs)
inlineoverridevirtual

Join the information contained in the 'rhs' lattice into this lattice.

Returns if the state of the current lattice changed.

Reimplemented from mlir::dataflow::AbstractSparseLattice.

Definition at line 103 of file SparseAnalysis.h.

References mlir::dataflow::Lattice< ValueT >::getValue().

Referenced by mlir::dataflow::IntegerRangeAnalysis::setToEntryState(), and mlir::dataflow::SparseConstantPropagation::setToEntryState().

◆ join() [2/2]

template<typename ValueT >
ChangeResult mlir::dataflow::Lattice< ValueT >::join ( const ValueT &  rhs)
inline

Join the information contained in the 'rhs' value into this lattice.

Returns if the state of the current lattice changed.

Definition at line 115 of file SparseAnalysis.h.

References mlir::Change, and mlir::NoChange.

◆ meet() [1/3]

template<typename ValueT >
ChangeResult mlir::dataflow::Lattice< ValueT >::meet ( const AbstractSparseLattice< ValueT > &  rhs)
inlineoverridevirtual

Meet (intersect) the information contained in the 'rhs' lattice with this lattice.

Returns if the state of the current lattice changed.

Reimplemented from mlir::dataflow::AbstractSparseLattice.

Definition at line 109 of file SparseAnalysis.h.

References mlir::dataflow::Lattice< ValueT >::getValue().

◆ meet() [2/3]

template<typename ValueT >
template<typename VT , std::enable_if_t< lattice_has_meet< VT >::value > >
ChangeResult mlir::dataflow::Lattice< ValueT >::meet ( const VT &  rhs)
inline

Meet (intersect) the information contained in the 'rhs' value with this lattice.

Returns if the state of the current lattice changed. If the lattice elements don't have a meet method, this is a no-op (see below.)

Definition at line 143 of file SparseAnalysis.h.

References mlir::Change, and mlir::NoChange.

◆ meet() [3/3]

template<typename ValueT >
template<typename VT >
ChangeResult mlir::dataflow::Lattice< ValueT >::meet ( const VT &  rhs)
inline

Definition at line 159 of file SparseAnalysis.h.

References mlir::NoChange.

◆ print()

template<typename ValueT >
void mlir::dataflow::Lattice< ValueT >::print ( raw_ostream &  os) const
inlineoverridevirtual

Print the lattice element.

Implements mlir::AnalysisState.

Definition at line 164 of file SparseAnalysis.h.


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