MLIR  16.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:
+ Collaboration diagram for mlir::AnalysisState:

Public Member Functions

virtual ~AnalysisState ()
 
 AnalysisState (ProgramPoint point)
 Create the analysis state at the given program point. More...
 
virtual bool isUninitialized () const =0
 Returns true if the analysis state is uninitialized. More...
 
virtual ChangeResult defaultInitialize ()=0
 Force an uninitialized analysis state to initialize itself with a default value. More...
 
virtual void print (raw_ostream &os) const =0
 Print the contents of the analysis state. More...
 

Protected Member Functions

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

Protected Attributes

SetVector< DataFlowSolver::WorkItemdependents
 The dependency relations originating from this analysis state. More...
 
ProgramPoint point
 The program point 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 program points 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 program point prior to visiting that point 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 284 of file DataFlowFramework.h.

Constructor & Destructor Documentation

◆ ~AnalysisState()

AnalysisState::~AnalysisState ( )
virtualdefault

◆ AnalysisState()

mlir::AnalysisState::AnalysisState ( ProgramPoint  point)
inline

Create the analysis state at the given program point.

Definition at line 289 of file DataFlowFramework.h.

References print().

Member Function Documentation

◆ defaultInitialize()

virtual ChangeResult mlir::AnalysisState::defaultInitialize ( )
pure virtual

Force an uninitialized analysis state to initialize itself with a default value.

Implemented in mlir::dataflow::PredecessorState, mlir::dataflow::Lattice< ValueT >, mlir::dataflow::Lattice< IntegerValueRange >, and mlir::dataflow::Executable.

◆ isUninitialized()

virtual bool mlir::AnalysisState::isUninitialized ( ) const
pure virtual

◆ onUpdate()

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

This function is called by the solver when the analysis state is updated to optionally 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::IntegerValueRangeLattice, mlir::dataflow::Executable, and mlir::dataflow::AbstractSparseLattice.

Definition at line 306 of file DataFlowFramework.h.

Referenced by mlir::DataFlowSolver::propagateIfChanged().

◆ 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 328 of file DataFlowFramework.h.

Member Data Documentation

◆ dependents

SetVector<DataFlowSolver::WorkItem> mlir::AnalysisState::dependents
protected

The dependency relations originating from this analysis state.

An entry state -> (analysis, point) is created when analysis queries state when updating point.

When this state is updated, all dependent child analysis invocations are pushed to the back of the queue. Use a SetVector to keep the analysis deterministic.

Store the dependents on the analysis state for efficiency.

Definition at line 317 of file DataFlowFramework.h.

Referenced by mlir::DataFlowSolver::addDependency(), and mlir::DataFlowSolver::propagateIfChanged().

◆ point

ProgramPoint mlir::AnalysisState::point
protected

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