MLIR  19.0.0git
Public Member Functions | List of all members
mlir::presburger::DivisionRepr Class Reference

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< MPIntgetDividend (unsigned i)
ArrayRef< MPIntgetDividend (unsigned i) const
SmallVector< std::optional< MPInt >, 4 > divValuesAt (ArrayRef< MPInt > point) const
MPIntgetDenom (unsigned i)
MPInt getDenom (unsigned i) const
ArrayRef< MPIntgetDenoms () const
void setDiv (unsigned i, ArrayRef< MPInt > dividend, const MPInt &divisor)
void normalizeDivs ()
void insertDiv (unsigned pos, ArrayRef< MPInt > dividend, const MPInt &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

Detailed Description

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.

Definition at line 118 of file Utils.h.

Constructor & Destructor Documentation

◆ DivisionRepr() [1/2]

mlir::presburger::DivisionRepr::DivisionRepr ( unsigned  numVars,
unsigned  numDivs 

Definition at line 120 of file Utils.h.

◆ DivisionRepr() [2/2]

mlir::presburger::DivisionRepr::DivisionRepr ( unsigned  numVars)

Definition at line 123 of file Utils.h.

Member Function Documentation

◆ clearRepr()

void mlir::presburger::DivisionRepr::clearRepr ( unsigned  i)

Definition at line 137 of file Utils.h.

Referenced by mlir::presburger::IntegerRelation::getLocalReprs().

◆ divValuesAt()

SmallVector< std::optional< MPInt >, 4 > DivisionRepr::divValuesAt ( ArrayRef< MPInt point) const

◆ dump()

void DivisionRepr::dump ( ) const

Definition at line 519 of file Utils.cpp.

References print().

◆ getDenom() [1/2]

MPInt& mlir::presburger::DivisionRepr::getDenom ( unsigned  i)

◆ getDenom() [2/2]

MPInt mlir::presburger::DivisionRepr::getDenom ( unsigned  i) const

Definition at line 150 of file Utils.h.

◆ getDenoms()

ArrayRef<MPInt> mlir::presburger::DivisionRepr::getDenoms ( ) const

Definition at line 152 of file Utils.h.

◆ getDividend() [1/2]

MutableArrayRef<MPInt> mlir::presburger::DivisionRepr::getDividend ( unsigned  i)

◆ getDividend() [2/2]

ArrayRef<MPInt> mlir::presburger::DivisionRepr::getDividend ( unsigned  i) const

Definition at line 141 of file Utils.h.

References mlir::presburger::Matrix< T >::getRow().

◆ getDivOffset()

unsigned mlir::presburger::DivisionRepr::getDivOffset ( ) const

◆ getNumDivs()

unsigned mlir::presburger::DivisionRepr::getNumDivs ( ) const

◆ getNumNonDivs()

unsigned mlir::presburger::DivisionRepr::getNumNonDivs ( ) const

Definition at line 127 of file Utils.h.

References getNumDivs(), and getNumVars().

Referenced by divValuesAt().

◆ getNumVars()

unsigned mlir::presburger::DivisionRepr::getNumVars ( ) const

◆ hasAllReprs()

bool mlir::presburger::DivisionRepr::hasAllReprs ( ) const

◆ hasRepr()

bool mlir::presburger::DivisionRepr::hasRepr ( unsigned  i) const

Definition at line 132 of file Utils.h.

◆ insertDiv() [1/2]

void DivisionRepr::insertDiv ( unsigned  pos,
ArrayRef< MPInt dividend,
const MPInt divisor 

◆ insertDiv() [2/2]

void DivisionRepr::insertDiv ( unsigned  pos,
unsigned  num = 1 

◆ normalizeDivs()

void DivisionRepr::normalizeDivs ( )

Definition at line 485 of file Utils.cpp.

References getDenom(), getDividend(), getNumDivs(), and mlir::presburger::normalizeDiv().

Referenced by removeDuplicateDivs().

◆ print()

void DivisionRepr::print ( raw_ostream &  os) const

◆ removeDuplicateDivs()

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 439 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().

◆ setDiv()

void mlir::presburger::DivisionRepr::setDiv ( unsigned  i,
ArrayRef< MPInt dividend,
const MPInt divisor 

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