15#ifndef MLIR_INTERFACES_DATALAYOUTINTERFACES_H
16#define MLIR_INTERFACES_DATALAYOUTINTERFACES_H
21#include "llvm/ADT/DenseMap.h"
22#include "llvm/ADT/MapVector.h"
23#include "llvm/Support/TypeSize.h"
27class DataLayoutEntryInterface;
28class DLTIQueryInterface;
29class TargetDeviceSpecInterface;
30class TargetSystemSpecInterface;
39 ::llvm::MapVector<::mlir::StringAttr, ::mlir::DataLayoutEntryInterface>;
40class DataLayoutOpInterface;
41class DataLayoutSpecInterface;
72std::optional<uint64_t>
124DataLayoutEntryInterface
129TargetDeviceSpecInterface
151llvm::TypeSize
divideCeil(llvm::TypeSize numerator, uint64_t denominator);
155#include "mlir/Interfaces/DataLayoutAttrInterface.h.inc"
156#include "mlir/Interfaces/DataLayoutDialectInterface.h.inc"
157#include "mlir/Interfaces/DataLayoutOpInterface.h.inc"
158#include "mlir/Interfaces/DataLayoutTypeInterface.h.inc"
178 explicit DataLayout(DataLayoutOpInterface op);
233 std::optional<Attribute>
235 StringAttr propertyName)
const;
239 const DataLayoutSpecInterface originalLayout;
242 const TargetSystemSpecInterface originalTargetSystemDesc;
244#if LLVM_ENABLE_ABI_BREAKING_CHECKS
251 void checkValid()
const;
264 mutable std::optional<Attribute> endianness;
266 mutable std::optional<Attribute> manglingMode;
268 mutable std::optional<Attribute> defaultMemorySpace;
269 mutable std::optional<Attribute> allocaMemorySpace;
270 mutable std::optional<Attribute> programMemorySpace;
271 mutable std::optional<Attribute> globalMemorySpace;
274 mutable std::optional<uint64_t> stackAlignment;
276 mutable std::optional<Attribute> functionPointerAlignment;
278 mutable std::optional<Attribute> legalIntWidths;
Attributes are known-constant values of operations.
The main mechanism for performing data layout queries.
Attribute getAllocaMemorySpace() const
Returns the memory space used for AllocaOps.
static DataLayout closest(Operation *op)
Returns the layout of the closest parent operation carrying layout info.
std::optional< uint64_t > getTypeIndexBitwidth(Type t) const
Returns the bitwidth that should be used when performing index computations for the given pointer-lik...
llvm::TypeSize getTypeSize(Type t) const
Returns the size of the given type in the current scope.
Attribute getManglingMode() const
Returns the mangling mode.
uint64_t getStackAlignment() const
Returns the natural alignment of the stack in bits.
Attribute getProgramMemorySpace() const
Returns the memory space used for program memory operations.
uint64_t getTypePreferredAlignment(Type t) const
Returns the preferred of the given type in the current scope.
Attribute getFunctionPointerAlignment() const
Returns function pointer alignment.
Attribute getGlobalMemorySpace() const
Returns the memory space used for global operations.
uint64_t getTypeABIAlignment(Type t) const
Returns the required alignment of the given type in the current scope.
llvm::TypeSize getTypeSizeInBits(Type t) const
Returns the size in bits of the given type in the current scope.
Attribute getDefaultMemorySpace() const
Returns the default memory space used for memory operations.
Attribute getEndianness() const
Returns the specified endianness.
Attribute getLegalIntWidths() const
Returns the legal int widths.
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,...
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
Operation is the basic unit of execution within MLIR.
This class provides an efficient unique identifier for a specific C++ type.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Attribute getDefaultAllocaMemorySpace(DataLayoutEntryInterface entry)
Default handler for alloca memory space request.
Attribute getDefaultProgramMemorySpace(DataLayoutEntryInterface entry)
Default handler for program memory space request.
Attribute getDefaultEndianness(DataLayoutEntryInterface entry)
Default handler for endianness request.
std::optional< uint64_t > getDefaultIndexBitwidth(Type type, const DataLayout &dataLayout, ArrayRef< DataLayoutEntryInterface > params)
Default handler for the index bitwidth request.
DataLayoutEntryList filterEntriesForType(DataLayoutEntryListRef entries, TypeID typeID)
Given a list of data layout entries, returns a new list containing the entries with keys having the g...
LogicalResult verifyTargetSystemSpec(TargetSystemSpecInterface spec, Location loc)
Verifies that a target system desc spec is valid.
std::optional< Attribute > getDevicePropertyValue(DataLayoutEntryInterface entry)
Returns the value of the property from the specified DataLayoutEntry.
Attribute getDefaultManglingMode(DataLayoutEntryInterface entry)
Default handler for mangling mode request.
uint64_t getDefaultABIAlignment(Type type, const DataLayout &dataLayout, ArrayRef< DataLayoutEntryInterface > params)
Default handler for the required alignment request.
Attribute getDefaultLegalIntWidths(DataLayoutEntryInterface entry)
Default handler for the legal int widths request.
llvm::TypeSize getDefaultTypeSize(Type type, const DataLayout &dataLayout, DataLayoutEntryListRef params)
Default handler for the type size request.
llvm::TypeSize getDefaultTypeSizeInBits(Type type, const DataLayout &dataLayout, DataLayoutEntryListRef params)
Default handler for the type size in bits request.
uint64_t getDefaultPreferredAlignment(Type type, const DataLayout &dataLayout, ArrayRef< DataLayoutEntryInterface > params)
Default handler for the preferred alignment request.
llvm::TypeSize divideCeil(llvm::TypeSize numerator, uint64_t denominator)
Divides the known min value of the numerator by the denominator and rounds the result up to the next ...
uint64_t getDefaultStackAlignment(DataLayoutEntryInterface entry)
Default handler for the stack alignment request.
Attribute getDefaultGlobalMemorySpace(DataLayoutEntryInterface entry)
Default handler for global memory space request.
Attribute getDefaultMemorySpace(DataLayoutEntryInterface entry)
Default handler for the default memory space request.
LogicalResult verifyDataLayoutOp(Operation *op)
Verifies that the operation implementing the data layout interface, or a module operation,...
LogicalResult verifyDataLayoutSpec(DataLayoutSpecInterface spec, Location loc)
Verifies that a data layout spec is valid.
Attribute getDefaultFunctionPointerAlignment(DataLayoutEntryInterface entry)
Default handler for the function pointer alignment request.
DataLayoutEntryInterface filterEntryForIdentifier(DataLayoutEntryListRef entries, StringAttr id)
Given a list of data layout entries, returns the entry that has the given identifier as key,...
Include the generated interface declarations.
llvm::SmallVector< DataLayoutEntryInterface, 4 > DataLayoutEntryList
llvm::PointerUnion< Type, StringAttr > DataLayoutEntryKey
std::pair< StringAttr, TargetDeviceSpecInterface > TargetDeviceSpecEntry
llvm::ArrayRef< TargetDeviceSpecInterface > TargetDeviceSpecListRef
::llvm::MapVector<::mlir::StringAttr, ::mlir::DataLayoutEntryInterface > DataLayoutIdentifiedEntryMap
llvm::DenseMap< KeyT, ValueT, KeyInfoT, BucketT > DenseMap
llvm::ArrayRef< DataLayoutEntryInterface > DataLayoutEntryListRef