MLIR 22.0.0git
mlir::presburger::Identifier Class Reference

An Identifier stores a pointer to an object, such as a Value or an Operation. More...

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

Public Member Functions

 Identifier ()=default
template<typename T>
 Identifier (T value)
template<typename T>
getValue () const
 Get the value of the identifier casted to type T.
bool hasValue () const
bool isEqual (const Identifier &other) const
 Check if the two identifiers are equal.
bool operator== (const Identifier &other) const
bool operator!= (const Identifier &other) const
void print (llvm::raw_ostream &os) const
void dump () const

Detailed Description

An Identifier stores a pointer to an object, such as a Value or an Operation.

Identifiers are intended to be attached to a variable in a PresburgerSpace and can be used to check if two variables correspond to the same object.

Take for example the following code:

for i = 0 to 100 for j = 0 to 100 S0: A[j] = 0 for k = 0 to 100 S1: A[k] = 1

If we represent the space of iteration variables surrounding S0, S1 we have: space(S0): {d0, d1} space(S1): {d0, d1}

Since the variables are in different spaces, without an identifier, there is no way to distinguish if the variables in the two spaces correspond to different SSA values in the program. So, we attach an Identifier corresponding to the loop iteration variable to them. Now,

space(S0) = {d0(id = i), d1(id = j)} space(S1) = {d0(id = i), d1(id = k)}.

Using the identifier, we can check that the first iteration variable in both the spaces correspond to the same variable in the program, while they are different for second iteration variable.

The equality of Identifiers is checked by comparing the stored pointers. Checking equality asserts that the type of the equal identifiers is same. Identifiers storing null pointers are treated as having no attachment and are considered unequal to any other identifier, including other identifiers with no attachments.

The type of the pointer stored must have an llvm::PointerLikeTypeTraits specialization.

Definition at line 70 of file PresburgerSpace.h.

Constructor & Destructor Documentation

◆ Identifier() [1/2]

mlir::presburger::Identifier::Identifier ( )
default

Referenced by isEqual(), operator!=(), and operator==().

◆ Identifier() [2/2]

template<typename T>
mlir::presburger::Identifier::Identifier ( T value)
inlineexplicit

Definition at line 76 of file PresburgerSpace.h.

Member Function Documentation

◆ dump()

void Identifier::dump ( ) const

Definition at line 33 of file PresburgerSpace.cpp.

References print().

◆ getValue()

template<typename T>
T mlir::presburger::Identifier::getValue ( ) const
inline

Get the value of the identifier casted to type T.

T here should match the type of the identifier used to create it.

Definition at line 86 of file PresburgerSpace.h.

◆ hasValue()

bool mlir::presburger::Identifier::hasValue ( ) const
inline

Definition at line 95 of file PresburgerSpace.h.

◆ isEqual()

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

Check if the two identifiers are equal.

Null identifiers are considered not equal. Asserts if two identifiers are equal but their types are not.

Definition at line 18 of file PresburgerSpace.cpp.

References Identifier().

Referenced by operator!=(), and operator==().

◆ operator!=()

bool mlir::presburger::Identifier::operator!= ( const Identifier & other) const
inline

Definition at line 102 of file PresburgerSpace.h.

References Identifier(), and isEqual().

◆ operator==()

bool mlir::presburger::Identifier::operator== ( const Identifier & other) const
inline

Definition at line 101 of file PresburgerSpace.h.

References Identifier(), and isEqual().

◆ print()

void Identifier::print ( llvm::raw_ostream & os) const

Definition at line 29 of file PresburgerSpace.cpp.

Referenced by dump().


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