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(); })
368 llvm_unreachable(
"expected an op with data layout spec");
369 return DataLayoutSpecInterface();
375 ModuleOp moduleOp = dyn_cast<ModuleOp>(operation);
378 return moduleOp.getTargetSystemSpec();
380 return TargetSystemSpecInterface();
395 .Case<ModuleOp>([&](ModuleOp op) {
401 if (!op->getParentOp() && !op.getDataLayoutSpec())
403 specs.push_back(op.getDataLayoutSpec());
405 opLocations->push_back(op.getLoc());
407 .Case<DataLayoutOpInterface>([&](DataLayoutOpInterface op) {
408 specs.push_back(op.getDataLayoutSpec());
410 opLocations->push_back(op.getLoc());
421 assert((isa<ModuleOp, DataLayoutOpInterface>(leaf)) &&
422 "expected an op with data layout spec");
433 auto nonNullSpecs = llvm::filter_to_vector<2>(
434 llvm::reverse(specs),
435 [](DataLayoutSpecInterface iface) {
return iface !=
nullptr; });
438 if (DataLayoutSpecInterface current =
getSpec(leaf))
439 return current.combineWith(nonNullSpecs);
440 if (nonNullSpecs.empty())
442 return nonNullSpecs.back().combineWith(
447 DataLayoutSpecInterface spec =
getSpec(op);
452 if (failed(spec.verifySpec(op->
getLoc())))
457 <<
"data layout does not combine with layouts of enclosing ops";
462 diag.attachNote(loc) <<
"enclosing op with data layout";
469 uint64_t denominator) {
479 template <
typename OpTy>
481 if (!originalLayout) {
482 assert((!op || !op.getDataLayoutSpec()) &&
483 "could not compute layout information for an op (failed to "
484 "combine attributes?)");
493 allocaMemorySpace(std::nullopt), programMemorySpace(std::nullopt),
494 globalMemorySpace(std::nullopt), stackAlignment(std::nullopt) {
495 #if LLVM_ENABLE_ABI_BREAKING_CHECKS
504 allocaMemorySpace(std::nullopt), programMemorySpace(std::nullopt),
505 globalMemorySpace(std::nullopt), stackAlignment(std::nullopt) {
506 #if LLVM_ENABLE_ABI_BREAKING_CHECKS
516 if (
auto module = dyn_cast<ModuleOp>(op))
518 if (
auto iface = dyn_cast<DataLayoutOpInterface>(op))
525 void mlir::DataLayout::checkValid()
const {
526 #if LLVM_ENABLE_ABI_BREAKING_CHECKS
529 assert(specs.size() == layoutStack.size() &&
530 "data layout object used, but no longer valid due to the change in "
531 "number of nested layouts");
532 for (
auto pair : llvm::zip(specs, layoutStack)) {
534 Attribute origLayout = std::get<1>(pair);
535 assert(newLayout == origLayout &&
536 "data layout object used, but no longer valid "
537 "due to the change in layout attributes");
540 assert(((!scope && !this->originalLayout) ||
542 "data layout object used, but no longer valid due to the change in "
549 template <
typename T>
552 auto it = cache.find(t);
553 if (it != cache.end())
556 auto result = cache.try_emplace(t, compute(t));
557 return result.first->second;
562 return cachedLookup<llvm::TypeSize>(t, sizes, [&](
Type ty) {
565 list = originalLayout.getSpecForType(ty.
getTypeID());
566 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
567 return iface.getTypeSize(ty, *
this, list);
574 return cachedLookup<llvm::TypeSize>(t, bitsizes, [&](
Type ty) {
577 list = originalLayout.getSpecForType(ty.
getTypeID());
578 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
579 return iface.getTypeSizeInBits(ty, *
this, list);
586 return cachedLookup<uint64_t>(t, abiAlignments, [&](
Type ty) {
589 list = originalLayout.getSpecForType(ty.
getTypeID());
590 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
591 return iface.getTypeABIAlignment(ty, *
this, list);
598 return cachedLookup<uint64_t>(t, preferredAlignments, [&](
Type ty) {
601 list = originalLayout.getSpecForType(ty.
getTypeID());
602 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
603 return iface.getTypePreferredAlignment(ty, *
this, list);
610 return cachedLookup<std::optional<uint64_t>>(t, indexBitwidths, [&](
Type ty) {
613 list = originalLayout.getSpecForType(ty.getTypeID());
614 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
615 return iface.getIndexBitwidth(ty, *
this, list);
624 DataLayoutEntryInterface entry;
626 entry = originalLayout.getSpecForIdentifier(
627 originalLayout.getEndiannessIdentifier(originalLayout.getContext()));
629 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
630 endianness = iface.getEndianness(entry);
638 if (defaultMemorySpace)
639 return *defaultMemorySpace;
640 DataLayoutEntryInterface entry;
642 entry = originalLayout.getSpecForIdentifier(
643 originalLayout.getDefaultMemorySpaceIdentifier(
644 originalLayout.getContext()));
645 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
646 defaultMemorySpace = iface.getDefaultMemorySpace(entry);
649 return *defaultMemorySpace;
654 if (allocaMemorySpace)
655 return *allocaMemorySpace;
656 DataLayoutEntryInterface entry;
658 entry = originalLayout.getSpecForIdentifier(
659 originalLayout.getAllocaMemorySpaceIdentifier(
660 originalLayout.getContext()));
661 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
662 allocaMemorySpace = iface.getAllocaMemorySpace(entry);
665 return *allocaMemorySpace;
671 return *manglingMode;
672 DataLayoutEntryInterface entry;
674 entry = originalLayout.getSpecForIdentifier(
675 originalLayout.getManglingModeIdentifier(originalLayout.getContext()));
677 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
678 manglingMode = iface.getManglingMode(entry);
681 return *manglingMode;
686 if (programMemorySpace)
687 return *programMemorySpace;
688 DataLayoutEntryInterface entry;
690 entry = originalLayout.getSpecForIdentifier(
691 originalLayout.getProgramMemorySpaceIdentifier(
692 originalLayout.getContext()));
693 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
694 programMemorySpace = iface.getProgramMemorySpace(entry);
697 return *programMemorySpace;
702 if (globalMemorySpace)
703 return *globalMemorySpace;
704 DataLayoutEntryInterface entry;
706 entry = originalLayout.getSpecForIdentifier(
707 originalLayout.getGlobalMemorySpaceIdentifier(
708 originalLayout.getContext()));
709 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
710 globalMemorySpace = iface.getGlobalMemorySpace(entry);
713 return *globalMemorySpace;
719 return *stackAlignment;
720 DataLayoutEntryInterface entry;
722 entry = originalLayout.getSpecForIdentifier(
723 originalLayout.getStackAlignmentIdentifier(
724 originalLayout.getContext()));
725 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
726 stackAlignment = iface.getStackAlignment(entry);
729 return *stackAlignment;
734 if (functionPointerAlignment)
735 return *functionPointerAlignment;
736 DataLayoutEntryInterface entry;
738 entry = originalLayout.getSpecForIdentifier(
739 originalLayout.getFunctionPointerAlignmentIdentifier(
740 originalLayout.getContext()));
741 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
742 functionPointerAlignment = iface.getFunctionPointerAlignment(entry);
744 functionPointerAlignment =
746 return *functionPointerAlignment;
752 return *legalIntWidths;
753 DataLayoutEntryInterface entry;
755 entry = originalLayout.getSpecForIdentifier(
756 originalLayout.getLegalIntWidthsIdentifier(
757 originalLayout.getContext()));
758 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
759 legalIntWidths = iface.getLegalIntWidths(entry);
762 return *legalIntWidths;
766 TargetSystemSpecInterface::DeviceID deviceID,
767 StringAttr propertyName)
const {
769 DataLayoutEntryInterface entry;
770 if (originalTargetSystemDesc) {
771 if (std::optional<TargetDeviceSpecInterface> device =
772 originalTargetSystemDesc.getDeviceSpecForDeviceID(deviceID))
773 entry = device->getSpecForIdentifier(propertyName);
779 if (
auto iface = dyn_cast_or_null<DataLayoutOpInterface>(scope))
780 return iface.getDevicePropertyValue(entry);
789 void DataLayoutSpecInterface::bucketEntriesByType(
790 llvm::MapVector<TypeID, DataLayoutEntryList> &types,
791 llvm::MapVector<StringAttr, DataLayoutEntryInterface> &ids) {
792 for (DataLayoutEntryInterface entry : getEntries()) {
793 if (
auto type = llvm::dyn_cast_if_present<Type>(entry.getKey()))
794 types[type.getTypeID()].push_back(entry);
796 ids[llvm::cast<StringAttr>(entry.getKey())] = entry;
803 for (DataLayoutEntryInterface entry : spec.getEntries())
804 if (failed(entry.verifyEntry(loc)))
809 llvm::MapVector<TypeID, DataLayoutEntryList> types;
810 llvm::MapVector<StringAttr, DataLayoutEntryInterface> ids;
811 spec.bucketEntriesByType(types, ids);
813 for (
const auto &kvp : types) {
814 auto sampleType = cast<Type>(kvp.second.front().getKey());
815 if (isa<IndexType>(sampleType)) {
816 assert(kvp.second.size() == 1 &&
817 "expected one data layout entry for non-parametric 'index' type");
818 if (!isa<IntegerAttr>(kvp.second.front().getValue()))
820 <<
"expected integer attribute in the data layout entry for "
825 if (sampleType.isIntOrFloat()) {
826 for (DataLayoutEntryInterface entry : kvp.second) {
827 auto value = dyn_cast<DenseIntElementsAttr>(entry.getValue());
828 if (!value || !value.getElementType().isSignlessInteger(64)) {
829 emitError(loc) <<
"expected a dense i64 elements attribute in the "
835 auto elements = llvm::to_vector<2>(value.getValues<uint64_t>());
836 unsigned numElements = elements.size();
837 if (numElements < 1 || numElements > 2) {
838 emitError(loc) <<
"expected 1 or 2 elements in the data layout entry "
843 uint64_t abi = elements[0];
844 uint64_t preferred = numElements == 2 ? elements[1] : abi;
845 if (preferred < abi) {
847 <<
"preferred alignment is expected to be greater than or equal "
848 "to the abi alignment in data layout entry "
856 if (isa<BuiltinDialect>(&sampleType.getDialect()))
857 return emitError(loc) <<
"unexpected data layout for a built-in type";
859 auto dlType = dyn_cast<DataLayoutTypeInterface>(sampleType);
862 <<
"data layout specified for a type that does not support it";
863 if (failed(dlType.verifyEntries(kvp.second, loc)))
867 for (
const auto &kvp : ids) {
868 StringAttr identifier = cast<StringAttr>(kvp.second.getKey());
869 Dialect *dialect = identifier.getReferencedDialect();
876 const auto *iface = dyn_cast<DataLayoutDialectInterface>(dialect);
880 <<
"' dialect does not support identifier data layout entries";
882 if (failed(iface->verifyEntry(kvp.second, loc)))
894 for (
const auto &entry : spec.getEntries()) {
895 auto targetDeviceSpec =
896 dyn_cast<TargetDeviceSpecInterface>(entry.getValue());
898 if (!targetDeviceSpec)
902 if (failed(targetDeviceSpec.verifyEntry(loc)))
907 llvm::dyn_cast<TargetSystemSpecInterface::DeviceID>(entry.getKey());
911 if (!deviceIDs.insert(deviceID).second) {
916 for (DataLayoutEntryInterface entry : targetDeviceSpec.getEntries()) {
917 if (
auto type = llvm::dyn_cast_if_present<Type>(entry.getKey())) {
921 deviceDescKeys[cast<StringAttr>(entry.getKey())] = entry;
926 for (
const auto &[keyName, keyVal] : deviceDescKeys) {
927 Dialect *dialect = keyName.getReferencedDialect();
934 const auto *iface = dyn_cast<DataLayoutDialectInterface>(dialect);
938 <<
"' dialect does not support identifier data layout entries";
940 if (failed(iface->verifyEntry(keyVal, loc)))
947 #include "mlir/Interfaces/DataLayoutAttrInterface.cpp.inc"
948 #include "mlir/Interfaces/DataLayoutOpInterface.cpp.inc"
949 #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...