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,
195uint64_t LLVMArrayType::getABIAlignment(
const DataLayout &dataLayout,
201LLVMArrayType::getPreferredAlignment(
const DataLayout &dataLayout,
211LLVMByteType::getTypeSizeInBits(
const DataLayout &dataLayout,
216uint64_t LLVMByteType::getABIAlignment(
const DataLayout &dataLayout,
224 return emitError() <<
"bitwidth must be greater than 0";
227 constexpr unsigned kMaxBitWidth = 1 << 23;
228 if (bitWidth >= kMaxBitWidth)
229 return emitError() <<
"bitwidth must be less than " << kMaxBitWidth
230 <<
", but got " << bitWidth;
238bool LLVMFunctionType::isValidArgumentType(
Type type) {
239 if (
auto structType = dyn_cast<LLVMStructType>(type))
240 return !structType.isOpaque();
242 return !llvm::isa<LLVMVoidType, LLVMFunctionType>(type);
245bool LLVMFunctionType::isValidResultType(Type type) {
246 return !llvm::isa<LLVMFunctionType, LLVMMetadataType, LLVMLabelType>(type);
249LLVMFunctionType LLVMFunctionType::get(Type
result, ArrayRef<Type> arguments,
251 assert(
result &&
"expected non-null result");
252 return Base::get(
result.getContext(),
result, arguments, isVarArg);
257 Type
result, ArrayRef<Type> arguments,
259 assert(
result &&
"expected non-null result");
264LLVMFunctionType LLVMFunctionType::clone(
TypeRange inputs,
269 if (results.size() > 1)
272 results.empty() ? LLVMVoidType::get(
getContext()) : results[0];
273 if (!isValidResultType(resultType))
275 if (!llvm::all_of(inputs, isValidArgumentType))
277 return get(resultType, llvm::to_vector(inputs), isVarArg());
280ArrayRef<Type> LLVMFunctionType::getReturnTypes()
const {
281 return static_cast<detail::LLVMFunctionTypeStorage *
>(getImpl())->returnType;
286 Type
result, ArrayRef<Type> arguments,
bool) {
287 if (!isValidResultType(
result))
290 for (Type arg : arguments)
291 if (!isValidArgumentType(arg))
292 return emitError() <<
"invalid function argument type: " << arg;
306 auto spec = cast<DenseIntElementsAttr>(attr);
307 auto idx =
static_cast<int64_t>(pos);
308 if (idx >= spec.size())
310 return spec.getValues<uint64_t>()[idx];
317static std::optional<uint64_t>
322 for (DataLayoutEntryInterface entry : params) {
323 if (!entry.isTypeEntry())
325 if (cast<LLVMPointerType>(cast<Type>(entry.getKey())).getAddressSpace() ==
326 type.getAddressSpace()) {
327 currentEntry = entry.getValue();
344 if (type.getAddressSpace() == 0) {
354LLVMPointerType::getTypeSizeInBits(
const DataLayout &dataLayout,
356 if (std::optional<uint64_t> size =
358 return llvm::TypeSize::getFixed(*size);
365uint64_t LLVMPointerType::getABIAlignment(
const DataLayout &dataLayout,
367 if (std::optional<uint64_t> alignment =
375LLVMPointerType::getPreferredAlignment(
const DataLayout &dataLayout,
377 if (std::optional<uint64_t> alignment =
384std::optional<uint64_t>
385LLVMPointerType::getIndexBitwidth(
const DataLayout &dataLayout,
387 if (std::optional<uint64_t> indexBitwidth =
389 return *indexBitwidth;
394bool LLVMPointerType::areCompatible(
396 DataLayoutSpecInterface newSpec,
398 for (DataLayoutEntryInterface newEntry : newLayout) {
399 if (!newEntry.isTypeEntry())
404 llvm::cast<LLVMPointerType>(llvm::cast<Type>(newEntry.getKey()));
406 llvm::find_if(oldLayout, [&](DataLayoutEntryInterface entry) {
407 if (
auto type = llvm::dyn_cast_if_present<Type>(entry.getKey())) {
408 return llvm::cast<LLVMPointerType>(type).getAddressSpace() ==
409 newType.getAddressSpace();
413 if (it == oldLayout.end()) {
414 llvm::find_if(oldLayout, [&](DataLayoutEntryInterface entry) {
415 if (
auto type = llvm::dyn_cast_if_present<Type>(entry.getKey())) {
416 return llvm::cast<LLVMPointerType>(type).getAddressSpace() == 0;
421 if (it != oldLayout.end()) {
426 Attribute newSpec = llvm::cast<DenseIntElementsAttr>(newEntry.getValue());
429 if (size != newSize || abi < newAbi || abi % newAbi != 0)
436 Location loc)
const {
437 for (DataLayoutEntryInterface entry : entries) {
438 if (!entry.isTypeEntry())
440 auto key = llvm::cast<Type>(entry.getKey());
441 auto values = llvm::dyn_cast<DenseIntElementsAttr>(entry.getValue());
442 if (!values || (values.size() != 3 && values.size() != 4)) {
444 <<
"expected layout attribute for " << key
445 <<
" to be a dense integer elements attribute with 3 or 4 "
448 if (!values.getElementType().isInteger(64))
449 return emitError(loc) <<
"expected i64 parameters for " << key;
453 return emitError(loc) <<
"preferred alignment is expected to be at least "
454 "as large as ABI alignment";
464bool LLVMStructType::isValidElementType(Type type) {
465 return !llvm::isa<LLVMVoidType, LLVMLabelType, LLVMMetadataType,
466 LLVMFunctionType, TokenType>(type);
469LLVMStructType LLVMStructType::getIdentified(MLIRContext *context,
471 return Base::get(context, name,
false);
474LLVMStructType LLVMStructType::getIdentifiedChecked(
477 return Base::getChecked(
emitError, context, name,
false);
480LLVMStructType LLVMStructType::getNewIdentified(MLIRContext *context,
482 ArrayRef<Type> elements,
484 std::string stringName = name.str();
485 unsigned counter = 0;
487 auto type = LLVMStructType::getIdentified(context, stringName);
488 if (type.isInitialized() ||
failed(type.setBody(elements, isPacked))) {
490 stringName = (Twine(name) +
"." + std::to_string(counter)).str();
497LLVMStructType LLVMStructType::getLiteral(MLIRContext *context,
498 ArrayRef<Type> types,
bool isPacked) {
499 return Base::get(context, types, isPacked);
504 MLIRContext *context, ArrayRef<Type> types,
506 return Base::getChecked(
emitError, context, types, isPacked);
509LLVMStructType LLVMStructType::getOpaque(StringRef name, MLIRContext *context) {
510 return Base::get(context, name,
true);
515 MLIRContext *context, StringRef name) {
516 return Base::getChecked(
emitError, context, name,
true);
519LogicalResult LLVMStructType::setBody(ArrayRef<Type> types,
bool isPacked) {
520 assert(isIdentified() &&
"can only set bodies of identified structs");
521 assert(llvm::all_of(types, LLVMStructType::isValidElementType) &&
522 "expected valid body types");
523 return Base::mutate(types, isPacked);
526bool LLVMStructType::isPacked()
const {
return getImpl()->isPacked(); }
527bool LLVMStructType::isIdentified()
const {
return getImpl()->isIdentified(); }
528bool LLVMStructType::isOpaque()
const {
529 return getImpl()->isIdentified() &&
530 (getImpl()->isOpaque() || !getImpl()->isInitialized());
532bool LLVMStructType::isInitialized() {
return getImpl()->isInitialized(); }
533StringRef LLVMStructType::getName()
const {
return getImpl()->getIdentifier(); }
534ArrayRef<Type> LLVMStructType::getBody()
const {
535 return isIdentified() ? getImpl()->getIdentifiedStructBody()
536 : getImpl()->getTypeList();
540LLVMStructType::verifyInvariants(
function_ref<InFlightDiagnostic()>, StringRef,
547 ArrayRef<Type> types,
bool) {
549 if (!isValidElementType(t))
550 return emitError() <<
"invalid LLVM structure element type: " << t;
556LLVMStructType::getTypeSizeInBits(
const DataLayout &dataLayout,
558 auto structSize = llvm::TypeSize::getFixed(0);
559 uint64_t structAlignment = 1;
560 for (Type element : getBody()) {
561 uint64_t elementAlignment =
564 structSize = llvm::alignTo(structSize, elementAlignment);
566 structSize += llvm::alignTo(dataLayout.
getTypeSize(element),
571 structAlignment = std::max(elementAlignment, structAlignment);
575 structSize = llvm::alignTo(structSize, structAlignment);
583static std::optional<uint64_t>
585 StructDLEntryPos pos) {
586 const auto *currentEntry =
587 llvm::find_if(params, [](DataLayoutEntryInterface entry) {
588 return entry.isTypeEntry();
590 if (currentEntry == params.end())
593 auto attr = llvm::cast<DenseIntElementsAttr>(currentEntry->getValue());
594 if (pos == StructDLEntryPos::Preferred &&
595 attr.size() <=
static_cast<int64_t>(StructDLEntryPos::Preferred))
597 pos = StructDLEntryPos::Abi;
599 return attr.getValues<uint64_t>()[
static_cast<size_t>(pos)];
605 StructDLEntryPos pos) {
607 if (pos == StructDLEntryPos::Abi && type.isPacked()) {
613 uint64_t structAlignment = 1;
614 for (
Type iter : type.getBody()) {
620 if (std::optional<uint64_t> entryResult =
622 return std::max(*entryResult /
kBitsInByte, structAlignment);
624 return structAlignment;
627uint64_t LLVMStructType::getABIAlignment(
const DataLayout &dataLayout,
630 StructDLEntryPos::Abi);
634LLVMStructType::getPreferredAlignment(
const DataLayout &dataLayout,
637 StructDLEntryPos::Preferred);
641 return llvm::cast<DenseIntElementsAttr>(attr)
642 .getValues<uint64_t>()[
static_cast<size_t>(pos)];
645bool LLVMStructType::areCompatible(
647 DataLayoutSpecInterface newSpec,
649 for (DataLayoutEntryInterface newEntry : newLayout) {
650 if (!newEntry.isTypeEntry())
653 const auto *previousEntry =
654 llvm::find_if(oldLayout, [](DataLayoutEntryInterface entry) {
655 return entry.isTypeEntry();
657 if (previousEntry == oldLayout.end())
661 StructDLEntryPos::Abi);
664 if (abi < newAbi || abi % newAbi != 0)
671 Location loc)
const {
672 for (DataLayoutEntryInterface entry : entries) {
673 if (!entry.isTypeEntry())
676 auto key = llvm::cast<LLVMStructType>(llvm::cast<Type>(entry.getKey()));
677 auto values = llvm::dyn_cast<DenseIntElementsAttr>(entry.getValue());
678 if (!values || (values.size() != 2 && values.size() != 1)) {
680 <<
"expected layout attribute for "
681 << llvm::cast<Type>(entry.getKey())
682 <<
" to be a dense integer elements attribute of 1 or 2 elements";
684 if (!values.getElementType().isInteger(64))
685 return emitError(loc) <<
"expected i64 entries for " << key;
687 if (key.isIdentified() || !key.getBody().empty()) {
688 return emitError(loc) <<
"unexpected layout attribute for struct " << key;
691 if (values.size() == 1)
696 return emitError(loc) <<
"preferred alignment is expected to be at least "
697 "as large as ABI alignment";
700 return mlir::success();
711bool LLVM::LLVMTargetExtType::hasProperty(Property prop)
const {
713 uint64_t properties = 0;
717 (LLVMTargetExtType::HasZeroInit | LLVM::LLVMTargetExtType::CanBeGlobal);
720 properties |= LLVMTargetExtType::CanBeGlobal;
722 return (properties & prop) == prop;
725bool LLVM::LLVMTargetExtType::supportsMemOps()
const {
740const llvm::fltSemantics &LLVMPPCFP128Type::getFloatSemantics()
const {
741 return APFloat::PPCDoubleDouble();
752 auto ptrTy = dyn_cast<PtrLikeTypeInterface>(type);
755 return !ptrTy.hasPtrMetadata() && ptrTy.getElementType() ==
nullptr &&
756 isa<LLVMAddrSpaceAttrInterface>(ptrTy.getMemorySpace());
786 if (
auto intType = llvm::dyn_cast<IntegerType>(type))
787 return intType.isSignless();
790 if (
auto vecType = llvm::dyn_cast<VectorType>(type))
791 return vecType.getRank() == 1;
797 if (!compatibleTypes.insert(type).second)
800 auto isCompatible = [&](
Type type) {
806 .Case([&](LLVMStructType structType) {
807 return llvm::all_of(structType.getBody(), isCompatible);
809 .Case([&](LLVMFunctionType funcType) {
810 return isCompatible(funcType.getReturnType()) &&
811 llvm::all_of(funcType.getParams(), isCompatible);
813 .Case([](IntegerType intType) {
return intType.isSignless(); })
814 .Case([&](VectorType vecType) {
815 return vecType.getRank() == 1 &&
816 isCompatible(vecType.getElementType());
818 .Case([&](LLVMPointerType pointerType) {
return true; })
819 .Case([&](LLVMTargetExtType extType) {
820 return llvm::all_of(extType.getTypeParams(), isCompatible);
823 .Case([&](LLVMArrayType containerType) {
824 return isCompatible(containerType.getElementType());
840 >([](
Type) {
return true; })
842 .Case<PtrLikeTypeInterface>(
847 compatibleTypes.erase(type);
852bool LLVMDialect::isCompatibleType(
Type type) {
853 if (
auto *llvmDialect =
862 return LLVMDialect::isCompatibleType(type);
868 !isa<LLVM::LLVMVoidType, LLVM::LLVMFunctionType>(type)) &&
870 !(isa<LLVM::LLVMStructType>(type) &&
871 cast<LLVM::LLVMStructType>(type).isOpaque()) &&
873 !(isa<LLVM::LLVMTargetExtType>(type) &&
874 !cast<LLVM::LLVMTargetExtType>(type).supportsMemOps());
878 return llvm::isa<BFloat16Type, Float16Type, Float32Type, Float64Type,
879 Float80Type, Float128Type, LLVMPPCFP128Type>(type);
883 if (
auto vecType = llvm::dyn_cast<VectorType>(type)) {
884 if (vecType.getRank() != 1)
886 Type elementType = vecType.getElementType();
887 if (
auto intType = llvm::dyn_cast<IntegerType>(elementType))
888 return intType.isSignless();
889 return llvm::isa<BFloat16Type, Float16Type, Float32Type, Float64Type,
890 Float80Type, Float128Type, LLVMByteType, LLVMPointerType>(
898 auto vecTy = dyn_cast<VectorType>(type);
899 assert(vecTy &&
"incompatible with LLVM vector type");
900 if (vecTy.isScalable())
901 return llvm::ElementCount::getScalable(vecTy.getNumElements());
902 return llvm::ElementCount::getFixed(vecTy.getNumElements());
906 assert(llvm::isa<VectorType>(vectorType) &&
907 "expected LLVM-compatible vector type");
908 return llvm::cast<VectorType>(vectorType).isScalable();
913 assert(VectorType::isValidElementType(elementType) &&
914 "incompatible element type");
915 return VectorType::get(numElements, elementType, {isScalable});
919 const llvm::ElementCount &numElements) {
920 if (numElements.isScalable())
921 return getVectorType(elementType, numElements.getKnownMinValue(),
923 return getVectorType(elementType, numElements.getFixedValue(),
929 "expected a type compatible with the LLVM dialect");
932 .Case<BFloat16Type, Float16Type>(
933 [](
Type) {
return llvm::TypeSize::getFixed(16); })
934 .Case<Float32Type>([](
Type) {
return llvm::TypeSize::getFixed(32); })
935 .Case<Float64Type>([](
Type) {
return llvm::TypeSize::getFixed(64); })
936 .Case<Float80Type>([](
Type) {
return llvm::TypeSize::getFixed(80); })
937 .Case<Float128Type>([](
Type) {
return llvm::TypeSize::getFixed(128); })
938 .Case([](IntegerType intTy) {
939 return llvm::TypeSize::getFixed(intTy.getWidth());
941 .Case([](LLVMByteType byteTy) {
942 return llvm::TypeSize::getFixed(byteTy.getBitWidth());
944 .Case<LLVMPPCFP128Type>(
945 [](
Type) {
return llvm::TypeSize::getFixed(128); })
946 .Case([](VectorType t) {
948 "unexpected incompatible with LLVM vector type");
949 llvm::TypeSize elementSize =
951 return llvm::TypeSize(elementSize.getFixedValue() * t.getNumElements(),
952 elementSize.isScalable());
954 .Default([](
Type ty) {
956 (llvm::isa<LLVMVoidType, LLVMLabelType, LLVMMetadataType, TokenType,
957 LLVMStructType, LLVMArrayType, LLVMPointerType,
958 LLVMFunctionType, LLVMTargetExtType>(ty)) &&
959 "unexpected missing support for primitive type");
960 return llvm::TypeSize::getFixed(0);
968void LLVMDialect::registerTypes() {
970#define GET_TYPEDEF_LIST
971#include "mlir/Dialect/LLVMIR/LLVMTypes.cpp.inc"
980void 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 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 getTypeSize(Type t) const
Returns the size 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