MLIR 22.0.0git
mlir::affine::AffineValueMap Class Reference

An AffineValueMap is an affine map plus its ML value operands and results for analysis purposes. More...

#include "mlir/Dialect/Affine/IR/AffineValueMap.h"

Public Member Functions

 AffineValueMap ()=default
 AffineValueMap (AffineMap map, ValueRange operands, ValueRange results={})
 ~AffineValueMap ()
void reset (AffineMap map, ValueRange operands, ValueRange results={})
void composeSimplifyAndCanonicalize ()
 Composes all incoming affine.apply ops and then simplifies and canonicalizes the map and operands.
bool isMultipleOf (unsigned idx, int64_t factor) const
 Return true if the idx^th result can be proved to be a multiple of 'factor', false otherwise.
bool isFunctionOf (unsigned idx, Value value) const
 Return true if the idx^th result depends on 'value', false otherwise.
bool isConstant (unsigned idx) const
 Return true if the result at 'idx' is a constant, false otherwise.
bool isIdentity () const
 Return true if this is an identity map.
void setResult (unsigned i, AffineExpr e)
AffineExpr getResult (unsigned i)
unsigned getNumOperands () const
unsigned getNumDims () const
unsigned getNumSymbols () const
unsigned getNumResults () const
Value getOperand (unsigned i) const
ArrayRef< ValuegetOperands () const
AffineMap getAffineMap () const
LogicalResult canonicalize ()
 Attempts to canonicalize the map and operands.
bool operator== (const AffineValueMap &other) const
 Checks if the application of this map to its operands is semantically equal to other's.
bool operator!= (const AffineValueMap &other) const

Static Public Member Functions

static void difference (const AffineValueMap &a, const AffineValueMap &b, AffineValueMap *res)
 Return the value map that is the difference of value maps 'a' and 'b', represented as an affine map and its operands.

Detailed Description

An AffineValueMap is an affine map plus its ML value operands and results for analysis purposes.

The structure is still a tree form that is same as that of an affine map or an AffineApplyOp. However, its operands, results, and its map can themselves change as a result of substitutions, simplifications, and other analysis.

Definition at line 35 of file AffineValueMap.h.

Constructor & Destructor Documentation

◆ AffineValueMap() [1/2]

mlir::affine::AffineValueMap::AffineValueMap ( )
default

◆ AffineValueMap() [2/2]

AffineValueMap::AffineValueMap ( AffineMap map,
ValueRange operands,
ValueRange results = {} )

Definition at line 15 of file AffineValueMap.cpp.

◆ ~AffineValueMap()

AffineValueMap::~AffineValueMap ( )
default

Member Function Documentation

◆ canonicalize()

LogicalResult AffineValueMap::canonicalize ( )

Attempts to canonicalize the map and operands.

Return success if the map and/or operands have been modified.

Definition at line 4337 of file AffineOps.cpp.

References composeAffineMapAndOperands(), getAffineMap(), reset(), and success().

Referenced by canonicalizeLoopBounds().

◆ composeSimplifyAndCanonicalize()

void AffineValueMap::composeSimplifyAndCanonicalize ( )

Composes all incoming affine.apply ops and then simplifies and canonicalizes the map and operands.

This can change the number of operands, but the result count remains the same.

Definition at line 27 of file AffineValueMap.cpp.

References mlir::affine::canonicalizeMapAndOperands(), mlir::affine::fullyComposeAffineMapAndOperands(), and getAffineMap().

Referenced by isAccessIndexInvariant(), and mlir::affine::isInvariantAccess().

◆ difference()

void AffineValueMap::difference ( const AffineValueMap & a,
const AffineValueMap & b,
AffineValueMap * res )
static

Return the value map that is the difference of value maps 'a' and 'b', represented as an affine map and its operands.

The output map + operands are canonicalized and simplified.

Definition at line 36 of file AffineValueMap.cpp.

References AffineValueMap(), b, mlir::affine::canonicalizeMapAndOperands(), mlir::affine::fullyComposeAffineMapAndOperands(), mlir::AffineMap::get(), getAffineMap(), getNumDims(), getNumOperands(), getNumResults(), getNumSymbols(), getOperands(), reset(), and mlir::simplifyAffineMap().

Referenced by mlir::affine::getTripCountMapAndOperands(), and operator==().

◆ getAffineMap()

◆ getNumDims()

unsigned mlir::affine::AffineValueMap::getNumDims ( ) const
inline

Definition at line 75 of file AffineValueMap.h.

Referenced by difference(), and mlir::affine::MemRefAccess::getAccessRelation().

◆ getNumOperands()

unsigned mlir::affine::AffineValueMap::getNumOperands ( ) const
inline

Definition at line 74 of file AffineValueMap.h.

Referenced by mlir::affine::MemRefRegion::compute(), and difference().

◆ getNumResults()

unsigned mlir::affine::AffineValueMap::getNumResults ( ) const
inline

◆ getNumSymbols()

unsigned mlir::affine::AffineValueMap::getNumSymbols ( ) const
inline

Definition at line 76 of file AffineValueMap.h.

Referenced by difference().

◆ getOperand()

Value AffineValueMap::getOperand ( unsigned i) const

◆ getOperands()

◆ getResult()

AffineExpr mlir::affine::AffineValueMap::getResult ( unsigned i)
inline

Definition at line 73 of file AffineValueMap.h.

Referenced by mlir::affine::getTripCountMapAndOperands().

◆ isConstant()

bool mlir::affine::AffineValueMap::isConstant ( unsigned idx) const

Return true if the result at 'idx' is a constant, false otherwise.

◆ isFunctionOf()

bool AffineValueMap::isFunctionOf ( unsigned idx,
Value value ) const

Return true if the idx^th result depends on 'value', false otherwise.

This method uses the invariant that operands are always positionally aligned with the AffineDimExpr in the underlying AffineMap.

Definition at line 91 of file AffineValueMap.cpp.

References AffineValueMap(), findIndex(), getAffineMap(), mlir::AffineMap::getResult(), and mlir::AffineExpr::isFunctionOfDim().

Referenced by isAccessIndexInvariant().

◆ isIdentity()

bool mlir::affine::AffineValueMap::isIdentity ( ) const

Return true if this is an identity map.

◆ isMultipleOf()

bool AffineValueMap::isMultipleOf ( unsigned idx,
int64_t factor ) const
inline

Return true if the idx^th result can be proved to be a multiple of 'factor', false otherwise.

Definition at line 85 of file AffineValueMap.cpp.

◆ operator!=()

bool mlir::affine::AffineValueMap::operator!= ( const AffineValueMap & other) const
inline

Definition at line 90 of file AffineValueMap.h.

References AffineValueMap().

◆ operator==()

bool AffineValueMap::operator== ( const AffineValueMap & other) const

Checks if the application of this map to its operands is semantically equal to other's.

Definition at line 112 of file AffineValueMap.cpp.

References AffineValueMap(), difference(), getAffineMap(), and mlir::AffineMap::getResults().

◆ reset()

◆ setResult()

void mlir::affine::AffineValueMap::setResult ( unsigned i,
AffineExpr e )
inline

Definition at line 72 of file AffineValueMap.h.

Referenced by mlir::affine::getTripCountMapAndOperands().


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