MLIR  17.0.0git
Public Member Functions | List of all members
mlir::dataflow::DeadCodeAnalysis Class Reference

Dead code analysis analyzes control-flow, as understood by RegionBranchOpInterface and BranchOpInterface, and the callgraph, as understood by CallableOpInterface and CallOpInterface. More...

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

+ Inheritance diagram for mlir::dataflow::DeadCodeAnalysis:
+ Collaboration diagram for mlir::dataflow::DeadCodeAnalysis:

Public Member Functions

 DeadCodeAnalysis (DataFlowSolver &solver)
 
LogicalResult initialize (Operation *top) override
 Initialize the analysis by visiting every operation with potential control-flow semantics. More...
 
LogicalResult visit (ProgramPoint point) override
 Visit an operation with control-flow semantics and deduce which of its successors are live. 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::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 assiocated 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...
 

Detailed Description

Dead code analysis analyzes control-flow, as understood by RegionBranchOpInterface and BranchOpInterface, and the callgraph, as understood by CallableOpInterface and CallOpInterface.

This analysis uses known constant values of operands to determine the liveness of each block and each edge between a block and its predecessors. For region control-flow, this analysis determines the predecessor operations for region entry blocks and region control-flow operations. For the callgraph, this analysis determines the callsites and live returns of every function.

Definition at line 174 of file DeadCodeAnalysis.h.

Constructor & Destructor Documentation

◆ DeadCodeAnalysis()

DeadCodeAnalysis::DeadCodeAnalysis ( DataFlowSolver solver)
explicit

Definition at line 100 of file DeadCodeAnalysis.cpp.

Member Function Documentation

◆ initialize()

LogicalResult DeadCodeAnalysis::initialize ( Operation top)
overridevirtual

Initialize the analysis by visiting every operation with potential control-flow semantics.

Implements mlir::DataFlowAnalysis.

Definition at line 105 of file DeadCodeAnalysis.cpp.

References mlir::Operation::getRegions(), and mlir::DataFlowAnalysis::propagateIfChanged().

◆ visit()

LogicalResult DeadCodeAnalysis::visit ( ProgramPoint  point)
overridevirtual

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