| 1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
| 2 | |* *| |
| 3 | |* AttrDef Definitions *| |
| 4 | |* *| |
| 5 | |* Automatically generated file, do not edit! *| |
| 6 | |* *| |
| 7 | \*===----------------------------------------------------------------------===*/ |
| 8 | |
| 9 | #ifdef GET_ATTRDEF_LIST |
| 10 | #undef GET_ATTRDEF_LIST |
| 11 | |
| 12 | ::mlir::ptr::AddressAttr, |
| 13 | ::mlir::ptr::GenericSpaceAttr, |
| 14 | ::mlir::ptr::NullAttr, |
| 15 | ::mlir::ptr::SpecAttr |
| 16 | |
| 17 | #endif // GET_ATTRDEF_LIST |
| 18 | |
| 19 | #ifdef GET_ATTRDEF_CLASSES |
| 20 | #undef GET_ATTRDEF_CLASSES |
| 21 | |
| 22 | #include "llvm/ADT/TypeSwitch.h" |
| 23 | #include "mlir/IR/Builders.h" |
| 24 | #include "mlir/IR/DialectImplementation.h" |
| 25 | #include "mlir/IR/OpImplementation.h" |
| 26 | |
| 27 | static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { |
| 28 | return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser, mnemonic) |
| 29 | .Case(::mlir::ptr::AddressAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
| 30 | value = ::mlir::ptr::AddressAttr::parse(parser, type); |
| 31 | return ::mlir::success(!!value); |
| 32 | }) |
| 33 | .Case(::mlir::ptr::GenericSpaceAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
| 34 | value = ::mlir::ptr::GenericSpaceAttr::parse(parser, type); |
| 35 | return ::mlir::success(!!value); |
| 36 | }) |
| 37 | .Case(::mlir::ptr::NullAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
| 38 | value = ::mlir::ptr::NullAttr::parse(parser, type); |
| 39 | return ::mlir::success(!!value); |
| 40 | }) |
| 41 | .Case(::mlir::ptr::SpecAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { |
| 42 | value = ::mlir::ptr::SpecAttr::parse(parser, type); |
| 43 | return ::mlir::success(!!value); |
| 44 | }) |
| 45 | .Default([&](llvm::StringRef keyword, llvm::SMLoc) { |
| 46 | *mnemonic = keyword; |
| 47 | return std::nullopt; |
| 48 | }); |
| 49 | } |
| 50 | |
| 51 | static ::llvm::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { |
| 52 | return ::llvm::TypeSwitch<::mlir::Attribute, ::llvm::LogicalResult>(def) .Case<::mlir::ptr::AddressAttr>([&](auto t) { |
| 53 | printer << ::mlir::ptr::AddressAttr::getMnemonic(); |
| 54 | t.print(printer); |
| 55 | return ::mlir::success(); |
| 56 | }) |
| 57 | .Case<::mlir::ptr::GenericSpaceAttr>([&](auto t) { |
| 58 | printer << ::mlir::ptr::GenericSpaceAttr::getMnemonic(); |
| 59 | t.print(printer); |
| 60 | return ::mlir::success(); |
| 61 | }) |
| 62 | .Case<::mlir::ptr::NullAttr>([&](auto t) { |
| 63 | printer << ::mlir::ptr::NullAttr::getMnemonic(); |
| 64 | t.print(printer); |
| 65 | return ::mlir::success(); |
| 66 | }) |
| 67 | .Case<::mlir::ptr::SpecAttr>([&](auto t) { |
| 68 | printer << ::mlir::ptr::SpecAttr::getMnemonic(); |
| 69 | t.print(printer); |
| 70 | return ::mlir::success(); |
| 71 | }) |
| 72 | .Default([](auto) { return ::mlir::failure(); }); |
| 73 | } |
| 74 | |
| 75 | namespace mlir::ptr { |
| 76 | |
| 77 | namespace detail { |
| 78 | |
| 79 | struct AddressAttrStorage : public ::mlir::AttributeStorage { |
| 80 | using KeyTy = std::tuple<PtrType, ::llvm::APInt>; |
| 81 | AddressAttrStorage(PtrType type, ::llvm::APInt value) : type(std::move(type)), value(std::move(value)) {} |
| 82 | |
| 83 | KeyTy getAsKey() const { |
| 84 | return KeyTy(type, value); |
| 85 | } |
| 86 | |
| 87 | bool operator==(const KeyTy &tblgenKey) const { |
| 88 | return (type == std::get<0>(tblgenKey)) && (value.getBitWidth() == std::get<1>(tblgenKey).getBitWidth() && value == std::get<1>(tblgenKey)); |
| 89 | } |
| 90 | |
| 91 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
| 92 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); |
| 93 | } |
| 94 | |
| 95 | static AddressAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { |
| 96 | auto type = std::move(std::get<0>(tblgenKey)); |
| 97 | auto value = std::move(std::get<1>(tblgenKey)); |
| 98 | return new (allocator.allocate<AddressAttrStorage>()) AddressAttrStorage(std::move(type), std::move(value)); |
| 99 | } |
| 100 | |
| 101 | PtrType type; |
| 102 | ::llvm::APInt value; |
| 103 | }; |
| 104 | |
| 105 | } // namespace detail |
| 106 | AddressAttr AddressAttr::get(::mlir::MLIRContext *context, PtrType type, ::llvm::APInt value) { |
| 107 | return Base::get(context, std::move(type), std::move(value)); |
| 108 | } |
| 109 | |
| 110 | AddressAttr AddressAttr::get(PtrType type, const llvm::APInt &value) { |
| 111 | return Base::get(type.getContext(), type, value); |
| 112 | } |
| 113 | |
| 114 | ::mlir::Attribute AddressAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
| 115 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
| 116 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
| 117 | (void) odsLoc; |
| 118 | ::mlir::FailureOr<PtrType> _result_type; |
| 119 | |
| 120 | if (odsType) { |
| 121 | if (auto reqType = ::llvm::dyn_cast<PtrType>(odsType)) { |
| 122 | _result_type = reqType; |
| 123 | } else { |
| 124 | odsParser.emitError(odsLoc, "invalid kind of type specified" ); |
| 125 | return {}; |
| 126 | } |
| 127 | } else { |
| 128 | odsParser.emitError(odsLoc, "expected a trailing type" ); |
| 129 | return {}; |
| 130 | } |
| 131 | ::mlir::FailureOr<::llvm::APInt> _result_value; |
| 132 | // Parse literal '<' |
| 133 | if (odsParser.parseLess()) return {}; |
| 134 | |
| 135 | // Parse variable 'value' |
| 136 | _result_value = ::mlir::FieldParser<::llvm::APInt>::parse(odsParser); |
| 137 | if (::mlir::failed(_result_value)) { |
| 138 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse Ptr_AddressAttr parameter 'value' which is to be a `::llvm::APInt`" ); |
| 139 | return {}; |
| 140 | } |
| 141 | // Parse literal '>' |
| 142 | if (odsParser.parseGreater()) return {}; |
| 143 | assert(::mlir::succeeded(_result_type)); |
| 144 | assert(::mlir::succeeded(_result_value)); |
| 145 | return AddressAttr::get(odsParser.getContext(), |
| 146 | PtrType((*_result_type)), |
| 147 | ::llvm::APInt((*_result_value))); |
| 148 | } |
| 149 | |
| 150 | void AddressAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
| 151 | ::mlir::Builder odsBuilder(getContext()); |
| 152 | odsPrinter << "<" ; |
| 153 | odsPrinter.printStrippedAttrOrType(getValue()); |
| 154 | odsPrinter << ">" ; |
| 155 | } |
| 156 | |
| 157 | PtrType AddressAttr::getType() const { |
| 158 | return getImpl()->type; |
| 159 | } |
| 160 | |
| 161 | const ::llvm::APInt &AddressAttr::getValue() const { |
| 162 | return getImpl()->value; |
| 163 | } |
| 164 | |
| 165 | |
| 166 | } // namespace mlir::ptr |
| 167 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ptr::AddressAttr) |
| 168 | namespace mlir::ptr { |
| 169 | |
| 170 | ::mlir::Attribute GenericSpaceAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
| 171 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
| 172 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
| 173 | (void) odsLoc; |
| 174 | return GenericSpaceAttr::get(odsParser.getContext()); |
| 175 | } |
| 176 | |
| 177 | void GenericSpaceAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
| 178 | ::mlir::Builder odsBuilder(getContext()); |
| 179 | } |
| 180 | |
| 181 | |
| 182 | } // namespace mlir::ptr |
| 183 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ptr::GenericSpaceAttr) |
| 184 | namespace mlir::ptr { |
| 185 | |
| 186 | namespace detail { |
| 187 | |
| 188 | struct NullAttrStorage : public ::mlir::AttributeStorage { |
| 189 | using KeyTy = std::tuple<PtrType>; |
| 190 | NullAttrStorage(PtrType type) : type(std::move(type)) {} |
| 191 | |
| 192 | KeyTy getAsKey() const { |
| 193 | return KeyTy(type); |
| 194 | } |
| 195 | |
| 196 | bool operator==(const KeyTy &tblgenKey) const { |
| 197 | return (type == std::get<0>(tblgenKey)); |
| 198 | } |
| 199 | |
| 200 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
| 201 | return ::llvm::hash_combine(std::get<0>(tblgenKey)); |
| 202 | } |
| 203 | |
| 204 | static NullAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { |
| 205 | auto type = std::move(std::get<0>(tblgenKey)); |
| 206 | return new (allocator.allocate<NullAttrStorage>()) NullAttrStorage(std::move(type)); |
| 207 | } |
| 208 | |
| 209 | PtrType type; |
| 210 | }; |
| 211 | |
| 212 | } // namespace detail |
| 213 | NullAttr NullAttr::get(::mlir::MLIRContext *context, PtrType type) { |
| 214 | return Base::get(context, std::move(type)); |
| 215 | } |
| 216 | |
| 217 | NullAttr NullAttr::get(PtrType type) { |
| 218 | return Base::get(type.getContext(), type); |
| 219 | } |
| 220 | |
| 221 | ::mlir::Attribute NullAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
| 222 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
| 223 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
| 224 | (void) odsLoc; |
| 225 | ::mlir::FailureOr<PtrType> _result_type; |
| 226 | |
| 227 | if (odsType) { |
| 228 | if (auto reqType = ::llvm::dyn_cast<PtrType>(odsType)) { |
| 229 | _result_type = reqType; |
| 230 | } else { |
| 231 | odsParser.emitError(odsLoc, "invalid kind of type specified" ); |
| 232 | return {}; |
| 233 | } |
| 234 | } else { |
| 235 | odsParser.emitError(odsLoc, "expected a trailing type" ); |
| 236 | return {}; |
| 237 | } |
| 238 | assert(::mlir::succeeded(_result_type)); |
| 239 | return NullAttr::get(odsParser.getContext(), |
| 240 | PtrType((*_result_type))); |
| 241 | } |
| 242 | |
| 243 | void NullAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
| 244 | ::mlir::Builder odsBuilder(getContext()); |
| 245 | } |
| 246 | |
| 247 | PtrType NullAttr::getType() const { |
| 248 | return getImpl()->type; |
| 249 | } |
| 250 | |
| 251 | |
| 252 | } // namespace mlir::ptr |
| 253 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ptr::NullAttr) |
| 254 | namespace mlir::ptr { |
| 255 | |
| 256 | namespace detail { |
| 257 | |
| 258 | struct SpecAttrStorage : public ::mlir::AttributeStorage { |
| 259 | using KeyTy = std::tuple<uint32_t, uint32_t, uint32_t, uint32_t>; |
| 260 | SpecAttrStorage(uint32_t size, uint32_t abi, uint32_t preferred, uint32_t index) : size(std::move(size)), abi(std::move(abi)), preferred(std::move(preferred)), index(std::move(index)) {} |
| 261 | |
| 262 | KeyTy getAsKey() const { |
| 263 | return KeyTy(size, abi, preferred, index); |
| 264 | } |
| 265 | |
| 266 | bool operator==(const KeyTy &tblgenKey) const { |
| 267 | return (size == std::get<0>(tblgenKey)) && (abi == std::get<1>(tblgenKey)) && (preferred == std::get<2>(tblgenKey)) && (index == std::get<3>(tblgenKey)); |
| 268 | } |
| 269 | |
| 270 | static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { |
| 271 | return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); |
| 272 | } |
| 273 | |
| 274 | static SpecAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { |
| 275 | auto size = std::move(std::get<0>(tblgenKey)); |
| 276 | auto abi = std::move(std::get<1>(tblgenKey)); |
| 277 | auto preferred = std::move(std::get<2>(tblgenKey)); |
| 278 | auto index = std::move(std::get<3>(tblgenKey)); |
| 279 | return new (allocator.allocate<SpecAttrStorage>()) SpecAttrStorage(std::move(size), std::move(abi), std::move(preferred), std::move(index)); |
| 280 | } |
| 281 | |
| 282 | uint32_t size; |
| 283 | uint32_t abi; |
| 284 | uint32_t preferred; |
| 285 | uint32_t index; |
| 286 | }; |
| 287 | |
| 288 | } // namespace detail |
| 289 | SpecAttr SpecAttr::get(::mlir::MLIRContext *context, uint32_t size, uint32_t abi, uint32_t preferred, uint32_t index) { |
| 290 | return Base::get(context, size, abi, preferred, index); |
| 291 | } |
| 292 | |
| 293 | SpecAttr SpecAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, uint32_t size, uint32_t abi, uint32_t preferred, uint32_t index) { |
| 294 | return Base::getChecked(emitError, context, size, abi, preferred, index); |
| 295 | } |
| 296 | |
| 297 | ::llvm::LogicalResult SpecAttr::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, uint32_t size, uint32_t abi, uint32_t preferred, uint32_t index) { |
| 298 | if (::mlir::failed(verify(emitError, size, abi, preferred, index))) |
| 299 | return ::mlir::failure(); |
| 300 | return ::mlir::success(); |
| 301 | } |
| 302 | |
| 303 | ::mlir::Attribute SpecAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { |
| 304 | ::mlir::Builder odsBuilder(odsParser.getContext()); |
| 305 | ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); |
| 306 | (void) odsLoc; |
| 307 | ::mlir::FailureOr<uint32_t> _result_size; |
| 308 | ::mlir::FailureOr<uint32_t> _result_abi; |
| 309 | ::mlir::FailureOr<uint32_t> _result_preferred; |
| 310 | ::mlir::FailureOr<uint32_t> _result_index; |
| 311 | // Parse literal '<' |
| 312 | if (odsParser.parseLess()) return {}; |
| 313 | // Parse parameter struct |
| 314 | bool _seen_size = false; |
| 315 | bool _seen_abi = false; |
| 316 | bool _seen_preferred = false; |
| 317 | bool _seen_index = false; |
| 318 | { |
| 319 | const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { |
| 320 | // Parse literal '=' |
| 321 | if (odsParser.parseEqual()) return {}; |
| 322 | if (!_seen_size && _paramKey == "size" ) { |
| 323 | _seen_size = true; |
| 324 | |
| 325 | // Parse variable 'size' |
| 326 | _result_size = ::mlir::FieldParser<uint32_t>::parse(odsParser); |
| 327 | if (::mlir::failed(_result_size)) { |
| 328 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse Ptr_SpecAttr parameter 'size' which is to be a `uint32_t`" ); |
| 329 | return {}; |
| 330 | } |
| 331 | } else if (!_seen_abi && _paramKey == "abi" ) { |
| 332 | _seen_abi = true; |
| 333 | |
| 334 | // Parse variable 'abi' |
| 335 | _result_abi = ::mlir::FieldParser<uint32_t>::parse(odsParser); |
| 336 | if (::mlir::failed(_result_abi)) { |
| 337 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse Ptr_SpecAttr parameter 'abi' which is to be a `uint32_t`" ); |
| 338 | return {}; |
| 339 | } |
| 340 | } else if (!_seen_preferred && _paramKey == "preferred" ) { |
| 341 | _seen_preferred = true; |
| 342 | |
| 343 | // Parse variable 'preferred' |
| 344 | _result_preferred = ::mlir::FieldParser<uint32_t>::parse(odsParser); |
| 345 | if (::mlir::failed(_result_preferred)) { |
| 346 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse Ptr_SpecAttr parameter 'preferred' which is to be a `uint32_t`" ); |
| 347 | return {}; |
| 348 | } |
| 349 | } else if (!_seen_index && _paramKey == "index" ) { |
| 350 | _seen_index = true; |
| 351 | |
| 352 | // Parse variable 'index' |
| 353 | _result_index = ::mlir::FieldParser<uint32_t>::parse(odsParser); |
| 354 | if (::mlir::failed(_result_index)) { |
| 355 | odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse Ptr_SpecAttr parameter 'index' which is to be a `uint32_t`" ); |
| 356 | return {}; |
| 357 | } |
| 358 | } else { |
| 359 | odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: " ) << _paramKey; |
| 360 | return {}; |
| 361 | } |
| 362 | return true; |
| 363 | }; |
| 364 | do { |
| 365 | ::llvm::StringRef _paramKey; |
| 366 | if (odsParser.parseKeyword(&_paramKey)) { |
| 367 | odsParser.emitError(odsParser.getCurrentLocation(), |
| 368 | "expected a parameter name in struct" ); |
| 369 | return {}; |
| 370 | } |
| 371 | if (!_loop_body(_paramKey)) return {}; |
| 372 | } while(!odsParser.parseOptionalComma()); |
| 373 | if (!_seen_size) { |
| 374 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: " ) << "size" ; |
| 375 | return {}; |
| 376 | } |
| 377 | if (!_seen_abi) { |
| 378 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: " ) << "abi" ; |
| 379 | return {}; |
| 380 | } |
| 381 | if (!_seen_preferred) { |
| 382 | odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: " ) << "preferred" ; |
| 383 | return {}; |
| 384 | } |
| 385 | } |
| 386 | // Parse literal '>' |
| 387 | if (odsParser.parseGreater()) return {}; |
| 388 | assert(::mlir::succeeded(_result_size)); |
| 389 | assert(::mlir::succeeded(_result_abi)); |
| 390 | assert(::mlir::succeeded(_result_preferred)); |
| 391 | return odsParser.getChecked<SpecAttr>(odsLoc, odsParser.getContext(), |
| 392 | uint32_t((*_result_size)), |
| 393 | uint32_t((*_result_abi)), |
| 394 | uint32_t((*_result_preferred)), |
| 395 | uint32_t((_result_index.value_or(kOptionalSpecValue)))); |
| 396 | } |
| 397 | |
| 398 | void SpecAttr::print(::mlir::AsmPrinter &odsPrinter) const { |
| 399 | ::mlir::Builder odsBuilder(getContext()); |
| 400 | odsPrinter << "<" ; |
| 401 | { |
| 402 | bool _firstPrinted = true; |
| 403 | if (!_firstPrinted) odsPrinter << ", " ; |
| 404 | _firstPrinted = false; |
| 405 | odsPrinter << "size = " ; |
| 406 | odsPrinter.printStrippedAttrOrType(getSize()); |
| 407 | if (!_firstPrinted) odsPrinter << ", " ; |
| 408 | _firstPrinted = false; |
| 409 | odsPrinter << "abi = " ; |
| 410 | odsPrinter.printStrippedAttrOrType(getAbi()); |
| 411 | if (!_firstPrinted) odsPrinter << ", " ; |
| 412 | _firstPrinted = false; |
| 413 | odsPrinter << "preferred = " ; |
| 414 | odsPrinter.printStrippedAttrOrType(getPreferred()); |
| 415 | if (!(getIndex() == kOptionalSpecValue)) { |
| 416 | if (!_firstPrinted) odsPrinter << ", " ; |
| 417 | _firstPrinted = false; |
| 418 | odsPrinter << "index = " ; |
| 419 | if (!(getIndex() == kOptionalSpecValue)) { |
| 420 | odsPrinter.printStrippedAttrOrType(getIndex()); |
| 421 | } |
| 422 | } |
| 423 | } |
| 424 | odsPrinter << ">" ; |
| 425 | } |
| 426 | |
| 427 | uint32_t SpecAttr::getSize() const { |
| 428 | return getImpl()->size; |
| 429 | } |
| 430 | |
| 431 | uint32_t SpecAttr::getAbi() const { |
| 432 | return getImpl()->abi; |
| 433 | } |
| 434 | |
| 435 | uint32_t SpecAttr::getPreferred() const { |
| 436 | return getImpl()->preferred; |
| 437 | } |
| 438 | |
| 439 | uint32_t SpecAttr::getIndex() const { |
| 440 | return getImpl()->index; |
| 441 | } |
| 442 | |
| 443 | |
| 444 | } // namespace mlir::ptr |
| 445 | MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::ptr::SpecAttr) |
| 446 | namespace mlir::ptr { |
| 447 | |
| 448 | |
| 449 | /// Parse an attribute registered to this dialect. |
| 450 | ::mlir::Attribute PtrDialect::parseAttribute(::mlir::DialectAsmParser &parser, |
| 451 | ::mlir::Type type) const { |
| 452 | ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); |
| 453 | ::llvm::StringRef attrTag; |
| 454 | { |
| 455 | ::mlir::Attribute attr; |
| 456 | auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); |
| 457 | if (parseResult.has_value()) |
| 458 | return attr; |
| 459 | } |
| 460 | |
| 461 | parser.emitError(typeLoc) << "unknown attribute `" |
| 462 | << attrTag << "` in dialect `" << getNamespace() << "`" ; |
| 463 | return {}; |
| 464 | } |
| 465 | /// Print an attribute registered to this dialect. |
| 466 | void PtrDialect::printAttribute(::mlir::Attribute attr, |
| 467 | ::mlir::DialectAsmPrinter &printer) const { |
| 468 | if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) |
| 469 | return; |
| 470 | |
| 471 | } |
| 472 | |
| 473 | } // namespace mlir::ptr |
| 474 | |
| 475 | #endif // GET_ATTRDEF_CLASSES |
| 476 | |
| 477 | |