20 #include "llvm/Support/TrailingObjects.h" 31 : dialectNamespace(dialectNamespace), typeData(typeData) {}
34 using KeyTy = std::pair<Identifier, StringRef>;
41 StringRef tyData = allocator.
copyInto(key.second);
73 Type const *inputsAndResults)
75 inputsAndResults(inputsAndResults) {}
80 return key ==
KeyTy(getInputs(), getResults());
86 ArrayRef<Type> inputs = key.first, results = key.second;
90 types.reserve(inputs.size() + results.size());
91 types.append(inputs.begin(), inputs.end());
92 types.append(results.begin(), results.end());
93 auto typesList = allocator.
copyInto(ArrayRef<Type>(types));
104 return ArrayRef<Type>(inputsAndResults +
getSubclassData(), numResults);
114 :
TypeStorage(subclassData), elementType(elementTy) {}
126 const int64_t *shapeElements)
132 return key ==
KeyTy(getShape(), elementType);
155 const int64_t *shapeElements)
161 return key ==
KeyTy(getShape(), elementType);
196 const int64_t *shapeElements,
const unsigned numAffineMaps,
197 AffineMap const *affineMapList,
const unsigned memorySpace)
199 numAffineMaps(numAffineMaps), affineMapList(affineMapList),
200 memorySpace(memorySpace) {}
208 return key ==
KeyTy(getShape(), elementType, getAffineMaps(), memorySpace);
218 ArrayRef<AffineMap> affineMapComposition =
219 allocator.
copyInto(std::get<2>(key));
224 affineMapComposition.size(),
225 affineMapComposition.data(), std::get<3>(key));
233 return ArrayRef<AffineMap>(affineMapList, numAffineMaps);
254 using KeyTy = std::tuple<Type, unsigned>;
256 return key ==
KeyTy(elementType, memorySpace);
292 public llvm::TrailingObjects<TupleTypeStorage, Type> {
301 auto byteSize = TupleTypeStorage::totalSizeToAlloc<Type>(key.size());
306 std::uninitialized_copy(key.begin(), key.end(),
307 result->getTrailingObjects<
Type>());
318 return {getTrailingObjects<Type>(), size()};
324 #endif // TYPEDETAIL_H_ static TupleTypeStorage * construct(TypeStorageAllocator &allocator, ArrayRef< Type > key)
Construction.
Definition: TypeDetail.h:298
Definition: InferTypeOpInterface.cpp:20
Opaque Type Storage and Uniquing.
Definition: TypeDetail.h:29
Type elementType
Definition: TypeDetail.h:286
AffineMap const * affineMapList
List of affine maps in the memref's layout/index map composition.
Definition: TypeDetail.h:241
Definition: Attributes.h:139
FunctionTypeStorage(unsigned numInputs, unsigned numResults, Type const *inputsAndResults)
Definition: TypeDetail.h:72
StringRef typeData
Definition: TypeDetail.h:50
Type const * inputsAndResults
Definition: TypeDetail.h:108
TupleTypeStorage(unsigned numTypes)
Definition: TypeDetail.h:295
MemRefTypeStorage(unsigned shapeSize, Type elementType, const int64_t *shapeElements, const unsigned numAffineMaps, AffineMap const *affineMapList, const unsigned memorySpace)
Definition: TypeDetail.h:195
Base storage class appearing in a Type.
Definition: TypeSupport.h:33
static FunctionTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
Construction.
Definition: TypeDetail.h:84
Definition: StorageUniquer.h:89
Shaped Type Storage.
Definition: TypeDetail.h:112
ComplexTypeStorage(Type elementType)
Definition: TypeDetail.h:273
Definition: Identifier.h:26
bool operator==(const KeyTy &key) const
Definition: TypeDetail.h:35
bool operator==(const KeyTy &key) const
Definition: TypeDetail.h:59
Type KeyTy
The hash key used for uniquing.
Definition: TypeDetail.h:117
unsigned getSubclassData() const
Get the subclass data.
Definition: TypeSupport.h:51
static MemRefTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
Construction.
Definition: TypeDetail.h:212
Definition: TypeDetail.h:153
static UnrankedTensorTypeStorage * construct(TypeStorageAllocator &allocator, Type elementTy)
Construction.
Definition: TypeDetail.h:187
RankedTensorTypeStorage(unsigned shapeSize, Type elementTy, const int64_t *shapeElements)
Definition: TypeDetail.h:154
bool operator==(const KeyTy &key) const
Definition: TypeDetail.h:207
T * allocate()
Allocate an instance of the provided type.
Definition: StorageUniquer.h:109
unsigned width
Definition: TypeDetail.h:67
OpaqueTypeStorage(Identifier dialectNamespace, StringRef typeData)
Definition: TypeDetail.h:30
std::pair< ArrayRef< Type >, ArrayRef< Type > > KeyTy
The hash key used for uniquing.
Definition: TypeDetail.h:78
Identifier dialectNamespace
Definition: TypeDetail.h:47
const unsigned numAffineMaps
The number of affine maps in the 'affineMapList' array.
Definition: TypeDetail.h:239
ArrayRef< Type > getTypes() const
Return the held types.
Definition: TypeDetail.h:317
A type representing a collection of other types.
Definition: TypeDetail.h:290
unsigned numResults
Definition: TypeDetail.h:107
ArrayRef< int64_t > getShape() const
Definition: TypeDetail.h:228
Type elementType
Definition: TypeDetail.h:120
static VectorTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
Construction.
Definition: TypeDetail.h:136
bool operator==(const KeyTy &key) const
Definition: TypeDetail.h:311
Definition: AffineMap.h:37
bool operator==(const KeyTy &key) const
Definition: TypeDetail.h:255
ArrayRef< int64_t > getShape() const
Definition: TypeDetail.h:146
ArrayRef< Type > getInputs() const
Definition: TypeDetail.h:100
bool operator==(const KeyTy &key) const
Definition: TypeDetail.h:131
ShapedTypeStorage(Type elementTy, unsigned subclassData=0)
Definition: TypeDetail.h:113
ArrayRef< AffineMap > getAffineMaps() const
Definition: TypeDetail.h:232
Function Type Storage and Uniquing.
Definition: TypeDetail.h:71
static ComplexTypeStorage * construct(TypeStorageAllocator &allocator, Type elementType)
Construction.
Definition: TypeDetail.h:280
Definition: TypeDetail.h:194
ArrayRef< Type > getResults() const
Definition: TypeDetail.h:103
const unsigned memorySpace
Memory space in which data referenced by memref resides.
Definition: TypeDetail.h:268
const int64_t * shapeElements
Definition: TypeDetail.h:179
unsigned KeyTy
The hash key used for uniquing.
Definition: TypeDetail.h:58
static OpaqueTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
Definition: TypeDetail.h:39
bool operator==(const KeyTy &key) const
Definition: TypeDetail.h:160
static RankedTensorTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
Construction.
Definition: TypeDetail.h:165
const int64_t * shapeElements
Definition: TypeDetail.h:150
bool operator==(const KeyTy &key) const
Definition: TypeDetail.h:277
static UnrankedMemRefTypeStorage * construct(TypeStorageAllocator &allocator, const KeyTy &key)
Construction.
Definition: TypeDetail.h:260
ArrayRef< T > copyInto(ArrayRef< T > elements)
Definition: StorageUniquer.h:93
ArrayRef< int64_t > getShape() const
Definition: TypeDetail.h:175
UnrankedMemRefTypeStorage(Type elementTy, const unsigned memorySpace)
Definition: TypeDetail.h:250
VectorTypeStorage(unsigned shapeSize, Type elementTy, const int64_t *shapeElements)
Definition: TypeDetail.h:125
Definition: TypeDetail.h:248
std::pair< Identifier, StringRef > KeyTy
The hash key used for uniquing.
Definition: TypeDetail.h:34
unsigned size() const
Return the number of held types.
Definition: TypeDetail.h:314
bool operator==(const KeyTy &key) const
Definition: TypeDetail.h:79
const unsigned memorySpace
Memory space in which data referenced by memref resides.
Definition: TypeDetail.h:243
bool operator==(const KeyTy &key) const
Definition: TypeDetail.h:118
static IntegerTypeStorage * construct(TypeStorageAllocator &allocator, KeyTy bitwidth)
Definition: TypeDetail.h:61
Definition: TypeDetail.h:182
IntegerTypeStorage(unsigned width)
Definition: TypeDetail.h:55
Vector Type Storage and Uniquing.
Definition: TypeDetail.h:124
Complex Type Storage.
Definition: TypeDetail.h:272
Integer Type Storage and Uniquing.
Definition: TypeDetail.h:54
const int64_t * shapeElements
An array of integers which stores the shape dimension sizes.
Definition: TypeDetail.h:237