MLIR
20.0.0git
|
This class represents a multi-affine function with the domain as Z^d, where d
is the number of domain variables of the function.
More...
#include "mlir/Analysis/Presburger/PWMAFunction.h"
Public Member Functions | |
MultiAffineFunction (const PresburgerSpace &space, const IntMatrix &output) | |
MultiAffineFunction (const PresburgerSpace &space, const IntMatrix &output, const DivisionRepr &divs) | |
unsigned | getNumDomainVars () const |
unsigned | getNumSymbolVars () const |
unsigned | getNumOutputs () const |
unsigned | getNumDivs () const |
const PresburgerSpace & | getSpace () const |
Get the space of this function. More... | |
PresburgerSpace | getDomainSpace () const |
Get the domain/output space of the function. More... | |
PresburgerSpace | getOutputSpace () const |
const IntMatrix & | getOutputMatrix () const |
Get a matrix with each row representing row^th output expression. More... | |
ArrayRef< DynamicAPInt > | getOutputExpr (unsigned i) const |
Get the i^th output expression. More... | |
const DivisionRepr & | getDivs () const |
Get the divisions used in this function. More... | |
void | removeOutputs (unsigned start, unsigned end) |
Remove the specified range of outputs. More... | |
void | mergeDivs (MultiAffineFunction &other) |
Given a MAF other , merges division variables such that both functions have the union of the division vars that exist in the functions. More... | |
SmallVector< DynamicAPInt, 8 > | valueAt (ArrayRef< DynamicAPInt > point) const |
SmallVector< DynamicAPInt, 8 > | valueAt (ArrayRef< int64_t > point) const |
bool | isEqual (const MultiAffineFunction &other) const |
Return whether the this and other are equal when the domain is restricted to domain . More... | |
bool | isEqual (const MultiAffineFunction &other, const IntegerPolyhedron &domain) const |
bool | isEqual (const MultiAffineFunction &other, const PresburgerSet &domain) const |
void | subtract (const MultiAffineFunction &other) |
PresburgerSet | getLexSet (OrderingKind comp, const MultiAffineFunction &other) const |
Return the set of domain points where the output of this and other are ordered lexicographically according to the given ordering. More... | |
IntegerRelation | getAsRelation () const |
Get this function as a relation. More... | |
void | print (raw_ostream &os) const |
void | dump () const |
This class represents a multi-affine function with the domain as Z^d, where d
is the number of domain variables of the function.
For example:
(x, y) -> (x + 2, 2*x - 3y + 5, 2*x + y).
The output expressions are represented as a matrix with one row for every output, one column for each var including division variables, and an extra column at the end for the constant term.
Checking equality of two such functions is supported, as well as finding the value of the function at a specified point.
Definition at line 41 of file PWMAFunction.h.
|
inline |
Definition at line 43 of file PWMAFunction.h.
|
inline |
Definition at line 49 of file PWMAFunction.h.
void MultiAffineFunction::dump | ( | ) | const |
Definition at line 68 of file PWMAFunction.cpp.
References print().
IntegerRelation MultiAffineFunction::getAsRelation | ( | ) | const |
Get this function as a relation.
Definition at line 420 of file PWMAFunction.cpp.
References addDivisionConstraints(), mlir::presburger::IntegerRelation::addEquality(), copy(), mlir::presburger::IntegerRelation::getNumCols(), mlir::presburger::PresburgerSpace::getNumDomainVars(), getNumDomainVars(), mlir::presburger::PresburgerSpace::getNumLocalVars(), getNumOutputs(), mlir::presburger::PresburgerSpace::getNumSymbolVars(), getOutputExpr(), mlir::presburger::PresburgerSpace::getRelationSpace(), mlir::presburger::IntegerRelation::getVarKindEnd(), mlir::presburger::IntegerRelation::getVarKindOffset(), mlir::presburger::IntegerRelation::insertVar(), and mlir::presburger::Range.
Referenced by isEqual().
|
inline |
Get the divisions used in this function.
Definition at line 75 of file PWMAFunction.h.
|
inline |
Get the domain/output space of the function.
The returned space is a set space.
Definition at line 64 of file PWMAFunction.h.
References mlir::presburger::PresburgerSpace::getDomainSpace().
Referenced by getLexSet(), and mlir::presburger::PWMAFunction::Piece::isConsistent().
PresburgerSet MultiAffineFunction::getLexSet | ( | OrderingKind | comp, |
const MultiAffineFunction & | other | ||
) | const |
Return the set of domain points where the output of this
and other
are ordered lexicographically according to the given ordering.
For example, if the given comparison is LT
, then the returned set contains all points where the first output of this
is lexicographically less than other
.
Definition at line 189 of file PWMAFunction.cpp.
References mlir::presburger::IntegerRelation::addBound(), mlir::presburger::IntegerRelation::addEquality(), mlir::presburger::IntegerRelation::addInequality(), mlir::presburger::EQ, mlir::presburger::GE, mlir::presburger::DivisionRepr::getDenom(), mlir::presburger::DivisionRepr::getDividend(), mlir::presburger::getDivLowerBound(), mlir::presburger::DivisionRepr::getDivOffset(), mlir::presburger::getDivUpperBound(), getDomainSpace(), mlir::presburger::PresburgerSet::getEmpty(), getNumDivs(), mlir::presburger::IntegerRelation::getNumInequalities(), mlir::presburger::PresburgerSpace::getNumLocalVars(), getNumOutputs(), mlir::presburger::PresburgerSpace::getNumVars(), getOutputExpr(), getSpace(), mlir::presburger::PresburgerSpace::getSpaceWithoutLocals(), mlir::presburger::GT, mlir::presburger::LB, mlir::presburger::LE, mlir::presburger::LT, mergeDivs(), mlir::presburger::NE, mlir::presburger::IntegerRelation::removeInequality(), subtractExprs(), mlir::presburger::UB, and mlir::presburger::PresburgerRelation::unionInPlace().
Referenced by tiebreakLex().
|
inline |
Definition at line 58 of file PWMAFunction.h.
References mlir::presburger::PresburgerSpace::getNumLocalVars().
Referenced by getLexSet(), and mergeDivs().
|
inline |
Definition at line 55 of file PWMAFunction.h.
References mlir::presburger::PresburgerSpace::getNumDomainVars().
Referenced by getAsRelation(), and valueAt().
|
inline |
Definition at line 57 of file PWMAFunction.h.
References mlir::presburger::PresburgerSpace::getNumRangeVars().
Referenced by getAsRelation(), getLexSet(), removeOutputs(), subtract(), and valueAt().
|
inline |
Definition at line 56 of file PWMAFunction.h.
References mlir::presburger::PresburgerSpace::getNumSymbolVars().
Referenced by valueAt().
|
inline |
Get the i^th
output expression.
Definition at line 70 of file PWMAFunction.h.
References mlir::presburger::Matrix< T >::getRow().
Referenced by getAsRelation(), getLexSet(), and subtract().
|
inline |
Get a matrix with each row representing row^th output expression.
Definition at line 68 of file PWMAFunction.h.
|
inline |
Definition at line 65 of file PWMAFunction.h.
References mlir::presburger::PresburgerSpace::getRangeSpace().
|
inline |
Get the space of this function.
Definition at line 61 of file PWMAFunction.h.
Referenced by getLexSet().
bool MultiAffineFunction::isEqual | ( | const MultiAffineFunction & | other | ) | const |
Return whether the this
and other
are equal when the domain is restricted to domain
.
This is the case if they lie in the same space, and their outputs are equal for every point in domain
.
Definition at line 96 of file PWMAFunction.cpp.
References getAsRelation(), mlir::presburger::PresburgerSpace::isCompatible(), and mlir::presburger::IntegerRelation::isEqual().
bool MultiAffineFunction::isEqual | ( | const MultiAffineFunction & | other, |
const IntegerPolyhedron & | domain | ||
) | const |
Definition at line 102 of file PWMAFunction.cpp.
References getAsRelation(), mlir::presburger::IntegerRelation::intersectDomain(), mlir::presburger::PresburgerSpace::isCompatible(), and mlir::presburger::IntegerRelation::isEqual().
bool MultiAffineFunction::isEqual | ( | const MultiAffineFunction & | other, |
const PresburgerSet & | domain | ||
) | const |
Definition at line 115 of file PWMAFunction.cpp.
References mlir::presburger::PresburgerRelation::getAllDisjuncts(), and mlir::presburger::PresburgerSpace::isCompatible().
void MultiAffineFunction::mergeDivs | ( | MultiAffineFunction & | other | ) |
Given a MAF other
, merges division variables such that both functions have the union of the division vars that exist in the functions.
Definition at line 135 of file PWMAFunction.cpp.
References mlir::presburger::Matrix< T >::addToColumn(), copy(), mlir::presburger::DivisionRepr::getDenom(), mlir::presburger::DivisionRepr::getDividend(), mlir::presburger::DivisionRepr::getDivOffset(), getNumDivs(), mlir::presburger::DivisionRepr::getNumDivs(), mlir::presburger::DivisionRepr::getNumVars(), mlir::presburger::Matrix< T >::insertColumns(), mlir::presburger::DivisionRepr::insertDiv(), mlir::presburger::PresburgerSpace::insertVar(), mlir::presburger::PresburgerSpace::isCompatible(), mlir::presburger::Local, mlir::presburger::Matrix< T >::removeColumn(), mlir::presburger::DivisionRepr::removeDuplicateDivs(), mlir::presburger::PresburgerSpace::removeVarRange(), and mlir::presburger::DivisionRepr::setDiv().
Referenced by getLexSet(), and subtract().
void MultiAffineFunction::print | ( | raw_ostream & | os | ) | const |
Definition at line 60 of file PWMAFunction.cpp.
References mlir::presburger::PresburgerSpace::print(), mlir::presburger::Matrix< T >::print(), and mlir::presburger::DivisionRepr::print().
Referenced by dump().
void MultiAffineFunction::removeOutputs | ( | unsigned | start, |
unsigned | end | ||
) |
Remove the specified range of outputs.
Definition at line 125 of file PWMAFunction.cpp.
References getNumOutputs(), mlir::presburger::Range, mlir::presburger::Matrix< T >::removeRows(), and mlir::presburger::PresburgerSpace::removeVarRange().
void MultiAffineFunction::subtract | ( | const MultiAffineFunction & | other | ) |
Definition at line 387 of file PWMAFunction.cpp.
References mlir::presburger::Matrix< T >::addToRow(), getNumOutputs(), getOutputExpr(), mlir::presburger::PresburgerSpace::isCompatible(), and mergeDivs().
SmallVector< DynamicAPInt, 8 > MultiAffineFunction::valueAt | ( | ArrayRef< DynamicAPInt > | point | ) | const |
Definition at line 71 of file PWMAFunction.cpp.
References mlir::presburger::DivisionRepr::divValuesAt(), getNumDomainVars(), getNumOutputs(), getNumSymbolVars(), and mlir::presburger::Matrix< T >::postMultiplyWithColumn().
Referenced by valueAt().
|
inline |
Definition at line 86 of file PWMAFunction.h.
References mlir::presburger::getDynamicAPIntVec(), and valueAt().