MLIR  20.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:

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 lattice anchor on this analysis. More...
 
void propagateIfChanged (AnalysisState *state, ChangeResult changed)
 Propagate an update to a state if it changed. More...
 
template<typename AnchorT >
void registerAnchorKind ()
 Register a custom lattice anchor class. More...
 
template<typename AnchorT , typename... Args>
AnchorT * getLatticeAnchor (Args &&...args)
 Get or create a custom lattice anchor. More...
 
template<typename StateT , typename AnchorT >
StateT * getOrCreate (AnchorT anchor)
 Get the analysis state associated with the lattice anchor. More...
 
template<typename StateT , typename AnchorT >
const StateT * getOrCreateFor (ProgramPoint *dependent, AnchorT anchor)
 Get a read-only analysis state for the given point and create a dependency on dependent. More...
 
ProgramPointgetProgramPointBefore (Operation *op)
 Get a uniqued program point instance. More...
 
ProgramPointgetProgramPointBefore (Block *block)
 
ProgramPointgetProgramPointAfter (Operation *op)
 
ProgramPointgetProgramPointAfter (Block *block)
 
const DataFlowConfiggetSolverConfig () const
 Return the configuration of the solver used for this analysis. 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 175 of file DeadCodeAnalysis.h.

Constructor & Destructor Documentation

◆ DeadCodeAnalysis()

DeadCodeAnalysis::DeadCodeAnalysis ( DataFlowSolver solver)
explicit

Definition at line 119 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 124 of file DeadCodeAnalysis.cpp.

References mlir::Operation::getRegions().

◆ visit()

LogicalResult DeadCodeAnalysis::visit ( ProgramPoint point)
overridevirtual

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