MLIR  20.0.0git
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
mlir::AnalysisState Class Referenceabstract

Base class for generic analysis states. More...

#include "mlir/Analysis/DataFlowFramework.h"

+ Inheritance diagram for mlir::AnalysisState:

Public Member Functions

virtual ~AnalysisState ()
 
 AnalysisState (LatticeAnchor anchor)
 Create the analysis state on the given lattice anchor. More...
 
LatticeAnchor getAnchor () const
 Returns the lattice anchor this state is located at. More...
 
virtual void print (raw_ostream &os) const =0
 Print the contents of the analysis state. More...
 
LLVM_DUMP_METHOD void dump () const
 
void addDependency (ProgramPoint *point, DataFlowAnalysis *analysis)
 Add a dependency to this analysis state on a lattice anchor and an analysis. More...
 

Protected Member Functions

virtual void onUpdate (DataFlowSolver *solver) const
 This function is called by the solver when the analysis state is updated to enqueue more work items. More...
 

Protected Attributes

LatticeAnchor anchor
 The lattice anchor to which the state belongs. More...
 

Friends

class DataFlowSolver
 Allow the framework to access the dependents. More...
 

Detailed Description

Base class for generic analysis states.

Analysis states contain data-flow information that are attached to lattice anchors and which evolve as the analysis iterates.

This class places no restrictions on the semantics of analysis states beyond these requirements.

  1. Querying the state of a lattice anchor prior to visiting that anchor results in uninitialized state. Analyses must be aware of unintialized states.
  2. Analysis states can reach fixpoints, where subsequent updates will never trigger a change in the state.
  3. Analysis states that are uninitialized can be forcefully initialized to a default value.

Definition at line 447 of file DataFlowFramework.h.

Constructor & Destructor Documentation

◆ ~AnalysisState()

AnalysisState::~AnalysisState ( )
virtualdefault

◆ AnalysisState()

mlir::AnalysisState::AnalysisState ( LatticeAnchor  anchor)
inline

Create the analysis state on the given lattice anchor.

Definition at line 452 of file DataFlowFramework.h.

Member Function Documentation

◆ addDependency()

void AnalysisState::addDependency ( ProgramPoint point,
DataFlowAnalysis analysis 
)

Add a dependency to this analysis state on a lattice anchor and an analysis.

If this state is updated, the analysis will be invoked on the given lattice anchor again (in onUpdate()).

Definition at line 40 of file DataFlowFramework.cpp.

References anchor, and DATAFLOW_DEBUG.

◆ dump()

void AnalysisState::dump ( ) const

Definition at line 53 of file DataFlowFramework.cpp.

References print().

◆ getAnchor()

LatticeAnchor mlir::AnalysisState::getAnchor ( ) const
inline

Returns the lattice anchor this state is located at.

Definition at line 455 of file DataFlowFramework.h.

References anchor.

Referenced by mlir::dataflow::AbstractSparseLattice::getAnchor().

◆ onUpdate()

virtual void mlir::AnalysisState::onUpdate ( DataFlowSolver solver) const
inlineprotectedvirtual

This function is called by the solver when the analysis state is updated to enqueue more work items.

For example, if a state tracks dependents through the IR (e.g. use-def chains), this function can be implemented to push those dependents on the worklist.

Reimplemented in mlir::dataflow::AbstractSparseLattice, mlir::dataflow::IntegerValueRangeLattice, and mlir::dataflow::Executable.

Definition at line 471 of file DataFlowFramework.h.

References mlir::DataFlowSolver::enqueue().

Referenced by mlir::dataflow::Executable::onUpdate(), and mlir::dataflow::AbstractSparseLattice::onUpdate().

◆ print()

virtual void mlir::AnalysisState::print ( raw_ostream &  os) const
pure virtual

Friends And Related Function Documentation

◆ DataFlowSolver

friend class DataFlowSolver
friend

Allow the framework to access the dependents.

Definition at line 497 of file DataFlowFramework.h.

Member Data Documentation

◆ anchor

LatticeAnchor mlir::AnalysisState::anchor
protected

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