MLIR
20.0.0git
|
Class storing division representation of local variables of a constraint system. More...
#include "mlir/Analysis/Presburger/Utils.h"
Public Member Functions | |
DivisionRepr (unsigned numVars, unsigned numDivs) | |
DivisionRepr (unsigned numVars) | |
unsigned | getNumVars () const |
unsigned | getNumDivs () const |
unsigned | getNumNonDivs () const |
unsigned | getDivOffset () const |
bool | hasRepr (unsigned i) const |
bool | hasAllReprs () const |
void | clearRepr (unsigned i) |
MutableArrayRef< DynamicAPInt > | getDividend (unsigned i) |
ArrayRef< DynamicAPInt > | getDividend (unsigned i) const |
SmallVector< std::optional< DynamicAPInt >, 4 > | divValuesAt (ArrayRef< DynamicAPInt > point) const |
DynamicAPInt & | getDenom (unsigned i) |
DynamicAPInt | getDenom (unsigned i) const |
ArrayRef< DynamicAPInt > | getDenoms () const |
void | setDiv (unsigned i, ArrayRef< DynamicAPInt > dividend, const DynamicAPInt &divisor) |
void | normalizeDivs () |
void | insertDiv (unsigned pos, ArrayRef< DynamicAPInt > dividend, const DynamicAPInt &divisor) |
void | insertDiv (unsigned pos, unsigned num=1) |
void | removeDuplicateDivs (llvm::function_ref< bool(unsigned i, unsigned j)> merge) |
Removes duplicate divisions. More... | |
void | print (raw_ostream &os) const |
void | dump () const |
Class storing division representation of local variables of a constraint system.
The coefficients of the dividends are stored in order: [nonLocalVars, localVars, constant]. Each local variable may or may not have a representation. If the local does not have a representation, the dividend of the division has no meaning and the denominator is zero. If it has a representation, the denominator will be positive.
The i^th division here, represents the division representation of the variable at position divOffset + i
in the constraint system.
|
inline |
|
inline |
|
inline |
Definition at line 136 of file Utils.h.
Referenced by mlir::presburger::IntegerRelation::getLocalReprs().
SmallVector< std::optional< DynamicAPInt >, 4 > DivisionRepr::divValuesAt | ( | ArrayRef< DynamicAPInt > | point | ) | const |
Definition at line 392 of file Utils.cpp.
References mlir::changed, getDividend(), getDivOffset(), getNumDivs(), and getNumNonDivs().
Referenced by mlir::presburger::MultiAffineFunction::valueAt().
|
inline |
Definition at line 153 of file Utils.h.
Referenced by addDivisionConstraints(), mlir::presburger::MultiAffineFunction::getLexSet(), mlir::presburger::IntegerRelation::getLocalReprs(), getSetDifference(), mlir::presburger::MultiAffineFunction::mergeDivs(), mlir::presburger::mergeLocalVars(), and normalizeDivs().
|
inline |
|
inline |
|
inline |
Definition at line 139 of file Utils.h.
References mlir::presburger::Matrix< T >::getRow().
Referenced by addDivisionConstraints(), divValuesAt(), mlir::presburger::MultiAffineFunction::getLexSet(), mlir::presburger::IntegerRelation::getLocalReprs(), getSetDifference(), mlir::presburger::MultiAffineFunction::mergeDivs(), mlir::presburger::mergeLocalVars(), and normalizeDivs().
|
inline |
Definition at line 142 of file Utils.h.
References mlir::presburger::Matrix< T >::getRow().
|
inline |
Definition at line 128 of file Utils.h.
References getNumDivs(), and getNumVars().
Referenced by addDivisionConstraints(), divValuesAt(), mlir::presburger::MultiAffineFunction::getLexSet(), insertDiv(), mlir::presburger::MultiAffineFunction::mergeDivs(), and removeDuplicateDivs().
|
inline |
Definition at line 125 of file Utils.h.
References mlir::presburger::Matrix< T >::getNumRows().
Referenced by addDivisionConstraints(), divValuesAt(), getDivOffset(), mlir::getMultiAffineFunctionFromMap(), getNumNonDivs(), insertDiv(), mlir::presburger::MultiAffineFunction::mergeDivs(), mlir::presburger::mergeLocalVars(), normalizeDivs(), and removeDuplicateDivs().
|
inline |
Definition at line 126 of file Utils.h.
References getNumDivs(), and getNumVars().
Referenced by divValuesAt().
|
inline |
Definition at line 124 of file Utils.h.
References mlir::presburger::Matrix< T >::getNumColumns().
Referenced by addDivisionConstraints(), getDivOffset(), getNumNonDivs(), insertDiv(), and mlir::presburger::MultiAffineFunction::mergeDivs().
|
inline |
Definition at line 133 of file Utils.h.
Referenced by addDivisionConstraints(), mlir::getMultiAffineFunctionFromMap(), and mlir::presburger::IntegerRelation::hasOnlyDivLocals().
|
inline |
void DivisionRepr::insertDiv | ( | unsigned | pos, |
ArrayRef< DynamicAPInt > | dividend, | ||
const DynamicAPInt & | divisor | ||
) |
Definition at line 495 of file Utils.cpp.
References mlir::presburger::Matrix< T >::appendExtraRow(), getDivOffset(), getNumDivs(), getNumVars(), and mlir::presburger::Matrix< T >::insertColumn().
Referenced by mlir::presburger::MultiAffineFunction::mergeDivs().
void DivisionRepr::insertDiv | ( | unsigned | pos, |
unsigned | num = 1 |
||
) |
Definition at line 505 of file Utils.cpp.
References getDivOffset(), getNumDivs(), mlir::presburger::Matrix< T >::insertColumns(), and mlir::presburger::Matrix< T >::insertRows().
void DivisionRepr::normalizeDivs | ( | ) |
Definition at line 487 of file Utils.cpp.
References getDenom(), getDividend(), getNumDivs(), and mlir::presburger::normalizeDiv().
Referenced by removeDuplicateDivs().
void DivisionRepr::print | ( | raw_ostream & | os | ) | const |
Definition at line 512 of file Utils.cpp.
References mlir::presburger::Matrix< T >::print().
Referenced by dump(), and mlir::presburger::MultiAffineFunction::print().
void DivisionRepr::removeDuplicateDivs | ( | llvm::function_ref< bool(unsigned i, unsigned j)> | merge | ) |
Removes duplicate divisions.
On every possible duplicate division found, merge(i, j)
, where i
, j
are current index of the duplicate divisions, is called and division at index j
is merged into division at index i
. If merge(i, j)
returns true
, the divisions are merged i.e. j^th
division gets eliminated and it's each instance is replaced by i^th
division. If it returns false
, the divisions are not merged. merge
can also do side effects, For example it can merge the local variables in IntegerRelation.
Definition at line 441 of file Utils.cpp.
References mlir::presburger::Matrix< T >::addToColumn(), getDivOffset(), getNumDivs(), mlir::presburger::Matrix< T >::getRow(), normalizeDivs(), mlir::presburger::Matrix< T >::removeColumn(), and mlir::presburger::Matrix< T >::removeRow().
Referenced by mlir::presburger::MultiAffineFunction::mergeDivs(), mlir::presburger::mergeLocalVars(), and mlir::presburger::IntegerRelation::removeDuplicateDivs().
|
inline |
Definition at line 158 of file Utils.h.
References mlir::presburger::Matrix< T >::setRow().
Referenced by mlir::presburger::MultiAffineFunction::mergeDivs(), and mlir::presburger::mergeLocalVars().