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 ::mlir::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));
70 return Base::get(structName.getContext(), structName, ::mlir::ArrayAttr());
74 return Base::getChecked(emitError, structName.getContext(), structName, ::mlir::ArrayAttr());
78 ::mlir::MLIRContext *ctx = structName.getContext();
82 return Base::get(ctx, structName, params);
86 ::mlir::MLIRContext *ctx = structName.getContext();
90 return Base::getChecked(emitError, ctx, structName, params);
94 ::mlir::MLIRContext *ctx = structName.getContext();
96 return Base::get(ctx, structName, ::mlir::ArrayAttr::get(ctx, p));
99StructType StructType::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::SymbolRefAttr structName, ::llvm::ArrayRef<::mlir::Attribute> paramsRef) {
100 ::mlir::MLIRContext *ctx = structName.getContext();
102 return Base::getChecked(emitError, ctx, structName, ::mlir::ArrayAttr::get(ctx, p));
106 ::mlir::Builder odsBuilder(odsParser.getContext());
107 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
109 ::mlir::FailureOr<::mlir::SymbolRefAttr> _result_nameRef;
110 ::mlir::FailureOr<::mlir::ArrayAttr> _result_params;
112 if (odsParser.parseLess())
return {};
116 if (::mlir::failed(_result_nameRef)) {
117 odsParser.emitError(odsParser.getCurrentLocation(),
"failed to parse LLZK_StructType parameter 'nameRef' which is to be a `::mlir::SymbolRefAttr`");
121 if (odsParser.parseOptionalLess()) {
124 auto odsCustomLoc = odsParser.getCurrentLocation();
127 ::mlir::detail::unwrapForCustomParse(_result_params));
128 if (::mlir::failed(odsCustomResult))
return {};
131 if (odsParser.parseGreater())
return {};
134 if (odsParser.parseGreater())
return {};
135 assert(::mlir::succeeded(_result_nameRef));
136 return odsParser.getChecked<
StructType>(odsLoc, odsParser.getContext(),
137 ::mlir::SymbolRefAttr((*_result_nameRef)),
138 ::mlir::ArrayAttr((_result_params.value_or(::mlir::ArrayAttr()))));
142 ::mlir::Builder odsBuilder(getContext());
144 odsPrinter.printStrippedAttrOrType(
getNameRef());
145 if (!(
getParams() == ::mlir::ArrayAttr())) {
156 return getImpl()->nameRef;
160 return getImpl()->params;
171 ::llvm::SMLoc typeLoc = parser.getCurrentLocation();
172 ::llvm::StringRef mnemonic;
173 ::mlir::Type genType;
174 auto parseResult = generatedTypeParser(parser, &mnemonic, genType);
175 if (parseResult.has_value())
178 parser.emitError(typeLoc) <<
"unknown type `"
179 << mnemonic <<
"` in dialect `" << getNamespace() <<
"`";
184 ::mlir::DialectAsmPrinter &printer)
const {
185 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)
static constexpr ::llvm::StringLiteral getMnemonic()
::mlir::ArrayAttr getParams() const
void printStructParams(AsmPrinter &printer, ArrayAttr value)
ParseResult parseStructParams(AsmParser &parser, ArrayAttr &value)
SmallVector< Attribute > forceIntAttrTypes(ArrayRef< Attribute > attrList)
::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