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) {
32 return ::llvm::TypeSwitch<::mlir::Type, ::llvm::LogicalResult>(def) .Case<
::llzk::felt::FeltType>([&](
auto t) {
35 return ::mlir::success();
37 .Default([](
auto) { return ::mlir::failure(); });
45 using KeyTy = std::tuple<::mlir::StringAttr>;
53 return (
fieldName == std::get<0>(tblgenKey));
57 return ::llvm::hash_combine(std::get<0>(tblgenKey));
61 auto fieldName = std::move(std::get<0>(tblgenKey));
70 return Base::get(context, std::move(fieldName));
73FeltType FeltType::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::mlir::StringAttr fieldName) {
74 return Base::getChecked(emitError, context, std::move(fieldName));
78 return Base::get(context, ::mlir::StringAttr());
82 return Base::getChecked(emitError, context, ::mlir::StringAttr());
86 return Base::get(context, ::mlir::StringAttr::get(context, fieldName));
89FeltType FeltType::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::llvm::StringRef fieldName) {
90 return Base::getChecked(emitError, context, ::mlir::StringAttr::get(context, fieldName));
93::llvm::LogicalResult
FeltType::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::StringAttr fieldName) {
94 if (::mlir::failed(
verify(emitError, fieldName)))
95 return ::mlir::failure();
96 return ::mlir::success();
100 ::mlir::Builder odsBuilder(odsParser.getContext());
101 ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation();
103 ::mlir::FailureOr<::mlir::StringAttr> _result_fieldName;
105 if (odsParser.parseOptionalLess()) {
110 if (::mlir::failed(_result_fieldName)) {
111 odsParser.emitError(odsParser.getCurrentLocation(),
"failed to parse LLZK_FeltType parameter 'fieldName' which is to be a `::mlir::StringAttr`");
115 if (odsParser.parseGreater())
return {};
117 return odsParser.getChecked<
FeltType>(odsLoc, odsParser.getContext(),
118 ::mlir::StringAttr((_result_fieldName.value_or(::mlir::StringAttr()))));
122 ::mlir::Builder odsBuilder(getContext());
134 return getImpl()->fieldName;
145 ::llvm::SMLoc typeLoc = parser.getCurrentLocation();
146 ::llvm::StringRef mnemonic;
147 ::mlir::Type genType;
148 auto parseResult = generatedTypeParser(parser, &mnemonic, genType);
149 if (parseResult.has_value())
152 parser.emitError(typeLoc) <<
"unknown type `"
153 << mnemonic <<
"` in dialect `" << getNamespace() <<
"`";
158 ::mlir::DialectAsmPrinter &printer)
const {
159 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.
static constexpr ::llvm::StringLiteral getMnemonic()
::llvm::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::StringAttr fieldName)
static FeltType getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::mlir::StringAttr fieldName)
::llvm::LogicalResult verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::StringAttr fieldName)
::mlir::StringAttr getFieldName() const
::mlir::Type parse(::mlir::AsmParser &odsParser)
void print(::mlir::AsmPrinter &odsPrinter) const
static FeltType get(::mlir::MLIRContext *context, ::mlir::StringAttr fieldName)
Common interface for binary arithmetic operations on felts.
FeltTypeStorage(::mlir::StringAttr fieldName)
::llvm::hash_code hashKey(const KeyTy &tblgenKey)
std::tuple<::mlir::StringAttr > KeyTy
::mlir::StringAttr fieldName
static FeltTypeStorage * construct(::mlir::TypeStorageAllocator &allocator, KeyTy &&tblgenKey)
bool operator==(const KeyTy &tblgenKey) const