Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
mlir/include/mlir/Conversion/LLVMCommon/MemRefBuilder.h
Show First 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | public: | ||||
static void unpack(OpBuilder &builder, Location loc, Value packed, | static void unpack(OpBuilder &builder, Location loc, Value packed, | ||||
MemRefType type, SmallVectorImpl<Value> &results); | MemRefType type, SmallVectorImpl<Value> &results); | ||||
/// Returns the number of non-aggregate values that would be produced by | /// Returns the number of non-aggregate values that would be produced by | ||||
/// `unpack`. | /// `unpack`. | ||||
static unsigned getNumUnpackedValues(MemRefType type); | static unsigned getNumUnpackedValues(MemRefType type); | ||||
private: | private: | ||||
bool useOpaquePointers(); | |||||
// Cached index type. | // Cached index type. | ||||
Type indexType; | Type indexType; | ||||
}; | }; | ||||
/// Helper class allowing the user to access a range of Values that correspond | /// Helper class allowing the user to access a range of Values that correspond | ||||
/// to an unpacked memref descriptor using named accessors. This does not own | /// to an unpacked memref descriptor using named accessors. This does not own | ||||
/// the values. | /// the values. | ||||
class MemRefDescriptorView { | class MemRefDescriptorView { | ||||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | public: | ||||
/// TODO: The following accessors don't take alignment rules between elements | /// TODO: The following accessors don't take alignment rules between elements | ||||
/// of the descriptor struct into account. For some architectures, it might be | /// of the descriptor struct into account. For some architectures, it might be | ||||
/// necessary to extend them and to use `llvm::DataLayout` contained in | /// necessary to extend them and to use `llvm::DataLayout` contained in | ||||
/// `LLVMTypeConverter`. | /// `LLVMTypeConverter`. | ||||
/// Builds IR extracting the allocated pointer from the descriptor. | /// Builds IR extracting the allocated pointer from the descriptor. | ||||
static Value allocatedPtr(OpBuilder &builder, Location loc, | static Value allocatedPtr(OpBuilder &builder, Location loc, | ||||
Value memRefDescPtr, Type elemPtrPtrType); | Value memRefDescPtr, | ||||
LLVM::LLVMPointerType elemPtrType); | |||||
/// Builds IR inserting the allocated pointer into the descriptor. | /// Builds IR inserting the allocated pointer into the descriptor. | ||||
static void setAllocatedPtr(OpBuilder &builder, Location loc, | static void setAllocatedPtr(OpBuilder &builder, Location loc, | ||||
Value memRefDescPtr, Type elemPtrPtrType, | Value memRefDescPtr, | ||||
LLVM::LLVMPointerType elemPtrType, | |||||
Value allocatedPtr); | Value allocatedPtr); | ||||
/// Builds IR extracting the aligned pointer from the descriptor. | /// Builds IR extracting the aligned pointer from the descriptor. | ||||
static Value alignedPtr(OpBuilder &builder, Location loc, | static Value alignedPtr(OpBuilder &builder, Location loc, | ||||
LLVMTypeConverter &typeConverter, Value memRefDescPtr, | LLVMTypeConverter &typeConverter, Value memRefDescPtr, | ||||
Type elemPtrPtrType); | LLVM::LLVMPointerType elemPtrType); | ||||
/// Builds IR inserting the aligned pointer into the descriptor. | /// Builds IR inserting the aligned pointer into the descriptor. | ||||
static void setAlignedPtr(OpBuilder &builder, Location loc, | static void setAlignedPtr(OpBuilder &builder, Location loc, | ||||
LLVMTypeConverter &typeConverter, | LLVMTypeConverter &typeConverter, | ||||
Value memRefDescPtr, Type elemPtrPtrType, | Value memRefDescPtr, | ||||
LLVM::LLVMPointerType elemPtrType, | |||||
Value alignedPtr); | Value alignedPtr); | ||||
/// Builds IR extracting the offset from the descriptor. | /// Builds IR extracting the offset from the descriptor. | ||||
static Value offset(OpBuilder &builder, Location loc, | static Value offset(OpBuilder &builder, Location loc, | ||||
LLVMTypeConverter &typeConverter, Value memRefDescPtr, | LLVMTypeConverter &typeConverter, Value memRefDescPtr, | ||||
Type elemPtrPtrType); | LLVM::LLVMPointerType elemPtrType); | ||||
/// Builds IR inserting the offset into the descriptor. | /// Builds IR inserting the offset into the descriptor. | ||||
static void setOffset(OpBuilder &builder, Location loc, | static void setOffset(OpBuilder &builder, Location loc, | ||||
LLVMTypeConverter &typeConverter, Value memRefDescPtr, | LLVMTypeConverter &typeConverter, Value memRefDescPtr, | ||||
Type elemPtrPtrType, Value offset); | LLVM::LLVMPointerType elemPtrType, Value offset); | ||||
/// Builds IR extracting the pointer to the first element of the size array. | /// Builds IR extracting the pointer to the first element of the size array. | ||||
static Value sizeBasePtr(OpBuilder &builder, Location loc, | static Value sizeBasePtr(OpBuilder &builder, Location loc, | ||||
LLVMTypeConverter &typeConverter, | LLVMTypeConverter &typeConverter, | ||||
Value memRefDescPtr, | Value memRefDescPtr, | ||||
LLVM::LLVMPointerType elemPtrPtrType); | LLVM::LLVMPointerType elemPtrType); | ||||
/// Builds IR extracting the size[index] from the descriptor. | /// Builds IR extracting the size[index] from the descriptor. | ||||
static Value size(OpBuilder &builder, Location loc, | static Value size(OpBuilder &builder, Location loc, | ||||
LLVMTypeConverter &typeConverter, Value sizeBasePtr, | LLVMTypeConverter &typeConverter, Value sizeBasePtr, | ||||
Value index); | Value index); | ||||
/// Builds IR inserting the size[index] into the descriptor. | /// Builds IR inserting the size[index] into the descriptor. | ||||
static void setSize(OpBuilder &builder, Location loc, | static void setSize(OpBuilder &builder, Location loc, | ||||
LLVMTypeConverter &typeConverter, Value sizeBasePtr, | LLVMTypeConverter &typeConverter, Value sizeBasePtr, | ||||
Value index, Value size); | Value index, Value size); | ||||
Show All 18 Lines |