23#include "llvm/ADT/TypeSwitch.h"
24#include "llvm/Support/TypeSize.h"
53 params.push_back(type);
61 params.push_back(type);
68 llvm::interleaveComma(params, p,
93 auto typeOrIntParser = [&]() -> ParseResult {
96 if (intResult.has_value() && !failed(*intResult)) {
98 intParams.push_back(i);
108 typeParams.push_back(t);
116 "failed to parse parameter list for target extension type");
125 if (!typeParams.empty() && !intParams.empty())
142#include "mlir/Dialect/LLVMIR/LLVMTypeInterfaces.cpp.inc"
144#define GET_TYPEDEF_CLASSES
145#include "mlir/Dialect/LLVMIR/LLVMTypes.cpp.inc"
151bool LLVMArrayType::isValidElementType(
Type type) {
152 return !llvm::isa<LLVMVoidType, LLVMLabelType, LLVMMetadataType,
153 LLVMFunctionType, TokenType>(type);
156LLVMArrayType LLVMArrayType::get(
Type elementType, uint64_t numElements) {
157 assert(elementType &&
"expected non-null subtype");
158 return Base::get(elementType.
getContext(), elementType, numElements);
163 Type elementType, uint64_t numElements) {
164 assert(elementType &&
"expected non-null subtype");
171 Type elementType, uint64_t numElements) {
172 if (!isValidElementType(elementType))
173 return emitError() <<
"invalid array element type: " << elementType;
182LLVMArrayType::getTypeSizeInBits(
const DataLayout &dataLayout,
184 return getTypeSize(dataLayout, params) *
kBitsInByte;
187llvm::TypeSize LLVMArrayType::getTypeSize(
const DataLayout &dataLayout,
192uint64_t LLVMArrayType::getABIAlignment(
const DataLayout &dataLayout,
198LLVMArrayType::getPreferredAlignment(
const DataLayout &dataLayout,
208LLVMByteType::getTypeSizeInBits(
const DataLayout &dataLayout,
213uint64_t LLVMByteType::getABIAlignment(
const DataLayout &dataLayout,
221 return emitError() <<
"bitwidth must be greater than 0";
224 constexpr unsigned kMaxBitWidth = 1 << 23;
225 if (bitWidth >= kMaxBitWidth)
226 return emitError() <<
"bitwidth must be less than " << kMaxBitWidth
227 <<
", but got " << bitWidth;
235bool LLVMFunctionType::isValidArgumentType(
Type type) {
236 if (
auto structType = dyn_cast<LLVMStructType>(type))
237 return !structType.isOpaque();
239 return !llvm::isa<LLVMVoidType, LLVMFunctionType>(type);
242bool LLVMFunctionType::isValidResultType(Type type) {
243 return !llvm::isa<LLVMFunctionType, LLVMMetadataType, LLVMLabelType>(type);
246LLVMFunctionType LLVMFunctionType::get(Type
result, ArrayRef<Type> arguments,
248 assert(
result &&
"expected non-null result");
249 return Base::get(
result.getContext(),
result, arguments, isVarArg);
254 Type
result, ArrayRef<Type> arguments,
256 assert(
result &&
"expected non-null result");
261LLVMFunctionType LLVMFunctionType::clone(
TypeRange inputs,
266 if (results.size() > 1)
269 results.empty() ? LLVMVoidType::get(
getContext()) : results[0];
270 if (!isValidResultType(resultType))
272 if (!llvm::all_of(inputs, isValidArgumentType))
274 return get(resultType, llvm::to_vector(inputs), isVarArg());
277ArrayRef<Type> LLVMFunctionType::getReturnTypes()
const {
278 return static_cast<detail::LLVMFunctionTypeStorage *
>(getImpl())->returnType;
283 Type
result, ArrayRef<Type> arguments,
bool) {
284 if (!isValidResultType(
result))
287 for (Type arg : arguments)
288 if (!isValidArgumentType(arg))
289 return emitError() <<
"invalid function argument type: " << arg;
303 auto spec = cast<DenseIntElementsAttr>(attr);
304 auto idx =
static_cast<int64_t>(pos);
305 if (idx >= spec.size())
307 return spec.getValues<uint64_t>()[idx];
314static std::optional<uint64_t>
319 for (DataLayoutEntryInterface entry : params) {
320 if (!entry.isTypeEntry())
322 if (cast<LLVMPointerType>(cast<Type>(entry.getKey())).getAddressSpace() ==
323 type.getAddressSpace()) {
324 currentEntry = entry.getValue();
341 if (type.getAddressSpace() == 0) {
351LLVMPointerType::getTypeSizeInBits(
const DataLayout &dataLayout,
353 if (std::optional<uint64_t> size =
355 return llvm::TypeSize::getFixed(*size);
362uint64_t LLVMPointerType::getABIAlignment(
const DataLayout &dataLayout,
364 if (std::optional<uint64_t> alignment =
372LLVMPointerType::getPreferredAlignment(
const DataLayout &dataLayout,
374 if (std::optional<uint64_t> alignment =
381std::optional<uint64_t>
382LLVMPointerType::getIndexBitwidth(
const DataLayout &dataLayout,
384 if (std::optional<uint64_t> indexBitwidth =
386 return *indexBitwidth;
391bool LLVMPointerType::areCompatible(
393 DataLayoutSpecInterface newSpec,
395 for (DataLayoutEntryInterface newEntry : newLayout) {
396 if (!newEntry.isTypeEntry())
401 llvm::cast<LLVMPointerType>(llvm::cast<Type>(newEntry.getKey()));
403 llvm::find_if(oldLayout, [&](DataLayoutEntryInterface entry) {
404 if (
auto type = llvm::dyn_cast_if_present<Type>(entry.getKey())) {
405 return llvm::cast<LLVMPointerType>(type).getAddressSpace() ==
406 newType.getAddressSpace();
410 if (it == oldLayout.end()) {
411 llvm::find_if(oldLayout, [&](DataLayoutEntryInterface entry) {
412 if (
auto type = llvm::dyn_cast_if_present<Type>(entry.getKey())) {
413 return llvm::cast<LLVMPointerType>(type).getAddressSpace() == 0;
418 if (it != oldLayout.end()) {
423 Attribute newSpec = llvm::cast<DenseIntElementsAttr>(newEntry.getValue());
426 if (size != newSize || abi < newAbi || abi % newAbi != 0)
433 Location loc)
const {
434 for (DataLayoutEntryInterface entry : entries) {
435 if (!entry.isTypeEntry())
437 auto key = llvm::cast<Type>(entry.getKey());
438 auto values = llvm::dyn_cast<DenseIntElementsAttr>(entry.getValue());
439 if (!values || (values.size() != 3 && values.size() != 4)) {
441 <<
"expected layout attribute for " << key
442 <<
" to be a dense integer elements attribute with 3 or 4 "
445 if (!values.getElementType().isInteger(64))
446 return emitError(loc) <<
"expected i64 parameters for " << key;
450 return emitError(loc) <<
"preferred alignment is expected to be at least "
451 "as large as ABI alignment";
461bool LLVMStructType::isValidElementType(Type type) {
462 return !llvm::isa<LLVMVoidType, LLVMLabelType, LLVMMetadataType,
463 LLVMFunctionType, TokenType>(type);
466LLVMStructType LLVMStructType::getIdentified(MLIRContext *context,
468 return Base::get(context, name,
false);
471LLVMStructType LLVMStructType::getIdentifiedChecked(
474 return Base::getChecked(
emitError, context, name,
false);
477LLVMStructType LLVMStructType::getNewIdentified(MLIRContext *context,
479 ArrayRef<Type> elements,
481 std::string stringName = name.str();
482 unsigned counter = 0;
484 auto type = LLVMStructType::getIdentified(context, stringName);
485 if (type.isInitialized() ||
failed(type.setBody(elements, isPacked))) {
487 stringName = (Twine(name) +
"." + std::to_string(counter)).str();
494LLVMStructType LLVMStructType::getLiteral(MLIRContext *context,
495 ArrayRef<Type> types,
bool isPacked) {
496 return Base::get(context, types, isPacked);
501 MLIRContext *context, ArrayRef<Type> types,
503 return Base::getChecked(
emitError, context, types, isPacked);
506LLVMStructType LLVMStructType::getOpaque(StringRef name, MLIRContext *context) {
507 return Base::get(context, name,
true);
512 MLIRContext *context, StringRef name) {
513 return Base::getChecked(
emitError, context, name,
true);
516LogicalResult LLVMStructType::setBody(ArrayRef<Type> types,
bool isPacked) {
517 assert(isIdentified() &&
"can only set bodies of identified structs");
518 assert(llvm::all_of(types, LLVMStructType::isValidElementType) &&
519 "expected valid body types");
520 return Base::mutate(types, isPacked);
523bool LLVMStructType::isPacked()
const {
return getImpl()->isPacked(); }
524bool LLVMStructType::isIdentified()
const {
return getImpl()->isIdentified(); }
525bool LLVMStructType::isOpaque()
const {
526 return getImpl()->isIdentified() &&
527 (getImpl()->isOpaque() || !getImpl()->isInitialized());
529bool LLVMStructType::isInitialized() {
return getImpl()->isInitialized(); }
530StringRef LLVMStructType::getName()
const {
return getImpl()->getIdentifier(); }
531ArrayRef<Type> LLVMStructType::getBody()
const {
532 return isIdentified() ? getImpl()->getIdentifiedStructBody()
533 : getImpl()->getTypeList();
537LLVMStructType::verifyInvariants(
function_ref<InFlightDiagnostic()>, StringRef,
544 ArrayRef<Type> types,
bool) {
546 if (!isValidElementType(t))
547 return emitError() <<
"invalid LLVM structure element type: " << t;
557 LLVMStructType structType,
unsigned index,
558 uint64_t &structAlignment) {
561 for (
auto [i, element] : llvm::enumerate(structType.getBody())) {
564 if (!structType.isPacked()) {
565 offset = llvm::alignTo(offset, elementAlignment);
569 structAlignment = std::max(structAlignment, elementAlignment);
580uint64_t LLVMStructType::getElementOffset(
const DataLayout &dataLayout,
581 unsigned index)
const {
582 assert(index < getBody().size() &&
"expected a valid struct element index");
583 uint64_t structAlignment;
588LLVMStructType::getTypeSizeInBits(
const DataLayout &dataLayout,
590 uint64_t structAlignment;
592 dataLayout, *
this, getBody().size(), structAlignment);
595 structSize = llvm::alignTo(structSize, structAlignment);
596 return llvm::TypeSize::getFixed(structSize *
kBitsInByte);
603static std::optional<uint64_t>
605 StructDLEntryPos pos) {
606 const auto *currentEntry =
607 llvm::find_if(params, [](DataLayoutEntryInterface entry) {
608 return entry.isTypeEntry();
610 if (currentEntry == params.end())
613 auto attr = llvm::cast<DenseIntElementsAttr>(currentEntry->getValue());
614 if (pos == StructDLEntryPos::Preferred &&
615 attr.size() <=
static_cast<int64_t>(StructDLEntryPos::Preferred))
617 pos = StructDLEntryPos::Abi;
619 return attr.getValues<uint64_t>()[
static_cast<size_t>(pos)];
625 StructDLEntryPos pos) {
627 if (pos == StructDLEntryPos::Abi && type.isPacked()) {
633 uint64_t structAlignment = 1;
634 for (
Type iter : type.getBody()) {
640 if (std::optional<uint64_t> entryResult =
642 return std::max(*entryResult /
kBitsInByte, structAlignment);
644 return structAlignment;
647uint64_t LLVMStructType::getABIAlignment(
const DataLayout &dataLayout,
650 StructDLEntryPos::Abi);
654LLVMStructType::getPreferredAlignment(
const DataLayout &dataLayout,
657 StructDLEntryPos::Preferred);
661 return llvm::cast<DenseIntElementsAttr>(attr)
662 .getValues<uint64_t>()[
static_cast<size_t>(pos)];
665bool LLVMStructType::areCompatible(
667 DataLayoutSpecInterface newSpec,
669 for (DataLayoutEntryInterface newEntry : newLayout) {
670 if (!newEntry.isTypeEntry())
673 const auto *previousEntry =
674 llvm::find_if(oldLayout, [](DataLayoutEntryInterface entry) {
675 return entry.isTypeEntry();
677 if (previousEntry == oldLayout.end())
681 StructDLEntryPos::Abi);
684 if (abi < newAbi || abi % newAbi != 0)
691 Location loc)
const {
692 for (DataLayoutEntryInterface entry : entries) {
693 if (!entry.isTypeEntry())
696 auto key = llvm::cast<LLVMStructType>(llvm::cast<Type>(entry.getKey()));
697 auto values = llvm::dyn_cast<DenseIntElementsAttr>(entry.getValue());
698 if (!values || (values.size() != 2 && values.size() != 1)) {
700 <<
"expected layout attribute for "
701 << llvm::cast<Type>(entry.getKey())
702 <<
" to be a dense integer elements attribute of 1 or 2 elements";
704 if (!values.getElementType().isInteger(64))
705 return emitError(loc) <<
"expected i64 entries for " << key;
707 if (key.isIdentified() || !key.getBody().empty()) {
708 return emitError(loc) <<
"unexpected layout attribute for struct " << key;
711 if (values.size() == 1)
716 return emitError(loc) <<
"preferred alignment is expected to be at least "
717 "as large as ABI alignment";
720 return mlir::success();
731bool LLVM::LLVMTargetExtType::hasProperty(Property prop)
const {
733 uint64_t properties = 0;
737 (LLVMTargetExtType::HasZeroInit | LLVM::LLVMTargetExtType::CanBeGlobal);
740 properties |= LLVMTargetExtType::CanBeGlobal;
742 return (properties & prop) == prop;
745bool LLVM::LLVMTargetExtType::supportsMemOps()
const {
760const llvm::fltSemantics &LLVMPPCFP128Type::getFloatSemantics()
const {
761 return APFloat::PPCDoubleDouble();
772 auto ptrTy = dyn_cast<PtrLikeTypeInterface>(type);
775 return !ptrTy.hasPtrMetadata() && ptrTy.getElementType() ==
nullptr &&
776 isa<LLVMAddrSpaceAttrInterface>(ptrTy.getMemorySpace());
806 if (
auto intType = llvm::dyn_cast<IntegerType>(type))
807 return intType.isSignless();
810 if (
auto vecType = llvm::dyn_cast<VectorType>(type))
811 return vecType.getRank() == 1;
817 if (!compatibleTypes.insert(type).second)
820 auto isCompatible = [&](
Type type) {
826 .Case([&](LLVMStructType structType) {
827 return llvm::all_of(structType.getBody(), isCompatible);
829 .Case([&](LLVMFunctionType funcType) {
830 return isCompatible(funcType.getReturnType()) &&
831 llvm::all_of(funcType.getParams(), isCompatible);
833 .Case([](IntegerType intType) {
return intType.isSignless(); })
834 .Case([&](VectorType vecType) {
835 return vecType.getRank() == 1 &&
836 isCompatible(vecType.getElementType());
838 .Case([&](LLVMPointerType pointerType) {
return true; })
839 .Case([&](LLVMTargetExtType extType) {
840 return llvm::all_of(extType.getTypeParams(), isCompatible);
843 .Case([&](LLVMArrayType containerType) {
844 return isCompatible(containerType.getElementType());
860 >([](
Type) {
return true; })
862 .Case<PtrLikeTypeInterface>(
867 compatibleTypes.erase(type);
872bool LLVMDialect::isCompatibleType(
Type type) {
873 if (
auto *llvmDialect =
882 return LLVMDialect::isCompatibleType(type);
888 !isa<LLVM::LLVMVoidType, LLVM::LLVMFunctionType>(type)) &&
890 !(isa<LLVM::LLVMStructType>(type) &&
891 cast<LLVM::LLVMStructType>(type).isOpaque()) &&
893 !(isa<LLVM::LLVMTargetExtType>(type) &&
894 !cast<LLVM::LLVMTargetExtType>(type).supportsMemOps());
898 return llvm::isa<BFloat16Type, Float16Type, Float32Type, Float64Type,
899 Float80Type, Float128Type, LLVMPPCFP128Type>(type);
903 if (
auto vecType = llvm::dyn_cast<VectorType>(type)) {
904 if (vecType.getRank() != 1)
906 Type elementType = vecType.getElementType();
907 if (
auto intType = llvm::dyn_cast<IntegerType>(elementType))
908 return intType.isSignless();
909 return llvm::isa<BFloat16Type, Float16Type, Float32Type, Float64Type,
910 Float80Type, Float128Type, LLVMByteType, LLVMPointerType>(
918 auto vecTy = dyn_cast<VectorType>(type);
919 assert(vecTy &&
"incompatible with LLVM vector type");
920 if (vecTy.isScalable())
921 return llvm::ElementCount::getScalable(vecTy.getNumElements());
922 return llvm::ElementCount::getFixed(vecTy.getNumElements());
926 assert(llvm::isa<VectorType>(vectorType) &&
927 "expected LLVM-compatible vector type");
928 return llvm::cast<VectorType>(vectorType).isScalable();
933 assert(VectorType::isValidElementType(elementType) &&
934 "incompatible element type");
935 return VectorType::get(numElements, elementType, {isScalable});
939 const llvm::ElementCount &numElements) {
940 if (numElements.isScalable())
941 return getVectorType(elementType, numElements.getKnownMinValue(),
943 return getVectorType(elementType, numElements.getFixedValue(),
949 "expected a type compatible with the LLVM dialect");
952 .Case<BFloat16Type, Float16Type>(
953 [](
Type) {
return llvm::TypeSize::getFixed(16); })
954 .Case<Float32Type>([](
Type) {
return llvm::TypeSize::getFixed(32); })
955 .Case<Float64Type>([](
Type) {
return llvm::TypeSize::getFixed(64); })
956 .Case<Float80Type>([](
Type) {
return llvm::TypeSize::getFixed(80); })
957 .Case<Float128Type>([](
Type) {
return llvm::TypeSize::getFixed(128); })
958 .Case([](IntegerType intTy) {
959 return llvm::TypeSize::getFixed(intTy.getWidth());
961 .Case([](LLVMByteType byteTy) {
962 return llvm::TypeSize::getFixed(byteTy.getBitWidth());
964 .Case<LLVMPPCFP128Type>(
965 [](
Type) {
return llvm::TypeSize::getFixed(128); })
966 .Case([](VectorType t) {
968 "unexpected incompatible with LLVM vector type");
969 llvm::TypeSize elementSize =
971 return llvm::TypeSize(elementSize.getFixedValue() * t.getNumElements(),
972 elementSize.isScalable());
974 .Default([](
Type ty) {
976 (llvm::isa<LLVMVoidType, LLVMLabelType, LLVMMetadataType, TokenType,
977 LLVMStructType, LLVMArrayType, LLVMPointerType,
978 LLVMFunctionType, LLVMTargetExtType>(ty)) &&
979 "unexpected missing support for primitive type");
980 return llvm::TypeSize::getFixed(0);
988void LLVMDialect::registerTypes() {
990#define GET_TYPEDEF_LIST
991#include "mlir/Dialect/LLVMIR/LLVMTypes.cpp.inc"
1000void LLVMDialect::printType(Type type, DialectAsmPrinter &os)
const {
static unsigned getBitWidth(Type type)
static int64_t getNumElements(Type t)
Compute the total number of elements in the given type, also taking into account nested types.
constexpr static const uint64_t kDefaultPointerAlignment
static void printExtTypeParams(AsmPrinter &p, ArrayRef< Type > typeParams, ArrayRef< unsigned int > intParams)
constexpr static const uint64_t kDefaultPointerSizeBits
static void printFunctionTypes(AsmPrinter &p, ArrayRef< Type > params, bool isVarArg)
static bool isCompatibleImpl(Type type, DenseSet< Type > &compatibleTypes)
static ParseResult parseExtTypeParams(AsmParser &p, SmallVectorImpl< Type > &typeParams, SmallVectorImpl< unsigned int > &intParams)
Parses the parameter list for a target extension type.
static constexpr llvm::StringRef kSpirvPrefix
static std::optional< uint64_t > getPointerDataLayoutEntry(DataLayoutEntryListRef params, LLVMPointerType type, PtrDLEntryPos pos)
Returns the part of the data layout entry that corresponds to pos for the given type by interpreting ...
static bool isCompatiblePtrType(Type type)
Check whether type is a compatible ptr type.
static OptionalParseResult generatedTypeParser(AsmParser &parser, StringRef *mnemonic, Type &value)
These are unused for now.
static ParseResult parseFunctionTypes(AsmParser &p, SmallVector< Type > ¶ms, bool &isVarArg)
constexpr static const uint64_t kBitsInByte
static constexpr llvm::StringRef kArmSVCount
static constexpr llvm::StringRef kAMDGCNNamedBarrier
static LogicalResult generatedTypePrinter(Type def, AsmPrinter &printer)
static std::optional< uint64_t > getStructDataLayoutEntry(DataLayoutEntryListRef params, LLVMStructType type, StructDLEntryPos pos)
static uint64_t getOffsetAndAlignment(const DataLayout &dataLayout, LLVMStructType structType, unsigned index, uint64_t &structAlignment)
Returns the byte offset of the element of the specified structure at the given index and the strictes...
static uint64_t extractStructSpecValue(Attribute attr, StructDLEntryPos pos)
static uint64_t calculateStructAlignment(const DataLayout &dataLayout, DataLayoutEntryListRef params, LLVMStructType type, StructDLEntryPos pos)
static Type getElementType(Type type, ArrayRef< int32_t > indices, function_ref< InFlightDiagnostic(StringRef)> emitErrorFn)
Walks the given type hierarchy with the given indices, potentially down to component granularity,...
This base class exposes generic asm parser hooks, usable across the various derived parsers.
virtual OptionalParseResult parseOptionalInteger(APInt &result)=0
Parse an optional integer value from the stream.
virtual ParseResult parseCommaSeparatedList(Delimiter delimiter, function_ref< ParseResult()> parseElementFn, StringRef contextMessage=StringRef())=0
Parse a list of comma-separated items with an optional delimiter.
virtual ParseResult parseRParen()=0
Parse a ) token.
virtual InFlightDiagnostic emitError(SMLoc loc, const Twine &message={})=0
Emit a diagnostic at the specified location and return failure.
virtual ParseResult parseOptionalRParen()=0
Parse a ) token if present.
virtual SMLoc getCurrentLocation()=0
Get the location of the next token and store it into the argument.
virtual ParseResult parseOptionalComma()=0
Parse a , token if present.
virtual ParseResult parseOptionalEllipsis()=0
Parse a ... token if present;.
This base class exposes generic asm printer hooks, usable across the various derived printers.
Attributes are known-constant values of operations.
The main mechanism for performing data layout queries.
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 getTypeAllocSize(Type t) const
Returns the offset in bytes between successive objects of the given type in the current scope,...
uint64_t getTypePreferredAlignment(Type t) const
Returns the preferred of the given type in the current scope.
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.
The DialectAsmParser has methods for interacting with the asm parser when parsing attributes and type...
This class represents a diagnostic that is inflight and set to be reported.
Dialect * getLoadedDialect(StringRef name)
Get a registered IR dialect with the given namespace.
This class implements Optional functionality for ParseResult.
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.
void printType(Type type, AsmPrinter &printer)
Prints an LLVM Dialect type.
Type parseType(DialectAsmParser &parser)
Parses an LLVM dialect type.
Type getVectorType(Type elementType, unsigned numElements, bool isScalable=false)
Creates an LLVM dialect-compatible vector type with the given element type and length.
llvm::TypeSize getPrimitiveTypeSizeInBits(Type type)
Returns the size of the given primitive LLVM dialect-compatible type (including vectors) in bits,...
void printPrettyLLVMType(AsmPrinter &p, Type type)
Print any MLIR type or a concise syntax for LLVM types.
bool isLoadableType(Type type)
Returns true if the given type is a loadable type compatible with the LLVM dialect.
bool isScalableVectorType(Type vectorType)
Returns whether a vector type is scalable or not.
ParseResult parsePrettyLLVMType(AsmParser &p, Type &type)
Parse any MLIR type or a concise syntax for LLVM types.
bool isCompatibleVectorType(Type type)
Returns true if the given type is a vector type compatible with the LLVM dialect.
bool isCompatibleOuterType(Type type)
Returns true if the given outer type is compatible with the LLVM dialect without checking its potenti...
PtrDLEntryPos
The positions of different values in the data layout entry for pointers.
std::optional< uint64_t > extractPointerSpecValue(Attribute attr, PtrDLEntryPos pos)
Returns the value that corresponds to named position pos from the data layout entry attr assuming it'...
bool isCompatibleType(Type type)
Returns true if the given type is compatible with the LLVM dialect.
bool isCompatibleFloatingPointType(Type type)
Returns true if the given type is a floating-point type compatible with the LLVM dialect.
llvm::ElementCount getVectorNumElements(Type type)
Returns the element count of any LLVM-compatible vector type.
Include the generated interface declarations.
llvm::DenseSet< ValueT, ValueInfoT > DenseSet
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.
::llvm::MapVector<::mlir::StringAttr, ::mlir::DataLayoutEntryInterface > DataLayoutIdentifiedEntryMap
auto get(MLIRContext *context, Ts &&...params)
Helper method that injects context only if needed, this helps unify some of the attribute constructio...
Type parseType(llvm::StringRef typeStr, MLIRContext *context, size_t *numRead=nullptr, bool isKnownNullTerminated=false)
This parses a single MLIR type to an MLIR context if it was valid.
llvm::ArrayRef< DataLayoutEntryInterface > DataLayoutEntryListRef
llvm::function_ref< Fn > function_ref