MLIR  20.0.0git
Public Types | Public Member Functions | Friends | List of all members
mlir::LivenessBlockInfo Class Reference

This class represents liveness information on block level. More...

#include "mlir/Analysis/Liveness.h"

Public Types

using ValueSetT = Liveness::ValueSetT
 A typedef declaration of a value set. More...
 

Public Member Functions

BlockgetBlock () const
 Returns the underlying block. More...
 
const ValueSetTin () const
 Returns all values that are live at the beginning of the block (unordered). More...
 
const ValueSetTout () const
 Returns all values that are live at the end of the block (unordered). More...
 
bool isLiveIn (Value value) const
 Returns true if the given value is in the live-in set. More...
 
bool isLiveOut (Value value) const
 Returns true if the given value is in the live-out set. More...
 
OperationgetStartOperation (Value value) const
 Gets the start operation for the given value. More...
 
OperationgetEndOperation (Value value, Operation *startOperation) const
 Gets the end operation for the given value using the start operation provided (must be referenced in this block). More...
 
ValueSetT currentlyLiveValues (Operation *op) const
 Get the set of values that are currently live (if any) for the current op. More...
 

Friends

class Liveness
 

Detailed Description

This class represents liveness information on block level.

Definition at line 99 of file Liveness.h.

Member Typedef Documentation

◆ ValueSetT

A typedef declaration of a value set.

Definition at line 102 of file Liveness.h.

Member Function Documentation

◆ currentlyLiveValues()

LivenessBlockInfo::ValueSetT LivenessBlockInfo::currentlyLiveValues ( Operation op) const

Get the set of values that are currently live (if any) for the current op.

Return the values that are currently live as of the given operation.

This analysis takes an expansive view of "live" in that if a value is defined by or within the operation or is fully consumed (as in last user) by or within the operation the value is considered "live". The values in the list are not ordered.

This check is quite expensive as it does not cache the results of the computation, so the currently live values have to be recomputed for each op.

Definition at line 400 of file Liveness.cpp.

References getEndOperation(), in(), mlir::Operation::isBeforeInBlock(), isLiveIn(), and isLiveOut().

◆ getBlock()

Block* mlir::LivenessBlockInfo::getBlock ( ) const
inline

Returns the underlying block.

Definition at line 106 of file Liveness.h.

◆ getEndOperation()

Operation * LivenessBlockInfo::getEndOperation ( Value  value,
Operation startOperation 
) const

Gets the end operation for the given value using the start operation provided (must be referenced in this block).

Definition at line 379 of file Liveness.cpp.

References mlir::Value::getUsers(), mlir::Operation::isBeforeInBlock(), and isLiveOut().

Referenced by currentlyLiveValues(), mlir::Liveness::isDeadAfter(), and mlir::Liveness::resolveLiveness().

◆ getStartOperation()

Operation * LivenessBlockInfo::getStartOperation ( Value  value) const

Gets the start operation for the given value.

Gets the start operation for the given value (must be referenced in this block).

This is the first operation the given value is considered to be live. This could either be the start operation of the current block (in case the value is live-in) or the operation that defines the given value (must be referenced in this block).

Definition at line 368 of file Liveness.cpp.

References mlir::Value::getDefiningOp(), and isLiveIn().

Referenced by mlir::bufferization::BufferPlacementAllocs::getStartOperation(), and mlir::Liveness::resolveLiveness().

◆ in()

const ValueSetT& mlir::LivenessBlockInfo::in ( ) const
inline

Returns all values that are live at the beginning of the block (unordered).

Definition at line 110 of file Liveness.h.

Referenced by currentlyLiveValues(), and mlir::Liveness::getLiveIn().

◆ isLiveIn()

bool LivenessBlockInfo::isLiveIn ( Value  value) const

Returns true if the given value is in the live-in set.

Definition at line 357 of file Liveness.cpp.

Referenced by currentlyLiveValues(), and getStartOperation().

◆ isLiveOut()

bool LivenessBlockInfo::isLiveOut ( Value  value) const

Returns true if the given value is in the live-out set.

Definition at line 362 of file Liveness.cpp.

Referenced by currentlyLiveValues(), getEndOperation(), and mlir::Liveness::isDeadAfter().

◆ out()

const ValueSetT& mlir::LivenessBlockInfo::out ( ) const
inline

Returns all values that are live at the end of the block (unordered).

Definition at line 114 of file Liveness.h.

Referenced by mlir::Liveness::getLiveOut().

Friends And Related Function Documentation

◆ Liveness

friend class Liveness
friend

Definition at line 153 of file Liveness.h.


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