MLIR  17.0.0git
mlir::presburger::PWMAFunction Class Reference

This class represents a piece-wise MultiAffineFunction. More...

#include "mlir/Analysis/Presburger/PWMAFunction.h"

struct  Piece

## Public Member Functions

PWMAFunction (const PresburgerSpace &space)

const PresburgerSpacegetSpace () const

void addPiece (const Piece &piece)

unsigned getNumPieces () const

unsigned getNumVarKind (VarKind kind) const

unsigned getNumDomainVars () const

unsigned getNumOutputs () const

unsigned getNumSymbolVars () const

void removeOutputs (unsigned start, unsigned end)
Remove the specified range of outputs. More...

PresburgerSpace getDomainSpace () const
Get the domain/output space of the function. More...

PresburgerSpace getOutputSpace () const

PresburgerSet getDomain () const
Return the domain of this piece-wise MultiAffineFunction. More...

std::optional< SmallVector< MPInt, 8 > > valueAt (ArrayRef< MPInt > point) const
Return the output of the function at the given point. More...

std::optional< SmallVector< MPInt, 8 > > valueAt (ArrayRef< int64_t > point) const

ArrayRef< PiecegetAllPieces () const
Return all the pieces of this piece-wise function. More...

bool isEqual (const PWMAFunction &other) const
Return whether this and other are equal as PWMAFunctions, i.e. More...

PWMAFunction unionLexMin (const PWMAFunction &func)
Return a function defined on the union of the domains of this and func, such that when only one of the functions is defined, it outputs the same as that function, and if both are defined, it outputs the lexmax/lexmin of the two outputs. More...

PWMAFunction unionLexMax (const PWMAFunction &func)

void print (raw_ostream &os) const

void dump () const

## Detailed Description

This class represents a piece-wise MultiAffineFunction.

This can be thought of as a list of MultiAffineFunction with disjoint domains, with each having their own affine expressions for their output tuples. For example, we could have a function with two input variables (x, y), defined as

f(x, y) = (2*x + y, y - 4) if x >= 0, y >= 0 = (-2*x + y, y + 4) if x < 0, y < 0 = (4, 1) if x < 0, y >= 0

Note that the domains all have to be disjoint. Otherwise, the behaviour of this class is undefined. The domains need not cover all possible points; this represents a partial function and so could be undefined at some points.

As in PresburgerSets, the input vars are partitioned into dimension vars and symbolic vars.

Support is provided to compare equality of two such functions as well as finding the value of the function at a point.

Definition at line 151 of file PWMAFunction.h.

## ◆ PWMAFunction()

 mlir::presburger::PWMAFunction::PWMAFunction ( const PresburgerSpace & space )
inline

Definition at line 162 of file PWMAFunction.h.

## ◆ addPiece()

 void PWMAFunction::addPiece ( const Piece & piece )

Definition at line 283 of file PWMAFunction.cpp.

## ◆ dump()

 void PWMAFunction::dump ( ) const

Definition at line 301 of file PWMAFunction.cpp.

References print().

## ◆ getAllPieces()

 ArrayRef mlir::presburger::PWMAFunction::getAllPieces ( ) const
inline

Return all the pieces of this piece-wise function.

Definition at line 200 of file PWMAFunction.h.

## ◆ getDomain()

 PresburgerSet PWMAFunction::getDomain ( ) const

Return the domain of this piece-wise MultiAffineFunction.

This is the union of the domains of all the pieces.

Definition at line 44 of file PWMAFunction.cpp.

## ◆ getDomainSpace()

 PresburgerSpace mlir::presburger::PWMAFunction::getDomainSpace ( ) const
inline

Get the domain/output space of the function.

The returned space is a set space.

Definition at line 186 of file PWMAFunction.h.

Referenced by getDomain().

## ◆ getNumDomainVars()

 unsigned mlir::presburger::PWMAFunction::getNumDomainVars ( ) const
inline

Definition at line 177 of file PWMAFunction.h.

Referenced by valueAt().

## ◆ getNumOutputs()

 unsigned mlir::presburger::PWMAFunction::getNumOutputs ( ) const
inline

Definition at line 178 of file PWMAFunction.h.

## ◆ getNumPieces()

 unsigned mlir::presburger::PWMAFunction::getNumPieces ( ) const
inline

Definition at line 173 of file PWMAFunction.h.

Referenced by print().

## ◆ getNumSymbolVars()

 unsigned mlir::presburger::PWMAFunction::getNumSymbolVars ( ) const
inline

Definition at line 179 of file PWMAFunction.h.

Referenced by valueAt().

## ◆ getNumVarKind()

 unsigned mlir::presburger::PWMAFunction::getNumVarKind ( VarKind kind ) const
inline

Definition at line 174 of file PWMAFunction.h.

## ◆ getOutputSpace()

 PresburgerSpace mlir::presburger::PWMAFunction::getOutputSpace ( ) const
inline

Definition at line 187 of file PWMAFunction.h.

## ◆ getSpace()

 const PresburgerSpace& mlir::presburger::PWMAFunction::getSpace ( ) const
inline

Definition at line 168 of file PWMAFunction.h.

## ◆ isEqual()

 bool PWMAFunction::isEqual ( const PWMAFunction & other ) const

Return whether this and other are equal as PWMAFunctions, i.e.

Two PWMAFunctions are equal if they have the same dimensionalities, the same domain, and take the same value at every point in the domain.

whether they have the same dimensions, the same domain and they take the same value at every point in the domain.

Definition at line 264 of file PWMAFunction.cpp.

References getDomain(), and mlir::presburger::PresburgerSpace::isCompatible().

## ◆ print()

 void PWMAFunction::print ( raw_ostream & os ) const

Definition at line 290 of file PWMAFunction.cpp.

References getNumPieces(), and mlir::presburger::PresburgerSpace::print().

Referenced by dump().

## ◆ removeOutputs()

 void PWMAFunction::removeOutputs ( unsigned start, unsigned end )

Remove the specified range of outputs.

Definition at line 448 of file PWMAFunction.cpp.

## ◆ unionLexMax()

 PWMAFunction PWMAFunction::unionLexMax ( const PWMAFunction & func )

Definition at line 370 of file PWMAFunction.cpp.

## ◆ unionLexMin()

 PWMAFunction PWMAFunction::unionLexMin ( const PWMAFunction & func )

Return a function defined on the union of the domains of this and func, such that when only one of the functions is defined, it outputs the same as that function, and if both are defined, it outputs the lexmax/lexmin of the two outputs.

On points where neither function is defined, the returned function is not defined either.

Currently this does not support PWMAFunctions which have pieces containing divisions. TODO: Support division in pieces.

Definition at line 366 of file PWMAFunction.cpp.

## ◆ valueAt() [1/2]

 std::optional > mlir::presburger::PWMAFunction::valueAt ( ArrayRef< int64_t > point ) const
inline

Definition at line 195 of file PWMAFunction.h.

References mlir::presburger::getMPIntVec(), and valueAt().

## ◆ valueAt() [2/2]

 std::optional< SmallVector< MPInt, 8 > > PWMAFunction::valueAt ( ArrayRef< MPInt > point ) const

Return the output of the function at the given point.

Definition at line 455 of file PWMAFunction.cpp.

References getNumDomainVars(), and getNumSymbolVars().

Referenced by valueAt().

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