#include "mlir/Conversion/LLVMCommon/MemRefBuilder.h"
#include "MemRefDescriptor.h"
#include "mlir/Conversion/LLVMCommon/TypeConverter.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/LLVMIR/LLVMTypes.h"
#include "mlir/IR/Builders.h"
#include "llvm/Support/MathExtras.h"
usingnamespacemlir;
MemRefDescriptor::MemRefDescriptor(Value descriptor)
: … { … }
MemRefDescriptor MemRefDescriptor::undef(OpBuilder &builder, Location loc,
Type descriptorType) { … }
MemRefDescriptor
MemRefDescriptor::fromStaticShape(OpBuilder &builder, Location loc,
const LLVMTypeConverter &typeConverter,
MemRefType type, Value memory) { … }
MemRefDescriptor MemRefDescriptor::fromStaticShape(
OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter,
MemRefType type, Value memory, Value alignedMemory) { … }
Value MemRefDescriptor::allocatedPtr(OpBuilder &builder, Location loc) { … }
void MemRefDescriptor::setAllocatedPtr(OpBuilder &builder, Location loc,
Value ptr) { … }
Value MemRefDescriptor::alignedPtr(OpBuilder &builder, Location loc) { … }
void MemRefDescriptor::setAlignedPtr(OpBuilder &builder, Location loc,
Value ptr) { … }
static Value createIndexAttrConstant(OpBuilder &builder, Location loc,
Type resultType, int64_t value) { … }
Value MemRefDescriptor::offset(OpBuilder &builder, Location loc) { … }
void MemRefDescriptor::setOffset(OpBuilder &builder, Location loc,
Value offset) { … }
void MemRefDescriptor::setConstantOffset(OpBuilder &builder, Location loc,
uint64_t offset) { … }
Value MemRefDescriptor::size(OpBuilder &builder, Location loc, unsigned pos) { … }
Value MemRefDescriptor::size(OpBuilder &builder, Location loc, Value pos,
int64_t rank) { … }
void MemRefDescriptor::setSize(OpBuilder &builder, Location loc, unsigned pos,
Value size) { … }
void MemRefDescriptor::setConstantSize(OpBuilder &builder, Location loc,
unsigned pos, uint64_t size) { … }
Value MemRefDescriptor::stride(OpBuilder &builder, Location loc, unsigned pos) { … }
void MemRefDescriptor::setStride(OpBuilder &builder, Location loc, unsigned pos,
Value stride) { … }
void MemRefDescriptor::setConstantStride(OpBuilder &builder, Location loc,
unsigned pos, uint64_t stride) { … }
LLVM::LLVMPointerType MemRefDescriptor::getElementPtrType() { … }
Value MemRefDescriptor::bufferPtr(OpBuilder &builder, Location loc,
const LLVMTypeConverter &converter,
MemRefType type) { … }
Value MemRefDescriptor::pack(OpBuilder &builder, Location loc,
const LLVMTypeConverter &converter,
MemRefType type, ValueRange values) { … }
void MemRefDescriptor::unpack(OpBuilder &builder, Location loc, Value packed,
MemRefType type,
SmallVectorImpl<Value> &results) { … }
unsigned MemRefDescriptor::getNumUnpackedValues(MemRefType type) { … }
MemRefDescriptorView::MemRefDescriptorView(ValueRange range)
: … { … }
Value MemRefDescriptorView::allocatedPtr() { … }
Value MemRefDescriptorView::alignedPtr() { … }
Value MemRefDescriptorView::offset() { … }
Value MemRefDescriptorView::size(unsigned pos) { … }
Value MemRefDescriptorView::stride(unsigned pos) { … }
UnrankedMemRefDescriptor::UnrankedMemRefDescriptor(Value descriptor)
: … { … }
UnrankedMemRefDescriptor UnrankedMemRefDescriptor::undef(OpBuilder &builder,
Location loc,
Type descriptorType) { … }
Value UnrankedMemRefDescriptor::rank(OpBuilder &builder, Location loc) const { … }
void UnrankedMemRefDescriptor::setRank(OpBuilder &builder, Location loc,
Value v) { … }
Value UnrankedMemRefDescriptor::memRefDescPtr(OpBuilder &builder,
Location loc) const { … }
void UnrankedMemRefDescriptor::setMemRefDescPtr(OpBuilder &builder,
Location loc, Value v) { … }
Value UnrankedMemRefDescriptor::pack(OpBuilder &builder, Location loc,
const LLVMTypeConverter &converter,
UnrankedMemRefType type,
ValueRange values) { … }
void UnrankedMemRefDescriptor::unpack(OpBuilder &builder, Location loc,
Value packed,
SmallVectorImpl<Value> &results) { … }
void UnrankedMemRefDescriptor::computeSizes(
OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter,
ArrayRef<UnrankedMemRefDescriptor> values, ArrayRef<unsigned> addressSpaces,
SmallVectorImpl<Value> &sizes) { … }
Value UnrankedMemRefDescriptor::allocatedPtr(
OpBuilder &builder, Location loc, Value memRefDescPtr,
LLVM::LLVMPointerType elemPtrType) { … }
void UnrankedMemRefDescriptor::setAllocatedPtr(
OpBuilder &builder, Location loc, Value memRefDescPtr,
LLVM::LLVMPointerType elemPtrType, Value allocatedPtr) { … }
static std::pair<Value, Type>
castToElemPtrPtr(OpBuilder &builder, Location loc, Value memRefDescPtr,
LLVM::LLVMPointerType elemPtrType) { … }
Value UnrankedMemRefDescriptor::alignedPtr(
OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter,
Value memRefDescPtr, LLVM::LLVMPointerType elemPtrType) { … }
void UnrankedMemRefDescriptor::setAlignedPtr(
OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter,
Value memRefDescPtr, LLVM::LLVMPointerType elemPtrType, Value alignedPtr) { … }
Value UnrankedMemRefDescriptor::offsetBasePtr(
OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter,
Value memRefDescPtr, LLVM::LLVMPointerType elemPtrType) { … }
Value UnrankedMemRefDescriptor::offset(OpBuilder &builder, Location loc,
const LLVMTypeConverter &typeConverter,
Value memRefDescPtr,
LLVM::LLVMPointerType elemPtrType) { … }
void UnrankedMemRefDescriptor::setOffset(OpBuilder &builder, Location loc,
const LLVMTypeConverter &typeConverter,
Value memRefDescPtr,
LLVM::LLVMPointerType elemPtrType,
Value offset) { … }
Value UnrankedMemRefDescriptor::sizeBasePtr(
OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter,
Value memRefDescPtr, LLVM::LLVMPointerType elemPtrType) { … }
Value UnrankedMemRefDescriptor::size(OpBuilder &builder, Location loc,
const LLVMTypeConverter &typeConverter,
Value sizeBasePtr, Value index) { … }
void UnrankedMemRefDescriptor::setSize(OpBuilder &builder, Location loc,
const LLVMTypeConverter &typeConverter,
Value sizeBasePtr, Value index,
Value size) { … }
Value UnrankedMemRefDescriptor::strideBasePtr(
OpBuilder &builder, Location loc, const LLVMTypeConverter &typeConverter,
Value sizeBasePtr, Value rank) { … }
Value UnrankedMemRefDescriptor::stride(OpBuilder &builder, Location loc,
const LLVMTypeConverter &typeConverter,
Value strideBasePtr, Value index,
Value stride) { … }
void UnrankedMemRefDescriptor::setStride(OpBuilder &builder, Location loc,
const LLVMTypeConverter &typeConverter,
Value strideBasePtr, Value index,
Value stride) { … }