My Project
Public Types | Public Member Functions | List of all members
mlir::Liveness Class Reference

#include <Liveness.h>

Public Types

using OperationListT = std::vector< Operation * >
 
using BlockMapT = DenseMap< Block *, LivenessBlockInfo >
 
using ValueSetT = SmallPtrSet< Value, 16 >
 

Public Member Functions

 Liveness (Operation *op)
 
OperationgetOperation () const
 Returns the operation this analysis was constructed from. More...
 
OperationListT resolveLiveness (Value value) const
 Gets liveness info (if any) for the given value. More...
 
const LivenessBlockInfogetLiveness (Block *block) const
 Gets liveness info (if any) for the block. More...
 
const ValueSetTgetLiveIn (Block *block) const
 Returns a reference to a set containing live-in values (unordered). More...
 
const ValueSetTgetLiveOut (Block *block) const
 Returns a reference to a set containing live-out values (unordered). More...
 
bool isLastUse (Value value, Operation *operation) const
 
void dump () const
 Dumps the liveness information in a human readable format. More...
 
void print (raw_ostream &os) const
 Dumps the liveness information to the given stream. More...
 

Detailed Description

Represents an analysis for computing liveness information from a given top-level operation. The analysis iterates over all associated regions that are attached to the given top-level operation. It computes liveness information for every value and block that are included in the mentioned regions. It relies on a fixpoint iteration to compute all live-in and live-out values of all included blocks. Sample usage: Liveness liveness(topLevelOp); auto &allInValues = liveness.getLiveIn(block); auto &allOutValues = liveness.getLiveOut(block); auto allOperationsInWhichValueIsLive = liveness.resolveLiveness(value); bool lastUse = liveness.isLastUse(value, operation);

Member Typedef Documentation

◆ BlockMapT

◆ OperationListT

using mlir::Liveness::OperationListT = std::vector<Operation *>

◆ ValueSetT

Constructor & Destructor Documentation

◆ Liveness()

Liveness::Liveness ( Operation op)

Creates a new Liveness analysis that computes liveness information for all associated regions.

Member Function Documentation

◆ dump()

void Liveness::dump ( ) const

Dumps the liveness information in a human readable format.

◆ getLiveIn()

const Liveness::ValueSetT & Liveness::getLiveIn ( Block block) const

Returns a reference to a set containing live-in values (unordered).

Returns a reference to a set containing live-in values.

◆ getLiveness()

const LivenessBlockInfo * Liveness::getLiveness ( Block block) const

Gets liveness info (if any) for the block.

◆ getLiveOut()

const Liveness::ValueSetT & Liveness::getLiveOut ( Block block) const

Returns a reference to a set containing live-out values (unordered).

Returns a reference to a set containing live-out values.

◆ getOperation()

Operation* mlir::Liveness::getOperation ( ) const
inline

Returns the operation this analysis was constructed from.

◆ isLastUse()

bool Liveness::isLastUse ( Value  value,
Operation operation 
) const

Returns true if the given operation represent the last use of the given value.

◆ print()

void Liveness::print ( raw_ostream &  os) const

Dumps the liveness information to the given stream.

◆ resolveLiveness()

Liveness::OperationListT Liveness::resolveLiveness ( Value  value) const

Gets liveness info (if any) for the given value.

Gets liveness info (if any) for the given value. This includes all operations in which the given value is live. Note that the operations in this list are not ordered and the current implementation is computationally expensive (as it iterates over all blocks in which the given value is live).


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