MLIR
21.0.0git
|
The main mechanism for performing data layout queries. More...
#include "mlir/Interfaces/DataLayoutInterfaces.h"
Public Member Functions | |
DataLayout () | |
DataLayout (DataLayoutOpInterface op) | |
DataLayout (ModuleOp op) | |
llvm::TypeSize | getTypeSize (Type t) const |
Returns the size of the given type in the current scope. More... | |
llvm::TypeSize | getTypeSizeInBits (Type t) const |
Returns the size in bits of the given type in the current scope. More... | |
uint64_t | getTypeABIAlignment (Type t) const |
Returns the required alignment of the given type in the current scope. More... | |
uint64_t | getTypePreferredAlignment (Type t) const |
Returns the preferred of the given type in the current scope. More... | |
std::optional< uint64_t > | getTypeIndexBitwidth (Type t) const |
Returns the bitwidth that should be used when performing index computations for the given pointer-like type in the current scope. More... | |
Attribute | getEndianness () const |
Returns the specified endianness. More... | |
Attribute | getDefaultMemorySpace () const |
Returns the default memory space used for memory operations. More... | |
Attribute | getAllocaMemorySpace () const |
Returns the memory space used for AllocaOps. More... | |
Attribute | getManglingMode () const |
Returns the mangling mode. More... | |
Attribute | getProgramMemorySpace () const |
Returns the memory space used for program memory operations. More... | |
Attribute | getGlobalMemorySpace () const |
Returns the memory space used for global operations. More... | |
uint64_t | getStackAlignment () const |
Returns the natural alignment of the stack in bits. More... | |
Attribute | getFunctionPointerAlignment () const |
Returns function pointer alignment. More... | |
Attribute | getLegalIntWidths () const |
Returns the legal int widths. More... | |
std::optional< Attribute > | getDevicePropertyValue (TargetSystemSpecInterface::DeviceID, StringAttr propertyName) const |
Returns the value of the specified property if the property is defined for the given device ID, otherwise returns std::nullopt. More... | |
Static Public Member Functions | |
static DataLayout | closest (Operation *op) |
Returns the layout of the closest parent operation carrying layout info. More... | |
The main mechanism for performing data layout queries.
Instances of this class can be created for an operation implementing DataLayoutOpInterface. Upon construction, a layout spec combining that of the given operation with all its ancestors will be computed and used to handle further requests. For efficiency, results to all requests will be cached in this object. Therefore, if the data layout spec for the scoping operation, or any of the enclosing operations, changes, the cache is no longer valid. The user is responsible creating a new DataLayout object after any spec change. In debug mode, the cache validity is being checked in every request.
Definition at line 220 of file DataLayoutInterfaces.h.
|
explicit |
Definition at line 488 of file DataLayoutInterfaces.cpp.
|
explicit |
Definition at line 490 of file DataLayoutInterfaces.cpp.
References checkMissingLayout(), and collectParentLayouts().
|
explicit |
Definition at line 501 of file DataLayoutInterfaces.cpp.
References checkMissingLayout(), and collectParentLayouts().
|
static |
Returns the layout of the closest parent operation carrying layout info.
Definition at line 512 of file DataLayoutInterfaces.cpp.
References mlir::Operation::getParentOp().
Referenced by defaultIsSmallAlloc(), handleByValArgument(), memcpyEnsureOnlySafeAccesses(), and verifyAtomicMemOp().
mlir::Attribute mlir::DataLayout::getAllocaMemorySpace | ( | ) | const |
Returns the memory space used for AllocaOps.
Definition at line 652 of file DataLayoutInterfaces.cpp.
References mlir::detail::getDefaultAllocaMemorySpace().
mlir::Attribute mlir::DataLayout::getDefaultMemorySpace | ( | ) | const |
Returns the default memory space used for memory operations.
Definition at line 636 of file DataLayoutInterfaces.cpp.
References mlir::detail::getDefaultMemorySpace().
std::optional< Attribute > mlir::DataLayout::getDevicePropertyValue | ( | TargetSystemSpecInterface::DeviceID | deviceID, |
StringAttr | propertyName | ||
) | const |
Returns the value of the specified property if the property is defined for the given device ID, otherwise returns std::nullopt.
Definition at line 765 of file DataLayoutInterfaces.cpp.
References mlir::detail::getDevicePropertyValue().
mlir::Attribute mlir::DataLayout::getEndianness | ( | ) | const |
Returns the specified endianness.
Definition at line 620 of file DataLayoutInterfaces.cpp.
References mlir::detail::getDefaultEndianness().
Referenced by isBigEndian().
Attribute mlir::DataLayout::getFunctionPointerAlignment | ( | ) | const |
Returns function pointer alignment.
Definition at line 732 of file DataLayoutInterfaces.cpp.
References mlir::detail::getDefaultFunctionPointerAlignment().
mlir::Attribute mlir::DataLayout::getGlobalMemorySpace | ( | ) | const |
Returns the memory space used for global operations.
Definition at line 700 of file DataLayoutInterfaces.cpp.
References mlir::detail::getDefaultGlobalMemorySpace().
Attribute mlir::DataLayout::getLegalIntWidths | ( | ) | const |
Returns the legal int widths.
Definition at line 749 of file DataLayoutInterfaces.cpp.
References mlir::detail::getDefaultLegalIntWidths().
mlir::Attribute mlir::DataLayout::getManglingMode | ( | ) | const |
Returns the mangling mode.
Definition at line 668 of file DataLayoutInterfaces.cpp.
References mlir::detail::getDefaultManglingMode().
mlir::Attribute mlir::DataLayout::getProgramMemorySpace | ( | ) | const |
Returns the memory space used for program memory operations.
Definition at line 684 of file DataLayoutInterfaces.cpp.
References mlir::detail::getDefaultProgramMemorySpace().
uint64_t mlir::DataLayout::getStackAlignment | ( | ) | const |
Returns the natural alignment of the stack in bits.
Alignment promotion of stack variables should be limited to the natural stack alignment to prevent dynamic stack alignment. Returns zero if the stack alignment is unspecified.
Definition at line 716 of file DataLayoutInterfaces.cpp.
References mlir::detail::getDefaultStackAlignment().
Referenced by tryToEnforceAllocaAlignment().
uint64_t mlir::DataLayout::getTypeABIAlignment | ( | Type | t | ) | const |
Returns the required alignment of the given type in the current scope.
Definition at line 584 of file DataLayoutInterfaces.cpp.
References mlir::detail::getDefaultABIAlignment(), and mlir::Type::getTypeID().
Referenced by calculateStructAlignment(), gepToByteOffset(), mlir::detail::getDefaultABIAlignment(), mlir::detail::getDefaultPreferredAlignment(), getFloatTypePreferredAlignment(), getSubslotAccessInfo(), handleByValArgument(), memsetRewire(), and translateDataLayout().
std::optional< uint64_t > mlir::DataLayout::getTypeIndexBitwidth | ( | Type | t | ) | const |
Returns the bitwidth that should be used when performing index computations for the given pointer-like type in the current scope.
If the type is not a pointer-like type, it returns std::nullopt.
Definition at line 608 of file DataLayoutInterfaces.cpp.
References mlir::detail::getDefaultIndexBitwidth().
Referenced by translateDataLayout().
uint64_t mlir::DataLayout::getTypePreferredAlignment | ( | Type | t | ) | const |
Returns the preferred of the given type in the current scope.
Definition at line 596 of file DataLayoutInterfaces.cpp.
References mlir::detail::getDefaultPreferredAlignment(), and mlir::Type::getTypeID().
Referenced by mlir::detail::getDefaultPreferredAlignment(), and translateDataLayout().
llvm::TypeSize mlir::DataLayout::getTypeSize | ( | Type | t | ) | const |
Returns the size of the given type in the current scope.
Definition at line 560 of file DataLayoutInterfaces.cpp.
References mlir::detail::getDefaultTypeSize(), and mlir::Type::getTypeID().
Referenced by allocBuffer(), areConversionCompatible(), definitelyWritesOnlyWithinSlot(), gepToByteOffset(), mlir::detail::getDefaultABIAlignment(), mlir::detail::getDefaultTypeSizeInBits(), getFloatTypeABIAlignment(), getIntegerTypePreferredAlignment(), mlir::LLVMTypeConverter::getMemRefDescriptorSize(), getSubslotAccessInfo(), mlir::LLVMTypeConverter::getUnrankedMemRefDescriptorSize(), handleByValArgument(), isValidAccessType(), memcpyCanRewire(), memcpyCanUsesBeRemoved(), memsetCanUsesBeRemoved(), and memsetRewire().
llvm::TypeSize mlir::DataLayout::getTypeSizeInBits | ( | Type | t | ) | const |
Returns the size in bits of the given type in the current scope.
Definition at line 572 of file DataLayoutInterfaces.cpp.
References mlir::detail::getDefaultTypeSizeInBits(), and mlir::Type::getTypeID().
Referenced by castToSameSizedInt(), createExtractAndCast(), createInsertAndCast(), defaultIsSmallAlloc(), getArrayElementSizeInBits(), mlir::detail::getDefaultTypeSizeInBits(), getSizeInBytes(), getTypeByteSize(), isTypeCompatibleWithAtomicOp(), mlir::LowerToLLVMOptions::LowerToLLVMOptions(), translateDataLayout(), and verifyTransferOp().