15 #include "llvm/ADT/TypeSwitch.h"
16 #include "llvm/Support/MathExtras.h"
28 llvm::raw_string_ostream os(message);
29 os <<
"neither the scoping op nor the type class provide data layout "
32 llvm::report_fatal_error(Twine(message));
40 auto attr = cast<IntegerAttr>(params.front().getValue());
41 return attr.getValue().getZExtValue();
57 if (
auto ctype = dyn_cast<ComplexType>(type)) {
58 Type et = ctype.getElementType();
59 uint64_t innerAlignment =
65 return llvm::alignTo(innerSize, innerAlignment) + innerSize;
69 if (isa<IndexType>(type))
78 if (
auto vecType = dyn_cast<VectorType>(type)) {
79 uint64_t baseSize = vecType.getNumElements() / vecType.getShape().back() *
80 llvm::PowerOf2Ceil(vecType.getShape().back()) *
81 dataLayout.
getTypeSize(vecType.getElementType()) * 8;
85 if (
auto typeInterface = dyn_cast<DataLayoutTypeInterface>(type))
86 return typeInterface.getTypeSizeInBits(dataLayout, params);
91 static DataLayoutEntryInterface
94 assert(!params.empty() &&
"expected non-empty parameter list");
95 std::map<unsigned, DataLayoutEntryInterface> sortedParams;
96 for (DataLayoutEntryInterface entry : params) {
97 sortedParams.insert(std::make_pair(
98 cast<Type>(entry.getKey()).getIntOrFloatBitWidth(), entry));
100 auto iter = sortedParams.lower_bound(intType.getWidth());
101 if (iter == sortedParams.end())
102 iter = std::prev(iter);
111 cast<DenseIntElementsAttr>(entry.getValue()).getValues<uint64_t>();
118 constexpr uint64_t kDefaultSmallIntAlignment = 4u;
119 constexpr
unsigned kSmallIntSize = 64;
120 if (params.empty()) {
121 return intType.getWidth() < kSmallIntSize
122 ? llvm::PowerOf2Ceil(
124 : kDefaultSmallIntAlignment;
133 assert(params.size() <= 1 &&
"at most one data layout entry is expected for "
134 "the singleton floating-point type");
136 return llvm::PowerOf2Ceil(dataLayout.
getTypeSize(fltType).getFixedValue());
145 if (isa<VectorType>(type))
146 return llvm::PowerOf2Ceil(dataLayout.
getTypeSize(type).getKnownMinValue());
148 if (
auto fltType = dyn_cast<FloatType>(type))
152 if (isa<IndexType>(type))
156 if (
auto intType = dyn_cast<IntegerType>(type))
159 if (
auto ctype = dyn_cast<ComplexType>(type))
162 if (
auto typeInterface = dyn_cast<DataLayoutTypeInterface>(type))
163 return typeInterface.getABIAlignment(dataLayout, params);
170 cast<DenseIntElementsAttr>(entry.getValue()).getValues<uint64_t>();
179 return llvm::PowerOf2Ceil(dataLayout.
getTypeSize(intType).getFixedValue());
187 assert(params.size() <= 1 &&
"at most one data layout entry is expected for "
188 "the singleton floating-point type");
198 if (isa<VectorType>(type))
201 if (
auto fltType = dyn_cast<FloatType>(type))
206 if (
auto intType = dyn_cast<IntegerType>(type))
209 if (isa<IndexType>(type)) {
214 if (
auto ctype = dyn_cast<ComplexType>(type))
218 if (
auto typeInterface = dyn_cast<DataLayoutTypeInterface>(type))
219 return typeInterface.getPreferredAlignment(dataLayout, params);
227 if (isa<IndexType>(type))
230 if (
auto typeInterface = dyn_cast<DataLayoutTypeInterface>(type))
231 if (std::optional<uint64_t> indexBitwidth =
232 typeInterface.getIndexBitwidth(dataLayout, params))
233 return *indexBitwidth;
243 if (entry == DataLayoutEntryInterface())
246 return entry.getValue();
256 return entry.getValue();
264 if (entry == DataLayoutEntryInterface()) {
268 return entry.getValue();
274 if (entry == DataLayoutEntryInterface())
277 return entry.getValue();
285 if (entry == DataLayoutEntryInterface()) {
289 return entry.getValue();
297 if (entry == DataLayoutEntryInterface()) {
301 return entry.getValue();
308 if (entry == DataLayoutEntryInterface())
311 auto value = cast<IntegerAttr>(entry.getValue());
312 return value.getValue().getZExtValue();
318 DataLayoutEntryInterface entry) {
319 if (entry == DataLayoutEntryInterface())
321 return entry.getValue();
329 if (entry == DataLayoutEntryInterface())
331 return entry.getValue();
334 std::optional<Attribute>
336 if (entry == DataLayoutEntryInterface())
339 return entry.getValue();
345 return llvm::filter_to_vector<4>(
346 entries, [typeID](DataLayoutEntryInterface entry) {
347 auto type = llvm::dyn_cast_if_present<Type>(entry.getKey());
348 return type && type.getTypeID() == typeID;
352 DataLayoutEntryInterface
355 const auto *it = llvm::find_if(entries, [
id](DataLayoutEntryInterface entry) {
356 if (
auto attr = dyn_cast<StringAttr>(entry.getKey()))
360 return it == entries.end() ? DataLayoutEntryInterface() : *it;
365 .Case<ModuleOp, DataLayoutOpInterface>(
366 [&](
auto op) {
return op.getDataLayoutSpec(); })
367 .DefaultUnreachable(
"expected an op with data layout spec");
372 ModuleOp moduleOp = dyn_cast<ModuleOp>(operation);
375 return moduleOp.getTargetSystemSpec();
377 return TargetSystemSpecInterface();
392 .Case<ModuleOp>([&](ModuleOp op) {
398 if (!op->getParentOp() && !op.getDataLayoutSpec())
400 specs.push_back(op.getDataLayoutSpec());
402 opLocations->push_back(op.getLoc());
404 .Case<DataLayoutOpInterface>([&](DataLayoutOpInterface op) {
405 specs.push_back(op.getDataLayoutSpec());
407 opLocations->push_back(op.getLoc());
418 assert((isa<ModuleOp, DataLayoutOpInterface>(leaf)) &&
419 "expected an op with data layout spec");
430 auto nonNullSpecs = llvm::filter_to_vector<2>(
431 llvm::reverse(specs),
432 [](DataLayoutSpecInterface iface) {
return iface !=
nullptr; });
435 if (DataLayoutSpecInterface current =
getSpec(leaf))
436 return current.combineWith(nonNullSpecs);
437 if (nonNullSpecs.empty())
439 return nonNullSpecs.back().combineWith(
444 DataLayoutSpecInterface spec =
getSpec(op);
454 <<
"data layout does not combine with layouts of enclosing ops";
459 diag.attachNote(loc) <<
"enclosing op with data layout";
466 uint64_t denominator) {
476 template <
typename OpTy>
478 if (!originalLayout) {
479 assert((!op || !op.getDataLayoutSpec()) &&
480 "could not compute layout information for an op (failed to "
481 "combine attributes?)");
490 allocaMemorySpace(std::nullopt), programMemorySpace(std::nullopt),
491 globalMemorySpace(std::nullopt), stackAlignment(std::nullopt) {
492 #if LLVM_ENABLE_ABI_BREAKING_CHECKS
501 allocaMemorySpace(std::nullopt), programMemorySpace(std::nullopt),
502 globalMemorySpace(std::nullopt), stackAlignment(std::nullopt) {
503 #if LLVM_ENABLE_ABI_BREAKING_CHECKS
513 if (
auto module = dyn_cast<ModuleOp>(op))
515 if (
auto iface = dyn_cast<DataLayoutOpInterface>(op))
522 void mlir::DataLayout::checkValid()
const {
523 #if LLVM_ENABLE_ABI_BREAKING_CHECKS
526 assert(specs.size() == layoutStack.size() &&
527 "data layout object used, but no longer valid due to the change in "
528 "number of nested layouts");
529 for (
auto pair : llvm::zip(specs, layoutStack)) {
531 Attribute origLayout = std::get<1>(pair);
532 assert(newLayout == origLayout &&
533 "data layout object used, but no longer valid "
534 "due to the change in layout attributes");
537 assert(((!scope && !this->originalLayout) ||
539 "data layout object used, but no longer valid due to the change in "
546 template <
typename T>
549 auto it = cache.find(t);
550 if (it != cache.end())
553 auto result = cache.try_emplace(t, compute(t));
554 return result.first->second;
559 return cachedLookup<llvm::TypeSize>(t, sizes, [&](
Type ty) {
562 list = originalLayout.getSpecForType(ty.
getTypeID());
563 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
564 return iface.getTypeSize(ty, *
this, list);
571 return cachedLookup<llvm::TypeSize>(t, bitsizes, [&](
Type ty) {
574 list = originalLayout.getSpecForType(ty.
getTypeID());
575 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
576 return iface.getTypeSizeInBits(ty, *
this, list);
583 return cachedLookup<uint64_t>(t, abiAlignments, [&](
Type ty) {
586 list = originalLayout.getSpecForType(ty.
getTypeID());
587 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
588 return iface.getTypeABIAlignment(ty, *
this, list);
595 return cachedLookup<uint64_t>(t, preferredAlignments, [&](
Type ty) {
598 list = originalLayout.getSpecForType(ty.
getTypeID());
599 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
600 return iface.getTypePreferredAlignment(ty, *
this, list);
607 return cachedLookup<std::optional<uint64_t>>(t, indexBitwidths, [&](
Type ty) {
610 list = originalLayout.getSpecForType(ty.getTypeID());
611 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
612 return iface.getIndexBitwidth(ty, *
this, list);
621 DataLayoutEntryInterface entry;
623 entry = originalLayout.getSpecForIdentifier(
624 originalLayout.getEndiannessIdentifier(originalLayout.getContext()));
626 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
627 endianness = iface.getEndianness(entry);
635 if (defaultMemorySpace)
636 return *defaultMemorySpace;
637 DataLayoutEntryInterface entry;
639 entry = originalLayout.getSpecForIdentifier(
640 originalLayout.getDefaultMemorySpaceIdentifier(
641 originalLayout.getContext()));
642 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
643 defaultMemorySpace = iface.getDefaultMemorySpace(entry);
646 return *defaultMemorySpace;
651 if (allocaMemorySpace)
652 return *allocaMemorySpace;
653 DataLayoutEntryInterface entry;
655 entry = originalLayout.getSpecForIdentifier(
656 originalLayout.getAllocaMemorySpaceIdentifier(
657 originalLayout.getContext()));
658 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
659 allocaMemorySpace = iface.getAllocaMemorySpace(entry);
662 return *allocaMemorySpace;
668 return *manglingMode;
669 DataLayoutEntryInterface entry;
671 entry = originalLayout.getSpecForIdentifier(
672 originalLayout.getManglingModeIdentifier(originalLayout.getContext()));
674 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
675 manglingMode = iface.getManglingMode(entry);
678 return *manglingMode;
683 if (programMemorySpace)
684 return *programMemorySpace;
685 DataLayoutEntryInterface entry;
687 entry = originalLayout.getSpecForIdentifier(
688 originalLayout.getProgramMemorySpaceIdentifier(
689 originalLayout.getContext()));
690 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
691 programMemorySpace = iface.getProgramMemorySpace(entry);
694 return *programMemorySpace;
699 if (globalMemorySpace)
700 return *globalMemorySpace;
701 DataLayoutEntryInterface entry;
703 entry = originalLayout.getSpecForIdentifier(
704 originalLayout.getGlobalMemorySpaceIdentifier(
705 originalLayout.getContext()));
706 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
707 globalMemorySpace = iface.getGlobalMemorySpace(entry);
710 return *globalMemorySpace;
716 return *stackAlignment;
717 DataLayoutEntryInterface entry;
719 entry = originalLayout.getSpecForIdentifier(
720 originalLayout.getStackAlignmentIdentifier(
721 originalLayout.getContext()));
722 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
723 stackAlignment = iface.getStackAlignment(entry);
726 return *stackAlignment;
731 if (functionPointerAlignment)
732 return *functionPointerAlignment;
733 DataLayoutEntryInterface entry;
735 entry = originalLayout.getSpecForIdentifier(
736 originalLayout.getFunctionPointerAlignmentIdentifier(
737 originalLayout.getContext()));
738 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
739 functionPointerAlignment = iface.getFunctionPointerAlignment(entry);
741 functionPointerAlignment =
743 return *functionPointerAlignment;
749 return *legalIntWidths;
750 DataLayoutEntryInterface entry;
752 entry = originalLayout.getSpecForIdentifier(
753 originalLayout.getLegalIntWidthsIdentifier(
754 originalLayout.getContext()));
755 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
756 legalIntWidths = iface.getLegalIntWidths(entry);
759 return *legalIntWidths;
763 TargetSystemSpecInterface::DeviceID deviceID,
764 StringAttr propertyName)
const {
766 DataLayoutEntryInterface entry;
767 if (originalTargetSystemDesc) {
768 if (std::optional<TargetDeviceSpecInterface> device =
769 originalTargetSystemDesc.getDeviceSpecForDeviceID(deviceID))
770 entry = device->getSpecForIdentifier(propertyName);
776 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
777 return iface.getDevicePropertyValue(entry);
786 void DataLayoutSpecInterface::bucketEntriesByType(
787 llvm::MapVector<TypeID, DataLayoutEntryList> &types,
788 llvm::MapVector<StringAttr, DataLayoutEntryInterface> &ids) {
789 for (DataLayoutEntryInterface entry : getEntries()) {
790 if (
auto type = llvm::dyn_cast_if_present<Type>(entry.getKey()))
791 types[type.getTypeID()].push_back(entry);
793 ids[llvm::cast<StringAttr>(entry.getKey())] = entry;
800 for (DataLayoutEntryInterface entry : spec.getEntries())
801 if (
failed(entry.verifyEntry(loc)))
806 llvm::MapVector<TypeID, DataLayoutEntryList> types;
807 llvm::MapVector<StringAttr, DataLayoutEntryInterface> ids;
808 spec.bucketEntriesByType(types, ids);
810 for (
const auto &kvp : types) {
811 auto sampleType = cast<Type>(kvp.second.front().getKey());
812 if (isa<IndexType>(sampleType)) {
813 assert(kvp.second.size() == 1 &&
814 "expected one data layout entry for non-parametric 'index' type");
815 if (!isa<IntegerAttr>(kvp.second.front().getValue()))
817 <<
"expected integer attribute in the data layout entry for "
822 if (sampleType.isIntOrFloat()) {
823 for (DataLayoutEntryInterface entry : kvp.second) {
824 auto value = dyn_cast<DenseIntElementsAttr>(entry.getValue());
825 if (!value || !value.getElementType().isSignlessInteger(64)) {
826 emitError(loc) <<
"expected a dense i64 elements attribute in the "
832 auto elements = llvm::to_vector<2>(value.getValues<uint64_t>());
833 unsigned numElements = elements.size();
834 if (numElements < 1 || numElements > 2) {
835 emitError(loc) <<
"expected 1 or 2 elements in the data layout entry "
840 uint64_t abi = elements[0];
841 uint64_t preferred = numElements == 2 ? elements[1] : abi;
842 if (preferred < abi) {
844 <<
"preferred alignment is expected to be greater than or equal "
845 "to the abi alignment in data layout entry "
853 if (isa<BuiltinDialect>(&sampleType.getDialect()))
854 return emitError(loc) <<
"unexpected data layout for a built-in type";
856 auto dlType = dyn_cast<DataLayoutTypeInterface>(sampleType);
859 <<
"data layout specified for a type that does not support it";
860 if (
failed(dlType.verifyEntries(kvp.second, loc)))
864 for (
const auto &kvp : ids) {
865 StringAttr identifier = cast<StringAttr>(kvp.second.getKey());
866 Dialect *dialect = identifier.getReferencedDialect();
873 const auto *iface = dyn_cast<DataLayoutDialectInterface>(dialect);
877 <<
"' dialect does not support identifier data layout entries";
879 if (
failed(iface->verifyEntry(kvp.second, loc)))
891 for (
const auto &entry : spec.getEntries()) {
892 auto targetDeviceSpec =
893 dyn_cast<TargetDeviceSpecInterface>(entry.getValue());
895 if (!targetDeviceSpec)
899 if (
failed(targetDeviceSpec.verifyEntry(loc)))
904 llvm::dyn_cast<TargetSystemSpecInterface::DeviceID>(entry.getKey());
908 if (!deviceIDs.insert(deviceID).second) {
913 for (DataLayoutEntryInterface entry : targetDeviceSpec.getEntries()) {
914 if (
auto type = llvm::dyn_cast_if_present<Type>(entry.getKey())) {
918 deviceDescKeys[cast<StringAttr>(entry.getKey())] = entry;
923 for (
const auto &[keyName, keyVal] : deviceDescKeys) {
924 Dialect *dialect = keyName.getReferencedDialect();
931 const auto *iface = dyn_cast<DataLayoutDialectInterface>(dialect);
935 <<
"' dialect does not support identifier data layout entries";
937 if (
failed(iface->verifyEntry(keyVal, loc)))
944 #include "mlir/Interfaces/DataLayoutAttrInterface.cpp.inc"
945 #include "mlir/Interfaces/DataLayoutOpInterface.cpp.inc"
946 #include "mlir/Interfaces/DataLayoutTypeInterface.cpp.inc"
static uint64_t getIntegerTypePreferredAlignment(IntegerType intType, const DataLayout &dataLayout, ArrayRef< DataLayoutEntryInterface > params)
static DataLayoutSpecInterface getCombinedDataLayout(Operation *leaf)
Returns a layout spec that is a combination of the layout specs attached to the given operation and a...
static TargetSystemSpecInterface getTargetSystemSpec(Operation *operation)
constexpr static const uint64_t kDefaultBitsInByte
static uint64_t getIntegerTypeABIAlignment(IntegerType intType, ArrayRef< DataLayoutEntryInterface > params)
static T cachedLookup(Type t, DenseMap< Type, T > &cache, function_ref< T(Type)> compute)
Looks up the value for the given type key in the given cache.
static uint64_t extractPreferredAlignment(DataLayoutEntryInterface entry)
static void collectParentLayouts(Operation *leaf, SmallVectorImpl< DataLayoutSpecInterface > &specs, SmallVectorImpl< Location > *opLocations=nullptr)
Populates opsWithLayout with the list of proper ancestors of leaf that are either modules or implemen...
static uint64_t getFloatTypePreferredAlignment(FloatType fltType, const DataLayout &dataLayout, ArrayRef< DataLayoutEntryInterface > params)
static uint64_t getFloatTypeABIAlignment(FloatType fltType, const DataLayout &dataLayout, ArrayRef< DataLayoutEntryInterface > params)
static DataLayoutSpecInterface getSpec(Operation *operation)
static uint64_t getIndexBitwidth(DataLayoutEntryListRef params)
Returns the bitwidth of the index type if specified in the param list.
static uint64_t extractABIAlignment(DataLayoutEntryInterface entry)
static DataLayoutEntryInterface findEntryForIntegerType(IntegerType intType, ArrayRef< DataLayoutEntryInterface > params)
void checkMissingLayout(DataLayoutSpecInterface originalLayout, OpTy op)
static void reportMissingDataLayout(Type type)
Reports that the given type is missing the data layout information and exits.
static std::string diag(const llvm::Value &value)
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,...
Dialects are groups of MLIR operations, types and attributes, as well as behavior associated with the...
StringRef getNamespace() const
This class represents a diagnostic that is inflight and set to be reported.
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.
Location getLoc()
The source location the operation was defined or derived from.
Operation * getParentOp()
Returns the closest surrounding operation that contains this operation or nullptr if this is a top-le...
InFlightDiagnostic emitError(const Twine &message={})
Emit an error about fatal conditions with this operation, reporting up to any diagnostic handlers tha...
OpTy getParentOfType()
Return the closest surrounding parent operation that is of type 'OpTy'.
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...
MLIRContext * getContext() const
Return the MLIRContext in which this type was uniqued.
bool isIntOrFloat() const
Return true if this is an integer (of any signedness) or a float type.
TypeID getTypeID()
Return a unique identifier for the concrete type.
unsigned getIntOrFloatBitWidth() const
Return the bit width of an integer or a float type, assert failure on other types.
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.
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...