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(); });
45 using KeyTy = std::tuple<::mlir::SymbolRefAttr, ::mlir::ArrayAttr>;
53 return (
nameRef == std::get<0>(tblgenKey)) && (
params == std::get<1>(tblgenKey));
57 return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey));
61 auto nameRef = std::move(std::get<0>(tblgenKey));
62 auto params = std::move(std::get<1>(tblgenKey));
79 const ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError =
nullptr;
82 return Base::get(structName.getContext(), structName, ::mlir::ArrayAttr());
86 return Base::getChecked(emitError, structName.getContext(), structName, ::mlir::ArrayAttr());
90 ::mlir::MLIRContext *ctx = structName.getContext();
94 if(::mlir::failed(paramsRes)) {
return StructType(); }
95 params = ::mlir::ArrayAttr::get(ctx, *paramsRes);
97 return Base::get(ctx, structName, params);
101 ::mlir::MLIRContext *ctx = structName.getContext();
105 if(::mlir::failed(paramsRes)) {
return StructType(); }
106 params = ::mlir::ArrayAttr::get(ctx, *paramsRes);
108 return Base::getChecked(emitError, ctx, structName, params);
112 ::mlir::MLIRContext *ctx = structName.getContext();
115 if(::mlir::failed(paramsRes)) {
return StructType(); }
116 return Base::get(ctx, structName, ::mlir::ArrayAttr::get(ctx, *paramsRes));
119StructType StructType::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::SymbolRefAttr structName, ::llvm::ArrayRef<::mlir::Attribute> paramsRef) {
120 ::mlir::MLIRContext *ctx = structName.getContext();
123 if(::mlir::failed(paramsRes)) {
return StructType(); }
124 return Base::getChecked(emitError, ctx, structName, ::mlir::ArrayAttr::get(ctx, *paramsRes));
127::llvm::LogicalResult
StructType::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::SymbolRefAttr nameRef, ::mlir::ArrayAttr params) {
128 if (::mlir::failed(
verify(emitError, nameRef, params)))
129 return ::mlir::failure();
130 return ::mlir::success();
134 ::mlir::Builder odsBuilder(odsParser.getContext());
135 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
137 ::mlir::FailureOr<::mlir::SymbolRefAttr> _result_nameRef;
138 ::mlir::FailureOr<::mlir::ArrayAttr> _result_params;
140 if (odsParser.parseLess())
return {};
144 if (::mlir::failed(_result_nameRef)) {
145 odsParser.emitError(odsParser.getCurrentLocation(),
"failed to parse LLZK_StructType parameter 'nameRef' which is to be a `::mlir::SymbolRefAttr`");
149 if (odsParser.parseOptionalLess()) {
152 auto odsCustomLoc = odsParser.getCurrentLocation();
155 ::mlir::detail::unwrapForCustomParse(_result_params));
156 if (::mlir::failed(odsCustomResult))
return {};
159 if (odsParser.parseGreater())
return {};
162 if (odsParser.parseGreater())
return {};
163 assert(::mlir::succeeded(_result_nameRef));
164 return odsParser.getChecked<
StructType>(odsLoc, odsParser.getContext(),
165 ::mlir::SymbolRefAttr((*_result_nameRef)),
166 ::mlir::ArrayAttr((_result_params.value_or(::mlir::ArrayAttr()))));
170 ::mlir::Builder odsBuilder(getContext());
172 odsPrinter.printStrippedAttrOrType(
getNameRef());
173 if (!(
getParams() == ::mlir::ArrayAttr())) {
184 return getImpl()->nameRef;
188 return getImpl()->params;
199 ::llvm::SMLoc typeLoc = parser.getCurrentLocation();
200 ::llvm::StringRef mnemonic;
201 ::mlir::Type genType;
202 auto parseResult = generatedTypeParser(parser, &mnemonic, genType);
203 if (parseResult.has_value())
206 parser.emitError(typeLoc) <<
"unknown type `"
207 << mnemonic <<
"` in dialect `" << getNamespace() <<
"`";
212 ::mlir::DialectAsmPrinter &printer)
const {
213 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)
Common interface for operations that read or write from a struct member.
void printTemplateParams(mlir::AsmPrinter &printer, mlir::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 ...
mlir::ParseResult parseTemplateParams(mlir::AsmParser &parser, mlir::ArrayAttr &value)
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