MLIR
20.0.0git
|
#include "mlir/Conversion/LLVMCommon/MemRefBuilder.h"
Public Member Functions | |
UnrankedMemRefDescriptor (Value descriptor) | |
Construct a helper for the given descriptor value. More... | |
Value | rank (OpBuilder &builder, Location loc) const |
Builds IR extracting the rank from the descriptor. More... | |
void | setRank (OpBuilder &builder, Location loc, Value value) |
Builds IR setting the rank in the descriptor. More... | |
Value | memRefDescPtr (OpBuilder &builder, Location loc) const |
Builds IR extracting ranked memref descriptor ptr. More... | |
void | setMemRefDescPtr (OpBuilder &builder, Location loc, Value value) |
Builds IR setting ranked memref descriptor ptr. More... | |
Public Member Functions inherited from mlir::StructBuilder | |
StructBuilder (Value v) | |
Construct a helper for the given value. More... | |
operator Value () | |
Static Public Member Functions | |
static UnrankedMemRefDescriptor | undef (OpBuilder &builder, Location loc, Type descriptorType) |
Builds IR creating an undef value of the descriptor type. More... | |
static Value | pack (OpBuilder &builder, Location loc, const LLVMTypeConverter &converter, UnrankedMemRefType type, ValueRange values) |
Builds IR populating an unranked MemRef descriptor structure from a list of individual constituent values in the following order: More... | |
static void | unpack (OpBuilder &builder, Location loc, Value packed, SmallVectorImpl< Value > &results) |
Builds IR extracting individual elements that compose an unranked memref descriptor and returns them as results list. More... | |
static unsigned | getNumUnpackedValues () |
Returns the number of non-aggregate values that would be produced by unpack . More... | |
static void | computeSizes (OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter, ArrayRef< UnrankedMemRefDescriptor > values, ArrayRef< unsigned > addressSpaces, SmallVectorImpl< Value > &sizes) |
Builds IR computing the sizes in bytes (suitable for opaque allocation) and appends the corresponding values into sizes . More... | |
static Value | allocatedPtr (OpBuilder &builder, Location loc, Value memRefDescPtr, LLVM::LLVMPointerType elemPtrType) |
TODO: The following accessors don't take alignment rules between elements of the descriptor struct into account. More... | |
static void | setAllocatedPtr (OpBuilder &builder, Location loc, Value memRefDescPtr, LLVM::LLVMPointerType elemPtrType, Value allocatedPtr) |
Builds IR inserting the allocated pointer into the descriptor. More... | |
static Value | alignedPtr (OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter, Value memRefDescPtr, LLVM::LLVMPointerType elemPtrType) |
Builds IR extracting the aligned pointer from the descriptor. More... | |
static void | setAlignedPtr (OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter, Value memRefDescPtr, LLVM::LLVMPointerType elemPtrType, Value alignedPtr) |
Builds IR inserting the aligned pointer into the descriptor. More... | |
static Value | offsetBasePtr (OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter, Value memRefDescPtr, LLVM::LLVMPointerType elemPtrType) |
Builds IR for getting the pointer to the offset's location. More... | |
static Value | offset (OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter, Value memRefDescPtr, LLVM::LLVMPointerType elemPtrType) |
Builds IR extracting the offset from the descriptor. More... | |
static void | setOffset (OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter, Value memRefDescPtr, LLVM::LLVMPointerType elemPtrType, Value offset) |
Builds IR inserting the offset into the descriptor. More... | |
static Value | sizeBasePtr (OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter, Value memRefDescPtr, LLVM::LLVMPointerType elemPtrType) |
Builds IR extracting the pointer to the first element of the size array. More... | |
static Value | size (OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter, Value sizeBasePtr, Value index) |
Builds IR extracting the size[index] from the descriptor. More... | |
static void | setSize (OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter, Value sizeBasePtr, Value index, Value size) |
Builds IR inserting the size[index] into the descriptor. More... | |
static Value | strideBasePtr (OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter, Value sizeBasePtr, Value rank) |
Builds IR extracting the pointer to the first element of the stride array. More... | |
static Value | stride (OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter, Value strideBasePtr, Value index, Value stride) |
Builds IR extracting the stride[index] from the descriptor. More... | |
static void | setStride (OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter, Value strideBasePtr, Value index, Value stride) |
Builds IR inserting the stride[index] into the descriptor. More... | |
Static Public Member Functions inherited from mlir::StructBuilder | |
static StructBuilder | undef (OpBuilder &builder, Location loc, Type descriptorType) |
Builds IR creating an undef value of the descriptor type. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from mlir::StructBuilder | |
Value | extractPtr (OpBuilder &builder, Location loc, unsigned pos) const |
Builds IR to extract a value from the struct at position pos. More... | |
void | setPtr (OpBuilder &builder, Location loc, unsigned pos, Value ptr) |
Builds IR to set a value in the struct at position pos. More... | |
Protected Attributes inherited from mlir::StructBuilder | |
Value | value |
Type | structType |
Definition at line 158 of file MemRefBuilder.h.
|
explicit |
Construct a helper for the given descriptor value.
Definition at line 299 of file MemRefBuilder.cpp.
Referenced by undef().
|
static |
Builds IR extracting the aligned pointer from the descriptor.
Definition at line 419 of file MemRefBuilder.cpp.
References castToElemPtrPtr(), mlir::OpBuilder::create(), and memRefDescPtr().
Referenced by setAlignedPtr().
|
static |
TODO: The following accessors don't take alignment rules between elements of the descriptor struct into account.
For some architectures, it might be necessary to extend them and to use llvm::DataLayout
contained in LLVMTypeConverter
. Builds IR extracting the allocated pointer from the descriptor.
Definition at line 400 of file MemRefBuilder.cpp.
References mlir::OpBuilder::create(), and memRefDescPtr().
Referenced by setAllocatedPtr().
|
static |
Builds IR computing the sizes in bytes (suitable for opaque allocation) and appends the corresponding values into sizes
.
addressSpaces
which must have the same length as values
, is needed to handle layouts where sizeof(ptr addrspace(N)) != sizeof(ptr addrspace(0)).
Definition at line 352 of file MemRefBuilder.cpp.
References mlir::OpBuilder::create(), createIndexAttrConstant(), mlir::detail::divideCeil(), mlir::LLVMTypeConverter::getIndexType(), mlir::LLVMTypeConverter::getIndexTypeBitwidth(), mlir::LLVMTypeConverter::getPointerBitwidth(), and rank().
Referenced by mlir::ConvertToLLVMPattern::copyUnrankedDescriptors().
|
inlinestatic |
Returns the number of non-aggregate values that would be produced by unpack
.
Definition at line 190 of file MemRefBuilder.h.
Referenced by wrapExternalFunction().
Builds IR extracting ranked memref descriptor ptr.
Definition at line 316 of file MemRefBuilder.cpp.
References mlir::StructBuilder::extractPtr(), and kPtrInUnrankedMemRefDescriptor.
Referenced by alignedPtr(), allocatedPtr(), mlir::ConvertToLLVMPattern::copyUnrankedDescriptors(), offset(), offsetBasePtr(), setAlignedPtr(), setAllocatedPtr(), setOffset(), sizeBasePtr(), and unpack().
|
static |
Builds IR extracting the offset from the descriptor.
Definition at line 453 of file MemRefBuilder.cpp.
References mlir::OpBuilder::create(), mlir::LLVMTypeConverter::getIndexType(), memRefDescPtr(), and offsetBasePtr().
Referenced by setOffset().
|
static |
Builds IR for getting the pointer to the offset's location.
Returns a pointer to a convertType(index), which points to the beggining of a struct {index, index[rank], index[rank]}.
Definition at line 443 of file MemRefBuilder.cpp.
References castToElemPtrPtr(), mlir::OpBuilder::create(), and memRefDescPtr().
Referenced by offset(), and setOffset().
|
static |
Builds IR populating an unranked MemRef descriptor structure from a list of individual constituent values in the following order:
Definition at line 329 of file MemRefBuilder.cpp.
References mlir::LLVMTypeConverter::convertType(), kPtrInUnrankedMemRefDescriptor, kRankInUnrankedMemRefDescriptor, and undef().
Referenced by mlir::LLVMTypeConverter::LLVMTypeConverter(), and wrapExternalFunction().
Builds IR extracting the rank from the descriptor.
Definition at line 309 of file MemRefBuilder.cpp.
References mlir::StructBuilder::extractPtr(), and kRankInUnrankedMemRefDescriptor.
Referenced by computeSizes(), mlir::ConvertToLLVMPattern::copyUnrankedDescriptors(), strideBasePtr(), and unpack().
|
static |
Builds IR inserting the aligned pointer into the descriptor.
Definition at line 431 of file MemRefBuilder.cpp.
References alignedPtr(), castToElemPtrPtr(), mlir::OpBuilder::create(), and memRefDescPtr().
|
static |
Builds IR inserting the allocated pointer into the descriptor.
Definition at line 406 of file MemRefBuilder.cpp.
References allocatedPtr(), mlir::OpBuilder::create(), and memRefDescPtr().
Builds IR setting ranked memref descriptor ptr.
Definition at line 320 of file MemRefBuilder.cpp.
References kPtrInUnrankedMemRefDescriptor, and mlir::StructBuilder::setPtr().
|
static |
Builds IR inserting the offset into the descriptor.
Definition at line 463 of file MemRefBuilder.cpp.
References mlir::OpBuilder::create(), memRefDescPtr(), offset(), and offsetBasePtr().
Builds IR setting the rank in the descriptor.
Definition at line 312 of file MemRefBuilder.cpp.
References kRankInUnrankedMemRefDescriptor, and mlir::StructBuilder::setPtr().
|
static |
Builds IR inserting the size[index] into the descriptor.
Definition at line 496 of file MemRefBuilder.cpp.
References mlir::OpBuilder::create(), mlir::get(), mlir::Builder::getContext(), mlir::LLVMTypeConverter::getIndexType(), size(), and sizeBasePtr().
|
static |
Builds IR inserting the stride[index] into the descriptor.
Definition at line 529 of file MemRefBuilder.cpp.
References mlir::OpBuilder::create(), mlir::get(), mlir::Builder::getContext(), mlir::LLVMTypeConverter::getIndexType(), stride(), and strideBasePtr().
|
static |
Builds IR extracting the size[index] from the descriptor.
Definition at line 484 of file MemRefBuilder.cpp.
References mlir::OpBuilder::create(), mlir::get(), mlir::Builder::getContext(), mlir::LLVMTypeConverter::getIndexType(), and sizeBasePtr().
Referenced by setSize().
|
static |
Builds IR extracting the pointer to the first element of the size array.
Definition at line 473 of file MemRefBuilder.cpp.
References mlir::OpBuilder::create(), mlir::get(), mlir::Builder::getContext(), mlir::Type::getContext(), mlir::LLVMTypeConverter::getIndexType(), mlir::LLVM::LLVMStructType::getLiteral(), and memRefDescPtr().
Referenced by setSize(), size(), and strideBasePtr().
|
static |
Builds IR extracting the stride[index] from the descriptor.
Definition at line 517 of file MemRefBuilder.cpp.
References mlir::OpBuilder::create(), mlir::get(), mlir::Builder::getContext(), mlir::LLVMTypeConverter::getIndexType(), and strideBasePtr().
Referenced by setStride().
|
static |
Builds IR extracting the pointer to the first element of the stride array.
Definition at line 508 of file MemRefBuilder.cpp.
References mlir::OpBuilder::create(), mlir::get(), mlir::Builder::getContext(), mlir::LLVMTypeConverter::getIndexType(), rank(), and sizeBasePtr().
Referenced by setStride(), and stride().
|
static |
Builds IR creating an undef
value of the descriptor type.
Definition at line 303 of file MemRefBuilder.cpp.
References mlir::OpBuilder::create(), and UnrankedMemRefDescriptor().
Referenced by mlir::ConvertToLLVMPattern::copyUnrankedDescriptors(), and pack().
|
static |
Builds IR extracting individual elements that compose an unranked memref descriptor and returns them as results
list.
Definition at line 343 of file MemRefBuilder.cpp.
References memRefDescPtr(), and rank().
Referenced by mlir::LLVMTypeConverter::promoteOperands(), and wrapForExternalCallers().