MLIR  16.0.0git
Public Member Functions | Static Public Member Functions | List of all members
mlir::UnrankedMemRefDescriptor Class Reference

#include "mlir/Conversion/LLVMCommon/MemRefBuilder.h"

+ Inheritance diagram for mlir::UnrankedMemRefDescriptor:
+ Collaboration diagram for mlir::UnrankedMemRefDescriptor:

Public Member Functions

 UnrankedMemRefDescriptor (Value descriptor)
 Construct a helper for the given descriptor value. More...
 
Value rank (OpBuilder &builder, Location loc)
 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)
 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, 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, LLVMTypeConverter &typeConverter, ArrayRef< UnrankedMemRefDescriptor > values, 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, Type elemPtrPtrType)
 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, Type elemPtrPtrType, Value allocatedPtr)
 Builds IR inserting the allocated pointer into the descriptor. More...
 
static Value alignedPtr (OpBuilder &builder, Location loc, LLVMTypeConverter &typeConverter, Value memRefDescPtr, Type elemPtrPtrType)
 Builds IR extracting the aligned pointer from the descriptor. More...
 
static void setAlignedPtr (OpBuilder &builder, Location loc, LLVMTypeConverter &typeConverter, Value memRefDescPtr, Type elemPtrPtrType, Value alignedPtr)
 Builds IR inserting the aligned pointer into the descriptor. More...
 
static Value offset (OpBuilder &builder, Location loc, LLVMTypeConverter &typeConverter, Value memRefDescPtr, Type elemPtrPtrType)
 Builds IR extracting the offset from the descriptor. More...
 
static void setOffset (OpBuilder &builder, Location loc, LLVMTypeConverter &typeConverter, Value memRefDescPtr, Type elemPtrPtrType, Value offset)
 Builds IR inserting the offset into the descriptor. More...
 
static Value sizeBasePtr (OpBuilder &builder, Location loc, LLVMTypeConverter &typeConverter, Value memRefDescPtr, LLVM::LLVMPointerType elemPtrPtrType)
 Builds IR extracting the pointer to the first element of the size array. More...
 
static Value size (OpBuilder &builder, Location loc, LLVMTypeConverter &typeConverter, Value sizeBasePtr, Value index)
 Builds IR extracting the size[index] from the descriptor. More...
 
static void setSize (OpBuilder &builder, Location loc, 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, 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, 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, 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)
 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
 

Detailed Description

Definition at line 145 of file MemRefBuilder.h.

Constructor & Destructor Documentation

◆ UnrankedMemRefDescriptor()

UnrankedMemRefDescriptor::UnrankedMemRefDescriptor ( Value  descriptor)
explicit

Construct a helper for the given descriptor value.

Definition at line 275 of file MemRefBuilder.cpp.

Referenced by undef().

Member Function Documentation

◆ alignedPtr()

Value UnrankedMemRefDescriptor::alignedPtr ( OpBuilder builder,
Location  loc,
LLVMTypeConverter typeConverter,
Value  memRefDescPtr,
Type  elemPtrPtrType 
)
static

Builds IR extracting the aligned pointer from the descriptor.

Definition at line 391 of file MemRefBuilder.cpp.

References mlir::OpBuilder::create(), and memRefDescPtr().

Referenced by setAlignedPtr().

◆ allocatedPtr()

Value UnrankedMemRefDescriptor::allocatedPtr ( OpBuilder builder,
Location  loc,
Value  memRefDescPtr,
Type  elemPtrPtrType 
)
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 373 of file MemRefBuilder.cpp.

References mlir::OpBuilder::create(), and memRefDescPtr().

Referenced by setAllocatedPtr().

◆ computeSizes()

void UnrankedMemRefDescriptor::computeSizes ( OpBuilder builder,
Location  loc,
LLVMTypeConverter typeConverter,
ArrayRef< UnrankedMemRefDescriptor values,
SmallVectorImpl< Value > &  sizes 
)
static

Builds IR computing the sizes in bytes (suitable for opaque allocation) and appends the corresponding values into sizes.

Definition at line 328 of file MemRefBuilder.cpp.

References mlir::ceilDiv(), mlir::OpBuilder::create(), createIndexAttrConstant(), mlir::LLVMTypeConverter::getIndexType(), mlir::LLVMTypeConverter::getIndexTypeBitwidth(), mlir::LLVMTypeConverter::getPointerBitwidth(), and rank().

Referenced by mlir::ConvertToLLVMPattern::copyUnrankedDescriptors().

◆ getNumUnpackedValues()

static unsigned mlir::UnrankedMemRefDescriptor::getNumUnpackedValues ( )
inlinestatic

Returns the number of non-aggregate values that would be produced by unpack.

Definition at line 177 of file MemRefBuilder.h.

Referenced by wrapExternalFunction().

◆ memRefDescPtr()

Value UnrankedMemRefDescriptor::memRefDescPtr ( OpBuilder builder,
Location  loc 
)

◆ offset()

Value UnrankedMemRefDescriptor::offset ( OpBuilder builder,
Location  loc,
LLVMTypeConverter typeConverter,
Value  memRefDescPtr,
Type  elemPtrPtrType 
)
static

Builds IR extracting the offset from the descriptor.

Definition at line 416 of file MemRefBuilder.cpp.

References mlir::OpBuilder::create(), mlir::LLVM::LLVMPointerType::get(), mlir::LLVMTypeConverter::getIndexType(), and memRefDescPtr().

Referenced by setOffset().

◆ pack()

Value UnrankedMemRefDescriptor::pack ( OpBuilder builder,
Location  loc,
LLVMTypeConverter converter,
UnrankedMemRefType  type,
ValueRange  values 
)
static

Builds IR populating an unranked MemRef descriptor structure from a list of individual constituent values in the following order:

  • rank of the memref;
  • pointer to the memref descriptor.

Definition at line 305 of file MemRefBuilder.cpp.

References mlir::TypeConverter::convertType(), kPtrInUnrankedMemRefDescriptor, kRankInUnrankedMemRefDescriptor, and undef().

Referenced by mlir::LLVMTypeConverter::LLVMTypeConverter(), and wrapExternalFunction().

◆ rank()

Value UnrankedMemRefDescriptor::rank ( OpBuilder builder,
Location  loc 
)

Builds IR extracting the rank from the descriptor.

Definition at line 285 of file MemRefBuilder.cpp.

References mlir::StructBuilder::extractPtr(), and kRankInUnrankedMemRefDescriptor.

Referenced by computeSizes(), mlir::ConvertToLLVMPattern::copyUnrankedDescriptors(), strideBasePtr(), and unpack().

◆ setAlignedPtr()

void UnrankedMemRefDescriptor::setAlignedPtr ( OpBuilder builder,
Location  loc,
LLVMTypeConverter typeConverter,
Value  memRefDescPtr,
Type  elemPtrPtrType,
Value  alignedPtr 
)
static

Builds IR inserting the aligned pointer into the descriptor.

Definition at line 403 of file MemRefBuilder.cpp.

References alignedPtr(), mlir::OpBuilder::create(), and memRefDescPtr().

◆ setAllocatedPtr()

void UnrankedMemRefDescriptor::setAllocatedPtr ( OpBuilder builder,
Location  loc,
Value  memRefDescPtr,
Type  elemPtrPtrType,
Value  allocatedPtr 
)
static

Builds IR inserting the allocated pointer into the descriptor.

Definition at line 382 of file MemRefBuilder.cpp.

References allocatedPtr(), mlir::OpBuilder::create(), and memRefDescPtr().

◆ setMemRefDescPtr()

void UnrankedMemRefDescriptor::setMemRefDescPtr ( OpBuilder builder,
Location  loc,
Value  value 
)

Builds IR setting ranked memref descriptor ptr.

Definition at line 296 of file MemRefBuilder.cpp.

References kPtrInUnrankedMemRefDescriptor, and mlir::StructBuilder::setPtr().

◆ setOffset()

void UnrankedMemRefDescriptor::setOffset ( OpBuilder builder,
Location  loc,
LLVMTypeConverter typeConverter,
Value  memRefDescPtr,
Type  elemPtrPtrType,
Value  offset 
)
static

Builds IR inserting the offset into the descriptor.

Definition at line 430 of file MemRefBuilder.cpp.

References mlir::OpBuilder::create(), mlir::LLVM::LLVMPointerType::get(), mlir::LLVMTypeConverter::getIndexType(), memRefDescPtr(), and offset().

◆ setRank()

void UnrankedMemRefDescriptor::setRank ( OpBuilder builder,
Location  loc,
Value  value 
)

Builds IR setting the rank in the descriptor.

Definition at line 288 of file MemRefBuilder.cpp.

References kRankInUnrankedMemRefDescriptor, and mlir::StructBuilder::setPtr().

◆ setSize()

void UnrankedMemRefDescriptor::setSize ( OpBuilder builder,
Location  loc,
LLVMTypeConverter typeConverter,
Value  sizeBasePtr,
Value  index,
Value  size 
)
static

Builds IR inserting the size[index] into the descriptor.

Definition at line 468 of file MemRefBuilder.cpp.

References mlir::OpBuilder::create(), mlir::LLVM::LLVMPointerType::get(), mlir::LLVMTypeConverter::getIndexType(), size(), and sizeBasePtr().

◆ setStride()

void UnrankedMemRefDescriptor::setStride ( OpBuilder builder,
Location  loc,
LLVMTypeConverter typeConverter,
Value  strideBasePtr,
Value  index,
Value  stride 
)
static

Builds IR inserting the stride[index] into the descriptor.

Definition at line 495 of file MemRefBuilder.cpp.

References mlir::OpBuilder::create(), mlir::LLVM::LLVMPointerType::get(), mlir::LLVMTypeConverter::getIndexType(), stride(), and strideBasePtr().

◆ size()

Value UnrankedMemRefDescriptor::size ( OpBuilder builder,
Location  loc,
LLVMTypeConverter typeConverter,
Value  sizeBasePtr,
Value  index 
)
static

Builds IR extracting the size[index] from the descriptor.

Definition at line 459 of file MemRefBuilder.cpp.

References mlir::OpBuilder::create(), mlir::LLVM::LLVMPointerType::get(), mlir::LLVMTypeConverter::getIndexType(), and sizeBasePtr().

Referenced by setSize().

◆ sizeBasePtr()

Value UnrankedMemRefDescriptor::sizeBasePtr ( OpBuilder builder,
Location  loc,
LLVMTypeConverter typeConverter,
Value  memRefDescPtr,
LLVM::LLVMPointerType  elemPtrPtrType 
)
static

◆ stride()

Value UnrankedMemRefDescriptor::stride ( OpBuilder builder,
Location  loc,
LLVMTypeConverter typeConverter,
Value  strideBasePtr,
Value  index,
Value  stride 
)
static

Builds IR extracting the stride[index] from the descriptor.

Definition at line 485 of file MemRefBuilder.cpp.

References mlir::OpBuilder::create(), mlir::LLVM::LLVMPointerType::get(), mlir::LLVMTypeConverter::getIndexType(), and strideBasePtr().

Referenced by setStride().

◆ strideBasePtr()

Value UnrankedMemRefDescriptor::strideBasePtr ( OpBuilder builder,
Location  loc,
LLVMTypeConverter typeConverter,
Value  sizeBasePtr,
Value  rank 
)
static

Builds IR extracting the pointer to the first element of the stride array.

Definition at line 478 of file MemRefBuilder.cpp.

References mlir::OpBuilder::create(), mlir::LLVM::LLVMPointerType::get(), mlir::LLVMTypeConverter::getIndexType(), rank(), and sizeBasePtr().

Referenced by setStride(), and stride().

◆ undef()

UnrankedMemRefDescriptor UnrankedMemRefDescriptor::undef ( OpBuilder builder,
Location  loc,
Type  descriptorType 
)
static

Builds IR creating an undef value of the descriptor type.

Definition at line 279 of file MemRefBuilder.cpp.

References mlir::OpBuilder::create(), and UnrankedMemRefDescriptor().

Referenced by mlir::ConvertToLLVMPattern::copyUnrankedDescriptors(), and pack().

◆ unpack()

void UnrankedMemRefDescriptor::unpack ( OpBuilder builder,
Location  loc,
Value  packed,
SmallVectorImpl< Value > &  results 
)
static

Builds IR extracting individual elements that compose an unranked memref descriptor and returns them as results list.

Definition at line 319 of file MemRefBuilder.cpp.

References memRefDescPtr(), and rank().

Referenced by mlir::LLVMTypeConverter::promoteOperands(), and wrapForExternalCallers().


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