10#undef GET_TYPEDEF_LIST
16#ifdef GET_TYPEDEF_CLASSES
17#undef GET_TYPEDEF_CLASSES
19static ::mlir::OptionalParseResult generatedTypeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type &value) {
20 return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser)
23 return ::mlir::success(!!value);
25 .Default([&](llvm::StringRef keyword, llvm::SMLoc) {
31static ::llvm::LogicalResult generatedTypePrinter(::mlir::Type def, ::mlir::AsmPrinter &printer) {
35 return ::mlir::success();
37 .Default([](
auto) { return ::mlir::failure(); });
44 using KeyTy = std::tuple<::mlir::SymbolRefAttr, ::mlir::ArrayAttr>;
52 return (
nameRef == std::get<0>(tblgenKey)) && (
params == std::get<1>(tblgenKey));
56 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
60 auto nameRef = std::move(std::get<0>(tblgenKey));
61 auto params = std::move(std::get<1>(tblgenKey));
77 const ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError =
nullptr;
80 return Base::get(structName.getContext(), structName, ::mlir::ArrayAttr());
84 return Base::getChecked(emitError, structName.getContext(), structName, ::mlir::ArrayAttr());
88 ::mlir::MLIRContext *ctx = structName.getContext();
92 if(::mlir::failed(paramsRes)) {
return StructType(); }
93 params = ::mlir::ArrayAttr::get(ctx, *paramsRes);
95 return Base::get(ctx, structName, params);
99 ::mlir::MLIRContext *ctx = structName.getContext();
103 if(::mlir::failed(paramsRes)) {
return StructType(); }
104 params = ::mlir::ArrayAttr::get(ctx, *paramsRes);
106 return Base::getChecked(emitError, ctx, structName, params);
110 ::mlir::MLIRContext *ctx = structName.getContext();
113 if(::mlir::failed(paramsRes)) {
return StructType(); }
114 return Base::get(ctx, structName, ::mlir::ArrayAttr::get(ctx, *paramsRes));
117StructType StructType::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::SymbolRefAttr structName, ::llvm::ArrayRef<::mlir::Attribute> paramsRef) {
118 ::mlir::MLIRContext *ctx = structName.getContext();
121 if(::mlir::failed(paramsRes)) {
return StructType(); }
122 return Base::getChecked(emitError, ctx, structName, ::mlir::ArrayAttr::get(ctx, *paramsRes));
125::llvm::LogicalResult
StructType::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::SymbolRefAttr nameRef, ::mlir::ArrayAttr params) {
126 if (::mlir::failed(
verify(emitError, nameRef, params)))
127 return ::mlir::failure();
128 return ::mlir::success();
132 ::mlir::Builder odsBuilder(odsParser.getContext());
133 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
135 ::mlir::FailureOr<::mlir::SymbolRefAttr> _result_nameRef;
136 ::mlir::FailureOr<::mlir::ArrayAttr> _result_params;
138 if (odsParser.parseLess())
return {};
142 if (::mlir::failed(_result_nameRef)) {
143 odsParser.emitError(odsParser.getCurrentLocation(),
"failed to parse LLZK_StructType parameter 'nameRef' which is to be a `::mlir::SymbolRefAttr`");
147 if (odsParser.parseOptionalLess()) {
150 auto odsCustomLoc = odsParser.getCurrentLocation();
153 ::mlir::detail::unwrapForCustomParse(_result_params));
154 if (::mlir::failed(odsCustomResult))
return {};
157 if (odsParser.parseGreater())
return {};
160 if (odsParser.parseGreater())
return {};
161 assert(::mlir::succeeded(_result_nameRef));
162 return odsParser.getChecked<
StructType>(odsLoc, odsParser.getContext(),
163 ::mlir::SymbolRefAttr((*_result_nameRef)),
164 ::mlir::ArrayAttr((_result_params.value_or(::mlir::ArrayAttr()))));
168 ::mlir::Builder odsBuilder(getContext());
170 odsPrinter.printStrippedAttrOrType(
getNameRef());
171 if (!(
getParams() == ::mlir::ArrayAttr())) {
182 return getImpl()->nameRef;
186 return getImpl()->params;
197 ::llvm::SMLoc typeLoc = parser.getCurrentLocation();
198 ::llvm::StringRef mnemonic;
199 ::mlir::Type genType;
200 auto parseResult = generatedTypeParser(parser, &mnemonic, genType);
201 if (parseResult.has_value())
204 parser.emitError(typeLoc) <<
"unknown type `"
205 << mnemonic <<
"` in dialect `" << getNamespace() <<
"`";
210 ::mlir::DialectAsmPrinter &printer)
const {
211 if (::mlir::succeeded(generatedTypePrinter(type, printer)))
void printType(::mlir::Type type, ::mlir::DialectAsmPrinter &os) const override
Print a type registered to this dialect.
::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override
Parse a type registered to this dialect.
::mlir::SymbolRefAttr getNameRef() const
static StructType getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::SymbolRefAttr structName)
void print(::mlir::AsmPrinter &odsPrinter) const
static StructType get(::mlir::SymbolRefAttr structName)
::mlir::Type parse(::mlir::AsmParser &odsParser)
::llvm::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::SymbolRefAttr nameRef, ::mlir::ArrayAttr params)
static constexpr ::llvm::StringLiteral getMnemonic()
::mlir::ArrayAttr getParams() const
::llvm::LogicalResult verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::SymbolRefAttr nameRef, ::mlir::ArrayAttr params)
void printStructParams(AsmPrinter &printer, ArrayAttr value)
ParseResult parseStructParams(AsmParser &parser, ArrayAttr &value)
FailureOr< SmallVector< Attribute > > forceIntAttrTypes(ArrayRef< Attribute > attrList, EmitErrorFn emitError)
std::function< InFlightDiagnosticWrapper()> OwningEmitErrorFn
This type is required in cases like the functions below to take ownership of the lambda so it is not ...
OwningEmitErrorFn wrapNullableInFlightDiagnostic(llvm::function_ref< mlir::InFlightDiagnostic()> emitError, mlir::MLIRContext *ctx)
If the given emitError is non-null, return it.
::mlir::SymbolRefAttr nameRef
::llvm::hash_code hashKey(const KeyTy &tblgenKey)
StructTypeStorage(::mlir::SymbolRefAttr nameRef, ::mlir::ArrayAttr params)
static StructTypeStorage * construct(::mlir::TypeStorageAllocator &allocator, KeyTy &&tblgenKey)
std::tuple<::mlir::SymbolRefAttr, ::mlir::ArrayAttr > KeyTy
bool operator==(const KeyTy &tblgenKey) const