MLIR
20.0.0git
|
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 > | |
T | getValue () const |
Get the value of the identifier casted to type T . More... | |
bool | hasValue () const |
bool | isEqual (const Identifier &other) const |
Check if the two identifiers are equal. More... | |
bool | operator== (const Identifier &other) const |
bool | operator!= (const Identifier &other) const |
void | print (llvm::raw_ostream &os) const |
void | dump () const |
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.
|
default |
|
inlineexplicit |
Definition at line 76 of file PresburgerSpace.h.
void Identifier::dump | ( | ) | const |
Definition at line 33 of file PresburgerSpace.cpp.
References print().
|
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.
Referenced by mlir::FlatLinearValueConstraints::getValue().
|
inline |
Definition at line 95 of file PresburgerSpace.h.
Referenced by mlir::FlatLinearValueConstraints::hasValue(), and mlir::presburger::IntegerRelation::mergeAndCompose().
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.
Referenced by operator!=(), and operator==().
|
inline |
Definition at line 102 of file PresburgerSpace.h.
References isEqual().
|
inline |
Definition at line 101 of file PresburgerSpace.h.
References isEqual().
void Identifier::print | ( | llvm::raw_ostream & | os | ) | const |
Definition at line 29 of file PresburgerSpace.cpp.
Referenced by dump().