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,
185 getTypeSize(dataLayout, params));
188llvm::TypeSize LLVMArrayType::getTypeSize(
const DataLayout &dataLayout,
193uint64_t LLVMArrayType::getABIAlignment(
const DataLayout &dataLayout,
199LLVMArrayType::getPreferredAlignment(
const DataLayout &dataLayout,
209LLVMByteType::getTypeSizeInBits(
const DataLayout &dataLayout,
214uint64_t LLVMByteType::getABIAlignment(
const DataLayout &dataLayout,
222 return emitError() <<
"bitwidth must be greater than 0";
225 constexpr unsigned kMaxBitWidth = 1 << 23;
226 if (bitWidth >= kMaxBitWidth)
227 return emitError() <<
"bitwidth must be less than " << kMaxBitWidth
228 <<
", but got " << bitWidth;
236bool LLVMFunctionType::isValidArgumentType(
Type type) {
237 if (
auto structType = dyn_cast<LLVMStructType>(type))
238 return !structType.isOpaque();
240 return !llvm::isa<LLVMVoidType, LLVMFunctionType>(type);
243bool LLVMFunctionType::isValidResultType(Type type) {
244 return !llvm::isa<LLVMFunctionType, LLVMMetadataType, LLVMLabelType>(type);
247LLVMFunctionType LLVMFunctionType::get(Type
result, ArrayRef<Type> arguments,
249 assert(
result &&
"expected non-null result");
250 return Base::get(
result.getContext(),
result, arguments, isVarArg);
255 Type
result, ArrayRef<Type> arguments,
257 assert(
result &&
"expected non-null result");
262LLVMFunctionType LLVMFunctionType::clone(
TypeRange inputs,
267 if (results.size() > 1)
270 results.empty() ? LLVMVoidType::get(
getContext()) : results[0];
271 if (!isValidResultType(resultType))
273 if (!llvm::all_of(inputs, isValidArgumentType))
275 return get(resultType, llvm::to_vector(inputs), isVarArg());
278ArrayRef<Type> LLVMFunctionType::getReturnTypes()
const {
279 return static_cast<detail::LLVMFunctionTypeStorage *
>(getImpl())->returnType;
284 Type
result, ArrayRef<Type> arguments,
bool) {
285 if (!isValidResultType(
result))
288 for (Type arg : arguments)
289 if (!isValidArgumentType(arg))
290 return emitError() <<
"invalid function argument type: " << arg;
304 auto spec = cast<DenseIntElementsAttr>(attr);
305 auto idx =
static_cast<int64_t>(pos);
306 if (idx >= spec.size())
308 return spec.getValues<uint64_t>()[idx];
315static std::optional<uint64_t>
320 for (DataLayoutEntryInterface entry : params) {
321 if (!entry.isTypeEntry())
323 if (cast<LLVMPointerType>(cast<Type>(entry.getKey())).getAddressSpace() ==
324 type.getAddressSpace()) {
325 currentEntry = entry.getValue();
342 if (type.getAddressSpace() == 0) {
352LLVMPointerType::getTypeSizeInBits(
const DataLayout &dataLayout,
354 if (std::optional<uint64_t> size =
356 return llvm::TypeSize::getFixed(*size);
363uint64_t LLVMPointerType::getABIAlignment(
const DataLayout &dataLayout,
365 if (std::optional<uint64_t> alignment =
373LLVMPointerType::getPreferredAlignment(
const DataLayout &dataLayout,
375 if (std::optional<uint64_t> alignment =
382std::optional<uint64_t>
383LLVMPointerType::getIndexBitwidth(
const DataLayout &dataLayout,
385 if (std::optional<uint64_t> indexBitwidth =
387 return *indexBitwidth;
392bool LLVMPointerType::areCompatible(
394 DataLayoutSpecInterface newSpec,
396 for (DataLayoutEntryInterface newEntry : newLayout) {
397 if (!newEntry.isTypeEntry())
402 llvm::cast<LLVMPointerType>(llvm::cast<Type>(newEntry.getKey()));
404 llvm::find_if(oldLayout, [&](DataLayoutEntryInterface entry) {
405 if (
auto type = llvm::dyn_cast_if_present<Type>(entry.getKey())) {
406 return llvm::cast<LLVMPointerType>(type).getAddressSpace() ==
407 newType.getAddressSpace();
411 if (it == oldLayout.end()) {
412 llvm::find_if(oldLayout, [&](DataLayoutEntryInterface entry) {
413 if (
auto type = llvm::dyn_cast_if_present<Type>(entry.getKey())) {
414 return llvm::cast<LLVMPointerType>(type).getAddressSpace() == 0;
419 if (it != oldLayout.end()) {
424 Attribute newSpec = llvm::cast<DenseIntElementsAttr>(newEntry.getValue());
427 if (size != newSize || abi < newAbi || abi % newAbi != 0)
434 Location loc)
const {
435 for (DataLayoutEntryInterface entry : entries) {
436 if (!entry.isTypeEntry())
438 auto key = llvm::cast<Type>(entry.getKey());
439 auto values = llvm::dyn_cast<DenseIntElementsAttr>(entry.getValue());
440 if (!values || (values.size() != 3 && values.size() != 4)) {
442 <<
"expected layout attribute for " << key
443 <<
" to be a dense integer elements attribute with 3 or 4 "
446 if (!values.getElementType().isInteger(64))
447 return emitError(loc) <<
"expected i64 parameters for " << key;
451 return emitError(loc) <<
"preferred alignment is expected to be at least "
452 "as large as ABI alignment";
462bool LLVMStructType::isValidElementType(Type type) {
463 return !llvm::isa<LLVMVoidType, LLVMLabelType, LLVMMetadataType,
464 LLVMFunctionType, TokenType>(type);
467LLVMStructType LLVMStructType::getIdentified(MLIRContext *context,
469 return Base::get(context, name,
false);
472LLVMStructType LLVMStructType::getIdentifiedChecked(
475 return Base::getChecked(
emitError, context, name,
false);
478LLVMStructType LLVMStructType::getNewIdentified(MLIRContext *context,
480 ArrayRef<Type> elements,
482 std::string stringName = name.str();
483 unsigned counter = 0;
485 auto type = LLVMStructType::getIdentified(context, stringName);
486 if (type.isInitialized() ||
failed(type.setBody(elements, isPacked))) {
488 stringName = (Twine(name) +
"." + std::to_string(counter)).str();
495LLVMStructType LLVMStructType::getLiteral(MLIRContext *context,
496 ArrayRef<Type> types,
bool isPacked) {
497 return Base::get(context, types, isPacked);
502 MLIRContext *context, ArrayRef<Type> types,
504 return Base::getChecked(
emitError, context, types, isPacked);
507LLVMStructType LLVMStructType::getOpaque(StringRef name, MLIRContext *context) {
508 return Base::get(context, name,
true);
513 MLIRContext *context, StringRef name) {
514 return Base::getChecked(
emitError, context, name,
true);
517LogicalResult LLVMStructType::setBody(ArrayRef<Type> types,
bool isPacked) {
518 assert(isIdentified() &&
"can only set bodies of identified structs");
519 assert(llvm::all_of(types, LLVMStructType::isValidElementType) &&
520 "expected valid body types");
521 return Base::mutate(types, isPacked);
524bool LLVMStructType::isPacked()
const {
return getImpl()->isPacked(); }
525bool LLVMStructType::isIdentified()
const {
return getImpl()->isIdentified(); }
526bool LLVMStructType::isOpaque()
const {
527 return getImpl()->isIdentified() &&
528 (getImpl()->isOpaque() || !getImpl()->isInitialized());
530bool LLVMStructType::isInitialized() {
return getImpl()->isInitialized(); }
531StringRef LLVMStructType::getName()
const {
return getImpl()->getIdentifier(); }
532ArrayRef<Type> LLVMStructType::getBody()
const {
533 return isIdentified() ? getImpl()->getIdentifiedStructBody()
534 : getImpl()->getTypeList();
538LLVMStructType::verifyInvariants(
function_ref<InFlightDiagnostic()>, StringRef,
545 ArrayRef<Type> types,
bool) {
547 if (!isValidElementType(t))
548 return emitError() <<
"invalid LLVM structure element type: " << t;
558 LLVMStructType structType,
unsigned index,
559 uint64_t &structAlignment) {
562 for (
auto [i, element] : llvm::enumerate(structType.getBody())) {
565 if (!structType.isPacked()) {
566 offset = llvm::alignTo(offset, elementAlignment);
570 structAlignment = std::max(structAlignment, elementAlignment);
581uint64_t LLVMStructType::getElementOffset(
const DataLayout &dataLayout,
582 unsigned index)
const {
583 assert(index < getBody().size() &&
"expected a valid struct element index");
584 uint64_t structAlignment;
589LLVMStructType::getTypeSizeInBits(
const DataLayout &dataLayout,
591 uint64_t structAlignment;
593 dataLayout, *
this, getBody().size(), structAlignment);
596 structSize = llvm::alignTo(structSize, structAlignment);
597 return llvm::TypeSize::getFixed(structSize *
kBitsInByte);
604static std::optional<uint64_t>
606 StructDLEntryPos pos) {
607 const auto *currentEntry =
608 llvm::find_if(params, [](DataLayoutEntryInterface entry) {
609 return entry.isTypeEntry();
611 if (currentEntry == params.end())
614 auto attr = llvm::cast<DenseIntElementsAttr>(currentEntry->getValue());
615 if (pos == StructDLEntryPos::Preferred &&
616 attr.size() <=
static_cast<int64_t>(StructDLEntryPos::Preferred))
618 pos = StructDLEntryPos::Abi;
620 return attr.getValues<uint64_t>()[
static_cast<size_t>(pos)];
626 StructDLEntryPos pos) {
628 if (pos == StructDLEntryPos::Abi && type.isPacked()) {
634 uint64_t structAlignment = 1;
635 for (
Type iter : type.getBody()) {
641 if (std::optional<uint64_t> entryResult =
643 return std::max(*entryResult /
kBitsInByte, structAlignment);
645 return structAlignment;
648uint64_t LLVMStructType::getABIAlignment(
const DataLayout &dataLayout,
651 StructDLEntryPos::Abi);
655LLVMStructType::getPreferredAlignment(
const DataLayout &dataLayout,
658 StructDLEntryPos::Preferred);
662 return llvm::cast<DenseIntElementsAttr>(attr)
663 .getValues<uint64_t>()[
static_cast<size_t>(pos)];
666bool LLVMStructType::areCompatible(
668 DataLayoutSpecInterface newSpec,
670 for (DataLayoutEntryInterface newEntry : newLayout) {
671 if (!newEntry.isTypeEntry())
674 const auto *previousEntry =
675 llvm::find_if(oldLayout, [](DataLayoutEntryInterface entry) {
676 return entry.isTypeEntry();
678 if (previousEntry == oldLayout.end())
682 StructDLEntryPos::Abi);
685 if (abi < newAbi || abi % newAbi != 0)
692 Location loc)
const {
693 for (DataLayoutEntryInterface entry : entries) {
694 if (!entry.isTypeEntry())
697 auto key = llvm::cast<LLVMStructType>(llvm::cast<Type>(entry.getKey()));
698 auto values = llvm::dyn_cast<DenseIntElementsAttr>(entry.getValue());
699 if (!values || (values.size() != 2 && values.size() != 1)) {
701 <<
"expected layout attribute for "
702 << llvm::cast<Type>(entry.getKey())
703 <<
" to be a dense integer elements attribute of 1 or 2 elements";
705 if (!values.getElementType().isInteger(64))
706 return emitError(loc) <<
"expected i64 entries for " << key;
708 if (key.isIdentified() || !key.getBody().empty()) {
709 return emitError(loc) <<
"unexpected layout attribute for struct " << key;
712 if (values.size() == 1)
717 return emitError(loc) <<
"preferred alignment is expected to be at least "
718 "as large as ABI alignment";
721 return mlir::success();
732bool LLVM::LLVMTargetExtType::hasProperty(Property prop)
const {
734 uint64_t properties = 0;
738 (LLVMTargetExtType::HasZeroInit | LLVM::LLVMTargetExtType::CanBeGlobal);
741 properties |= LLVMTargetExtType::CanBeGlobal;
743 return (properties & prop) == prop;
746bool LLVM::LLVMTargetExtType::supportsMemOps()
const {
761const llvm::fltSemantics &LLVMPPCFP128Type::getFloatSemantics()
const {
762 return APFloat::PPCDoubleDouble();
773 auto ptrTy = dyn_cast<PtrLikeTypeInterface>(type);
776 return !ptrTy.hasPtrMetadata() && ptrTy.getElementType() ==
nullptr &&
777 isa<LLVMAddrSpaceAttrInterface>(ptrTy.getMemorySpace());
807 if (
auto intType = llvm::dyn_cast<IntegerType>(type))
808 return intType.isSignless();
811 if (
auto vecType = llvm::dyn_cast<VectorType>(type))
812 return vecType.getRank() == 1;
818 if (!compatibleTypes.insert(type).second)
821 auto isCompatible = [&](
Type type) {
827 .Case([&](LLVMStructType structType) {
828 return llvm::all_of(structType.getBody(), isCompatible);
830 .Case([&](LLVMFunctionType funcType) {
831 return isCompatible(funcType.getReturnType()) &&
832 llvm::all_of(funcType.getParams(), isCompatible);
834 .Case([](IntegerType intType) {
return intType.isSignless(); })
835 .Case([&](VectorType vecType) {
836 return vecType.getRank() == 1 &&
837 isCompatible(vecType.getElementType());
839 .Case([&](LLVMPointerType pointerType) {
return true; })
840 .Case([&](LLVMTargetExtType extType) {
841 return llvm::all_of(extType.getTypeParams(), isCompatible);
844 .Case([&](LLVMArrayType containerType) {
845 return isCompatible(containerType.getElementType());
861 >([](
Type) {
return true; })
863 .Case<PtrLikeTypeInterface>(
868 compatibleTypes.erase(type);
873bool LLVMDialect::isCompatibleType(
Type type) {
874 if (
auto *llvmDialect =
883 return LLVMDialect::isCompatibleType(type);
889 !isa<LLVM::LLVMVoidType, LLVM::LLVMFunctionType>(type)) &&
891 !(isa<LLVM::LLVMStructType>(type) &&
892 cast<LLVM::LLVMStructType>(type).isOpaque()) &&
894 !(isa<LLVM::LLVMTargetExtType>(type) &&
895 !cast<LLVM::LLVMTargetExtType>(type).supportsMemOps());
899 return llvm::isa<BFloat16Type, Float16Type, Float32Type, Float64Type,
900 Float80Type, Float128Type, LLVMPPCFP128Type>(type);
904 if (
auto vecType = llvm::dyn_cast<VectorType>(type)) {
905 if (vecType.getRank() != 1)
907 Type elementType = vecType.getElementType();
908 if (
auto intType = llvm::dyn_cast<IntegerType>(elementType))
909 return intType.isSignless();
910 return llvm::isa<BFloat16Type, Float16Type, Float32Type, Float64Type,
911 Float80Type, Float128Type, LLVMByteType, LLVMPointerType>(
919 auto vecTy = dyn_cast<VectorType>(type);
920 assert(vecTy &&
"incompatible with LLVM vector type");
921 if (vecTy.isScalable())
922 return llvm::ElementCount::getScalable(vecTy.getNumElements());
923 return llvm::ElementCount::getFixed(vecTy.getNumElements());
927 assert(llvm::isa<VectorType>(vectorType) &&
928 "expected LLVM-compatible vector type");
929 return llvm::cast<VectorType>(vectorType).isScalable();
934 assert(VectorType::isValidElementType(elementType) &&
935 "incompatible element type");
936 return VectorType::get(numElements, elementType, {isScalable});
940 const llvm::ElementCount &numElements) {
941 if (numElements.isScalable())
942 return getVectorType(elementType, numElements.getKnownMinValue(),
944 return getVectorType(elementType, numElements.getFixedValue(),
950 "expected a type compatible with the LLVM dialect");
953 .Case<BFloat16Type, Float16Type>(
954 [](
Type) {
return llvm::TypeSize::getFixed(16); })
955 .Case<Float32Type>([](
Type) {
return llvm::TypeSize::getFixed(32); })
956 .Case<Float64Type>([](
Type) {
return llvm::TypeSize::getFixed(64); })
957 .Case<Float80Type>([](
Type) {
return llvm::TypeSize::getFixed(80); })
958 .Case<Float128Type>([](
Type) {
return llvm::TypeSize::getFixed(128); })
959 .Case([](IntegerType intTy) {
960 return llvm::TypeSize::getFixed(intTy.getWidth());
962 .Case([](LLVMByteType byteTy) {
963 return llvm::TypeSize::getFixed(byteTy.getBitWidth());
965 .Case<LLVMPPCFP128Type>(
966 [](
Type) {
return llvm::TypeSize::getFixed(128); })
967 .Case([](VectorType t) {
969 "unexpected incompatible with LLVM vector type");
970 llvm::TypeSize elementSize =
972 return llvm::TypeSize(elementSize.getFixedValue() * t.getNumElements(),
973 elementSize.isScalable());
975 .Default([](
Type ty) {
977 (llvm::isa<LLVMVoidType, LLVMLabelType, LLVMMetadataType, TokenType,
978 LLVMStructType, LLVMArrayType, LLVMPointerType,
979 LLVMFunctionType, LLVMTargetExtType>(ty)) &&
980 "unexpected missing support for primitive type");
981 return llvm::TypeSize::getFixed(0);
989void LLVMDialect::registerTypes() {
991#define GET_TYPEDEF_LIST
992#include "mlir/Dialect/LLVMIR/LLVMTypes.cpp.inc"
1001void 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