/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* AttrDef Definitions *| |* *| |* Automatically generated file, do not edit! *| |* *| \*===----------------------------------------------------------------------===*/ #ifdef GET_ATTRDEF_LIST #undef GET_ATTRDEF_LIST ::mlir::LLVM::AddressSpaceAttr, ::mlir::LLVM::CConvAttr, ::mlir::LLVM::ComdatAttr, ::mlir::LLVM::LinkageAttr, ::mlir::LLVM::FramePointerKindAttr, ::mlir::LLVM::LoopVectorizeAttr, ::mlir::LLVM::LoopInterleaveAttr, ::mlir::LLVM::LoopUnrollAttr, ::mlir::LLVM::LoopUnrollAndJamAttr, ::mlir::LLVM::LoopLICMAttr, ::mlir::LLVM::LoopDistributeAttr, ::mlir::LLVM::LoopPipelineAttr, ::mlir::LLVM::LoopPeeledAttr, ::mlir::LLVM::LoopUnswitchAttr, ::mlir::LLVM::LoopAnnotationAttr, ::mlir::LLVM::DIExpressionElemAttr, ::mlir::LLVM::DIExpressionAttr, ::mlir::LLVM::DINullTypeAttr, ::mlir::LLVM::DIBasicTypeAttr, ::mlir::LLVM::DICompileUnitAttr, ::mlir::LLVM::DICompositeTypeAttr, ::mlir::LLVM::DIDerivedTypeAttr, ::mlir::LLVM::DIFileAttr, ::mlir::LLVM::DIGlobalVariableExpressionAttr, ::mlir::LLVM::DIGlobalVariableAttr, ::mlir::LLVM::DILexicalBlockAttr, ::mlir::LLVM::DILexicalBlockFileAttr, ::mlir::LLVM::DILocalVariableAttr, ::mlir::LLVM::DISubprogramAttr, ::mlir::LLVM::DIModuleAttr, ::mlir::LLVM::DINamespaceAttr, ::mlir::LLVM::DIImportedEntityAttr, ::mlir::LLVM::DIAnnotationAttr, ::mlir::LLVM::DISubrangeAttr, ::mlir::LLVM::DICommonBlockAttr, ::mlir::LLVM::DIGenericSubrangeAttr, ::mlir::LLVM::DISubroutineTypeAttr, ::mlir::LLVM::DILabelAttr, ::mlir::LLVM::DIStringTypeAttr, ::mlir::LLVM::MemoryEffectsAttr, ::mlir::LLVM::DenormalFPEnvAttr, ::mlir::LLVM::AliasScopeDomainAttr, ::mlir::LLVM::AliasScopeAttr, ::mlir::LLVM::AccessGroupAttr, ::mlir::LLVM::TBAARootAttr, ::mlir::LLVM::TBAAMemberAttr, ::mlir::LLVM::TBAATypeDescriptorAttr, ::mlir::LLVM::TBAATagAttr, ::mlir::LLVM::MMRATagAttr, ::mlir::LLVM::ConstantRangeAttr, ::mlir::LLVM::VScaleRangeAttr, ::mlir::LLVM::TargetFeaturesAttr, ::mlir::LLVM::TargetAttr, ::mlir::LLVM::UndefAttr, ::mlir::LLVM::PoisonAttr, ::mlir::LLVM::DSOLocalEquivalentAttr, ::mlir::LLVM::BlockTagAttr, ::mlir::LLVM::BlockAddressAttr, ::mlir::LLVM::VecTypeHintAttr, ::mlir::LLVM::ZeroAttr, ::mlir::LLVM::TailCallKindAttr, ::mlir::LLVM::WorkgroupAttributionAttr, ::mlir::LLVM::DereferenceableAttr, ::mlir::LLVM::ModuleFlagAttr, ::mlir::LLVM::ModuleFlagCGProfileEntryAttr, ::mlir::LLVM::ModuleFlagProfileSummaryDetailedAttr, ::mlir::LLVM::ModuleFlagProfileSummaryAttr, ::mlir::LLVM::DependentLibrariesAttr, ::mlir::LLVM::UWTableKindAttr, ::mlir::LLVM::MDStringAttr, ::mlir::LLVM::MDConstantAttr, ::mlir::LLVM::MDFuncAttr, ::mlir::LLVM::MDNodeAttr, ::mlir::LLVM::IntegerOverflowFlagsAttr, ::mlir::LLVM::FastmathFlagsAttr #endif // GET_ATTRDEF_LIST #ifdef GET_ATTRDEF_CLASSES #undef GET_ATTRDEF_CLASSES static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) { return ::mlir::AsmParser::KeywordSwitch<::mlir::OptionalParseResult>(parser) .Case(::mlir::LLVM::AddressSpaceAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::AddressSpaceAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::CConvAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::CConvAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::ComdatAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::ComdatAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::LinkageAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::LinkageAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::FramePointerKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::FramePointerKindAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::LoopVectorizeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::LoopVectorizeAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::LoopInterleaveAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::LoopInterleaveAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::LoopUnrollAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::LoopUnrollAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::LoopUnrollAndJamAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::LoopUnrollAndJamAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::LoopLICMAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::LoopLICMAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::LoopDistributeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::LoopDistributeAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::LoopPipelineAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::LoopPipelineAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::LoopPeeledAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::LoopPeeledAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::LoopUnswitchAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::LoopUnswitchAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::LoopAnnotationAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::LoopAnnotationAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DIExpressionElemAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DIExpressionElemAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DIExpressionAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DIExpressionAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DINullTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DINullTypeAttr::get(parser.getContext()); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DIBasicTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DIBasicTypeAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DICompileUnitAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DICompileUnitAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DICompositeTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DICompositeTypeAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DIDerivedTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DIDerivedTypeAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DIFileAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DIFileAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DIGlobalVariableExpressionAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DIGlobalVariableExpressionAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DIGlobalVariableAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DIGlobalVariableAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DILexicalBlockAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DILexicalBlockAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DILexicalBlockFileAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DILexicalBlockFileAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DILocalVariableAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DILocalVariableAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DISubprogramAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DISubprogramAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DIModuleAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DIModuleAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DINamespaceAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DINamespaceAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DIImportedEntityAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DIImportedEntityAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DIAnnotationAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DIAnnotationAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DISubrangeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DISubrangeAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DICommonBlockAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DICommonBlockAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DIGenericSubrangeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DIGenericSubrangeAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DISubroutineTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DISubroutineTypeAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DILabelAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DILabelAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DIStringTypeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DIStringTypeAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::MemoryEffectsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::MemoryEffectsAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DenormalFPEnvAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DenormalFPEnvAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::AliasScopeDomainAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::AliasScopeDomainAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::AliasScopeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::AliasScopeAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::AccessGroupAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::AccessGroupAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::TBAARootAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::TBAARootAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::TBAAMemberAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::TBAAMemberAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::TBAATypeDescriptorAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::TBAATypeDescriptorAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::TBAATagAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::TBAATagAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::MMRATagAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::MMRATagAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::ConstantRangeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::ConstantRangeAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::VScaleRangeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::VScaleRangeAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::TargetFeaturesAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::TargetFeaturesAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::TargetAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::TargetAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::UndefAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::UndefAttr::get(parser.getContext()); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::PoisonAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::PoisonAttr::get(parser.getContext()); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DSOLocalEquivalentAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DSOLocalEquivalentAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::BlockTagAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::BlockTagAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::BlockAddressAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::BlockAddressAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::VecTypeHintAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::VecTypeHintAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::ZeroAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::ZeroAttr::get(parser.getContext()); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::TailCallKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::TailCallKindAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::WorkgroupAttributionAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::WorkgroupAttributionAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DereferenceableAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DereferenceableAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::ModuleFlagAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::ModuleFlagAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::ModuleFlagCGProfileEntryAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::ModuleFlagCGProfileEntryAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::ModuleFlagProfileSummaryDetailedAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::ModuleFlagProfileSummaryDetailedAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::ModuleFlagProfileSummaryAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::ModuleFlagProfileSummaryAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::DependentLibrariesAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::DependentLibrariesAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::UWTableKindAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::UWTableKindAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::MDStringAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::MDStringAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::MDConstantAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::MDConstantAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::MDFuncAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::MDFuncAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::MDNodeAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::MDNodeAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::IntegerOverflowFlagsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::IntegerOverflowFlagsAttr::parse(parser, type); return ::mlir::success(!!value); }) .Case(::mlir::LLVM::FastmathFlagsAttr::getMnemonic(), [&](llvm::StringRef, llvm::SMLoc) { value = ::mlir::LLVM::FastmathFlagsAttr::parse(parser, type); return ::mlir::success(!!value); }) .Default([&](llvm::StringRef keyword, llvm::SMLoc) { *mnemonic = keyword; return std::nullopt; }); } static ::llvm::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) { return ::llvm::TypeSwitch<::mlir::Attribute, ::llvm::LogicalResult>(def) .Case<::mlir::LLVM::AddressSpaceAttr>([&](auto t) { printer << ::mlir::LLVM::AddressSpaceAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::CConvAttr>([&](auto t) { printer << ::mlir::LLVM::CConvAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::ComdatAttr>([&](auto t) { printer << ::mlir::LLVM::ComdatAttr::getMnemonic(); printer << ' '; t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::LinkageAttr>([&](auto t) { printer << ::mlir::LLVM::LinkageAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::FramePointerKindAttr>([&](auto t) { printer << ::mlir::LLVM::FramePointerKindAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::LoopVectorizeAttr>([&](auto t) { printer << ::mlir::LLVM::LoopVectorizeAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::LoopInterleaveAttr>([&](auto t) { printer << ::mlir::LLVM::LoopInterleaveAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::LoopUnrollAttr>([&](auto t) { printer << ::mlir::LLVM::LoopUnrollAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::LoopUnrollAndJamAttr>([&](auto t) { printer << ::mlir::LLVM::LoopUnrollAndJamAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::LoopLICMAttr>([&](auto t) { printer << ::mlir::LLVM::LoopLICMAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::LoopDistributeAttr>([&](auto t) { printer << ::mlir::LLVM::LoopDistributeAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::LoopPipelineAttr>([&](auto t) { printer << ::mlir::LLVM::LoopPipelineAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::LoopPeeledAttr>([&](auto t) { printer << ::mlir::LLVM::LoopPeeledAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::LoopUnswitchAttr>([&](auto t) { printer << ::mlir::LLVM::LoopUnswitchAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::LoopAnnotationAttr>([&](auto t) { printer << ::mlir::LLVM::LoopAnnotationAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DIExpressionElemAttr>([&](auto t) { printer << ::mlir::LLVM::DIExpressionElemAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DIExpressionAttr>([&](auto t) { printer << ::mlir::LLVM::DIExpressionAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DINullTypeAttr>([&](auto t) { printer << ::mlir::LLVM::DINullTypeAttr::getMnemonic(); return ::mlir::success(); }) .Case<::mlir::LLVM::DIBasicTypeAttr>([&](auto t) { printer << ::mlir::LLVM::DIBasicTypeAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DICompileUnitAttr>([&](auto t) { printer << ::mlir::LLVM::DICompileUnitAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DICompositeTypeAttr>([&](auto t) { printer << ::mlir::LLVM::DICompositeTypeAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DIDerivedTypeAttr>([&](auto t) { printer << ::mlir::LLVM::DIDerivedTypeAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DIFileAttr>([&](auto t) { printer << ::mlir::LLVM::DIFileAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DIGlobalVariableExpressionAttr>([&](auto t) { printer << ::mlir::LLVM::DIGlobalVariableExpressionAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DIGlobalVariableAttr>([&](auto t) { printer << ::mlir::LLVM::DIGlobalVariableAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DILexicalBlockAttr>([&](auto t) { printer << ::mlir::LLVM::DILexicalBlockAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DILexicalBlockFileAttr>([&](auto t) { printer << ::mlir::LLVM::DILexicalBlockFileAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DILocalVariableAttr>([&](auto t) { printer << ::mlir::LLVM::DILocalVariableAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DISubprogramAttr>([&](auto t) { printer << ::mlir::LLVM::DISubprogramAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DIModuleAttr>([&](auto t) { printer << ::mlir::LLVM::DIModuleAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DINamespaceAttr>([&](auto t) { printer << ::mlir::LLVM::DINamespaceAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DIImportedEntityAttr>([&](auto t) { printer << ::mlir::LLVM::DIImportedEntityAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DIAnnotationAttr>([&](auto t) { printer << ::mlir::LLVM::DIAnnotationAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DISubrangeAttr>([&](auto t) { printer << ::mlir::LLVM::DISubrangeAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DICommonBlockAttr>([&](auto t) { printer << ::mlir::LLVM::DICommonBlockAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DIGenericSubrangeAttr>([&](auto t) { printer << ::mlir::LLVM::DIGenericSubrangeAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DISubroutineTypeAttr>([&](auto t) { printer << ::mlir::LLVM::DISubroutineTypeAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DILabelAttr>([&](auto t) { printer << ::mlir::LLVM::DILabelAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DIStringTypeAttr>([&](auto t) { printer << ::mlir::LLVM::DIStringTypeAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::MemoryEffectsAttr>([&](auto t) { printer << ::mlir::LLVM::MemoryEffectsAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DenormalFPEnvAttr>([&](auto t) { printer << ::mlir::LLVM::DenormalFPEnvAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::AliasScopeDomainAttr>([&](auto t) { printer << ::mlir::LLVM::AliasScopeDomainAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::AliasScopeAttr>([&](auto t) { printer << ::mlir::LLVM::AliasScopeAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::AccessGroupAttr>([&](auto t) { printer << ::mlir::LLVM::AccessGroupAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::TBAARootAttr>([&](auto t) { printer << ::mlir::LLVM::TBAARootAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::TBAAMemberAttr>([&](auto t) { printer << ::mlir::LLVM::TBAAMemberAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::TBAATypeDescriptorAttr>([&](auto t) { printer << ::mlir::LLVM::TBAATypeDescriptorAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::TBAATagAttr>([&](auto t) { printer << ::mlir::LLVM::TBAATagAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::MMRATagAttr>([&](auto t) { printer << ::mlir::LLVM::MMRATagAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::ConstantRangeAttr>([&](auto t) { printer << ::mlir::LLVM::ConstantRangeAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::VScaleRangeAttr>([&](auto t) { printer << ::mlir::LLVM::VScaleRangeAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::TargetFeaturesAttr>([&](auto t) { printer << ::mlir::LLVM::TargetFeaturesAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::TargetAttr>([&](auto t) { printer << ::mlir::LLVM::TargetAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::UndefAttr>([&](auto t) { printer << ::mlir::LLVM::UndefAttr::getMnemonic(); return ::mlir::success(); }) .Case<::mlir::LLVM::PoisonAttr>([&](auto t) { printer << ::mlir::LLVM::PoisonAttr::getMnemonic(); return ::mlir::success(); }) .Case<::mlir::LLVM::DSOLocalEquivalentAttr>([&](auto t) { printer << ::mlir::LLVM::DSOLocalEquivalentAttr::getMnemonic(); printer << ' '; t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::BlockTagAttr>([&](auto t) { printer << ::mlir::LLVM::BlockTagAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::BlockAddressAttr>([&](auto t) { printer << ::mlir::LLVM::BlockAddressAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::VecTypeHintAttr>([&](auto t) { printer << ::mlir::LLVM::VecTypeHintAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::ZeroAttr>([&](auto t) { printer << ::mlir::LLVM::ZeroAttr::getMnemonic(); return ::mlir::success(); }) .Case<::mlir::LLVM::TailCallKindAttr>([&](auto t) { printer << ::mlir::LLVM::TailCallKindAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::WorkgroupAttributionAttr>([&](auto t) { printer << ::mlir::LLVM::WorkgroupAttributionAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DereferenceableAttr>([&](auto t) { printer << ::mlir::LLVM::DereferenceableAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::ModuleFlagAttr>([&](auto t) { printer << ::mlir::LLVM::ModuleFlagAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::ModuleFlagCGProfileEntryAttr>([&](auto t) { printer << ::mlir::LLVM::ModuleFlagCGProfileEntryAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::ModuleFlagProfileSummaryDetailedAttr>([&](auto t) { printer << ::mlir::LLVM::ModuleFlagProfileSummaryDetailedAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::ModuleFlagProfileSummaryAttr>([&](auto t) { printer << ::mlir::LLVM::ModuleFlagProfileSummaryAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::DependentLibrariesAttr>([&](auto t) { printer << ::mlir::LLVM::DependentLibrariesAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::UWTableKindAttr>([&](auto t) { printer << ::mlir::LLVM::UWTableKindAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::MDStringAttr>([&](auto t) { printer << ::mlir::LLVM::MDStringAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::MDConstantAttr>([&](auto t) { printer << ::mlir::LLVM::MDConstantAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::MDFuncAttr>([&](auto t) { printer << ::mlir::LLVM::MDFuncAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::MDNodeAttr>([&](auto t) { printer << ::mlir::LLVM::MDNodeAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::IntegerOverflowFlagsAttr>([&](auto t) { printer << ::mlir::LLVM::IntegerOverflowFlagsAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Case<::mlir::LLVM::FastmathFlagsAttr>([&](auto t) { printer << ::mlir::LLVM::FastmathFlagsAttr::getMnemonic(); t.print(printer); return ::mlir::success(); }) .Default([](auto) { return ::mlir::failure(); }); } namespace mlir::LLVM { namespace detail { struct AddressSpaceAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; AddressSpaceAttrStorage(unsigned addressSpace) : addressSpace(std::move(addressSpace)) {} KeyTy getAsKey() const { return KeyTy(addressSpace); } bool operator==(const KeyTy &tblgenKey) const { return (addressSpace == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static AddressSpaceAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto addressSpace = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) AddressSpaceAttrStorage(std::move(addressSpace)); } unsigned addressSpace; }; } // namespace detail AddressSpaceAttr AddressSpaceAttr::get(::mlir::MLIRContext *context, unsigned addressSpace) { return Base::get(context, std::move(addressSpace)); } ::mlir::Attribute AddressSpaceAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_addressSpace; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'addressSpace' _result_addressSpace = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_addressSpace)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_AddressSpaceAttr parameter 'addressSpace' which is to be a `unsigned`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_addressSpace)); return AddressSpaceAttr::get(odsParser.getContext(), unsigned((*_result_addressSpace))); } void AddressSpaceAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printStrippedAttrOrType(getAddressSpace()); odsPrinter << ">"; } unsigned AddressSpaceAttr::getAddressSpace() const { return getImpl()->addressSpace; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AddressSpaceAttr) namespace mlir::LLVM { namespace detail { struct CConvAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; CConvAttrStorage(CConv CallingConv) : CallingConv(std::move(CallingConv)) {} KeyTy getAsKey() const { return KeyTy(CallingConv); } bool operator==(const KeyTy &tblgenKey) const { return (CallingConv == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static CConvAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto CallingConv = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) CConvAttrStorage(std::move(CallingConv)); } CConv CallingConv; }; } // namespace detail CConvAttr CConvAttr::get(::mlir::MLIRContext *context, CConv CallingConv) { return Base::get(context, std::move(CallingConv)); } ::mlir::Attribute CConvAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_CallingConv; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'CallingConv' _result_CallingConv = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_CallingConv)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse CConvAttr parameter 'CallingConv' which is to be a `CConv`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_CallingConv)); return CConvAttr::get(odsParser.getContext(), CConv((*_result_CallingConv))); } void CConvAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printStrippedAttrOrType(getCallingConv()); odsPrinter << ">"; } CConv CConvAttr::getCallingConv() const { return getImpl()->CallingConv; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::CConvAttr) namespace mlir::LLVM { namespace detail { struct ComdatAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; ComdatAttrStorage(comdat::Comdat comdat) : comdat(std::move(comdat)) {} KeyTy getAsKey() const { return KeyTy(comdat); } bool operator==(const KeyTy &tblgenKey) const { return (comdat == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static ComdatAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto comdat = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) ComdatAttrStorage(std::move(comdat)); } comdat::Comdat comdat; }; } // namespace detail ComdatAttr ComdatAttr::get(::mlir::MLIRContext *context, comdat::Comdat comdat) { return Base::get(context, std::move(comdat)); } ::mlir::Attribute ComdatAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_comdat; // Parse variable 'comdat' _result_comdat = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_comdat)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ComdatAttr parameter 'comdat' which is to be a `comdat::Comdat`"); return {}; } assert(::mlir::succeeded(_result_comdat)); return ComdatAttr::get(odsParser.getContext(), comdat::Comdat((*_result_comdat))); } void ComdatAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter.printStrippedAttrOrType(getComdat()); } comdat::Comdat ComdatAttr::getComdat() const { return getImpl()->comdat; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ComdatAttr) namespace mlir::LLVM { namespace detail { struct LinkageAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; LinkageAttrStorage(linkage::Linkage linkage) : linkage(std::move(linkage)) {} KeyTy getAsKey() const { return KeyTy(linkage); } bool operator==(const KeyTy &tblgenKey) const { return (linkage == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static LinkageAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto linkage = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) LinkageAttrStorage(std::move(linkage)); } linkage::Linkage linkage; }; } // namespace detail LinkageAttr LinkageAttr::get(::mlir::MLIRContext *context, linkage::Linkage linkage) { return Base::get(context, std::move(linkage)); } ::mlir::Attribute LinkageAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_linkage; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'linkage' _result_linkage = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_linkage)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LinkageAttr parameter 'linkage' which is to be a `linkage::Linkage`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_linkage)); return LinkageAttr::get(odsParser.getContext(), linkage::Linkage((*_result_linkage))); } void LinkageAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printStrippedAttrOrType(getLinkage()); odsPrinter << ">"; } linkage::Linkage LinkageAttr::getLinkage() const { return getImpl()->linkage; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LinkageAttr) namespace mlir::LLVM { namespace detail { struct FramePointerKindAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; FramePointerKindAttrStorage(framePointerKind::FramePointerKind framePointerKind) : framePointerKind(std::move(framePointerKind)) {} KeyTy getAsKey() const { return KeyTy(framePointerKind); } bool operator==(const KeyTy &tblgenKey) const { return (framePointerKind == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static FramePointerKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto framePointerKind = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) FramePointerKindAttrStorage(std::move(framePointerKind)); } framePointerKind::FramePointerKind framePointerKind; }; } // namespace detail FramePointerKindAttr FramePointerKindAttr::get(::mlir::MLIRContext *context, framePointerKind::FramePointerKind framePointerKind) { return Base::get(context, std::move(framePointerKind)); } ::mlir::Attribute FramePointerKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_framePointerKind; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'framePointerKind' _result_framePointerKind = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_framePointerKind)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse FramePointerKindAttr parameter 'framePointerKind' which is to be a `framePointerKind::FramePointerKind`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_framePointerKind)); return FramePointerKindAttr::get(odsParser.getContext(), framePointerKind::FramePointerKind((*_result_framePointerKind))); } void FramePointerKindAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printStrippedAttrOrType(getFramePointerKind()); odsPrinter << ">"; } framePointerKind::FramePointerKind FramePointerKindAttr::getFramePointerKind() const { return getImpl()->framePointerKind; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FramePointerKindAttr) namespace mlir::LLVM { namespace detail { struct LoopVectorizeAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; LoopVectorizeAttrStorage(BoolAttr disable, BoolAttr predicateEnable, BoolAttr scalableEnable, IntegerAttr width, LoopAnnotationAttr followupVectorized, LoopAnnotationAttr followupEpilogue, LoopAnnotationAttr followupAll) : disable(std::move(disable)), predicateEnable(std::move(predicateEnable)), scalableEnable(std::move(scalableEnable)), width(std::move(width)), followupVectorized(std::move(followupVectorized)), followupEpilogue(std::move(followupEpilogue)), followupAll(std::move(followupAll)) {} KeyTy getAsKey() const { return KeyTy(disable, predicateEnable, scalableEnable, width, followupVectorized, followupEpilogue, followupAll); } bool operator==(const KeyTy &tblgenKey) const { return (disable == std::get<0>(tblgenKey)) && (predicateEnable == std::get<1>(tblgenKey)) && (scalableEnable == std::get<2>(tblgenKey)) && (width == std::get<3>(tblgenKey)) && (followupVectorized == std::get<4>(tblgenKey)) && (followupEpilogue == std::get<5>(tblgenKey)) && (followupAll == std::get<6>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey)); } static LoopVectorizeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto disable = std::move(std::get<0>(tblgenKey)); auto predicateEnable = std::move(std::get<1>(tblgenKey)); auto scalableEnable = std::move(std::get<2>(tblgenKey)); auto width = std::move(std::get<3>(tblgenKey)); auto followupVectorized = std::move(std::get<4>(tblgenKey)); auto followupEpilogue = std::move(std::get<5>(tblgenKey)); auto followupAll = std::move(std::get<6>(tblgenKey)); return new (allocator.allocate()) LoopVectorizeAttrStorage(std::move(disable), std::move(predicateEnable), std::move(scalableEnable), std::move(width), std::move(followupVectorized), std::move(followupEpilogue), std::move(followupAll)); } BoolAttr disable; BoolAttr predicateEnable; BoolAttr scalableEnable; IntegerAttr width; LoopAnnotationAttr followupVectorized; LoopAnnotationAttr followupEpilogue; LoopAnnotationAttr followupAll; }; } // namespace detail LoopVectorizeAttr LoopVectorizeAttr::get(::mlir::MLIRContext *context, BoolAttr disable, BoolAttr predicateEnable, BoolAttr scalableEnable, IntegerAttr width, LoopAnnotationAttr followupVectorized, LoopAnnotationAttr followupEpilogue, LoopAnnotationAttr followupAll) { return Base::get(context, std::move(disable), std::move(predicateEnable), std::move(scalableEnable), std::move(width), std::move(followupVectorized), std::move(followupEpilogue), std::move(followupAll)); } ::mlir::Attribute LoopVectorizeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_disable; ::mlir::FailureOr _result_predicateEnable; ::mlir::FailureOr _result_scalableEnable; ::mlir::FailureOr _result_width; ::mlir::FailureOr _result_followupVectorized; ::mlir::FailureOr _result_followupEpilogue; ::mlir::FailureOr _result_followupAll; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_disable = false; bool _seen_predicateEnable = false; bool _seen_scalableEnable = false; bool _seen_width = false; bool _seen_followupVectorized = false; bool _seen_followupEpilogue = false; bool _seen_followupAll = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_disable && _paramKey == "disable") { _seen_disable = true; // Parse variable 'disable' _result_disable = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_disable)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'disable' which is to be a `BoolAttr`"); return {}; } } else if (!_seen_predicateEnable && _paramKey == "predicateEnable") { _seen_predicateEnable = true; // Parse variable 'predicateEnable' _result_predicateEnable = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_predicateEnable)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'predicateEnable' which is to be a `BoolAttr`"); return {}; } } else if (!_seen_scalableEnable && _paramKey == "scalableEnable") { _seen_scalableEnable = true; // Parse variable 'scalableEnable' _result_scalableEnable = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_scalableEnable)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'scalableEnable' which is to be a `BoolAttr`"); return {}; } } else if (!_seen_width && _paramKey == "width") { _seen_width = true; // Parse variable 'width' _result_width = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_width)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'width' which is to be a `IntegerAttr`"); return {}; } } else if (!_seen_followupVectorized && _paramKey == "followupVectorized") { _seen_followupVectorized = true; // Parse variable 'followupVectorized' _result_followupVectorized = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_followupVectorized)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'followupVectorized' which is to be a `LoopAnnotationAttr`"); return {}; } } else if (!_seen_followupEpilogue && _paramKey == "followupEpilogue") { _seen_followupEpilogue = true; // Parse variable 'followupEpilogue' _result_followupEpilogue = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_followupEpilogue)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'followupEpilogue' which is to be a `LoopAnnotationAttr`"); return {}; } } else if (!_seen_followupAll && _paramKey == "followupAll") { _seen_followupAll = true; // Parse variable 'followupAll' _result_followupAll = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_followupAll)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopVectorizeAttr parameter 'followupAll' which is to be a `LoopAnnotationAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return LoopVectorizeAttr::get(odsParser.getContext(), BoolAttr((_result_disable.value_or(BoolAttr()))), BoolAttr((_result_predicateEnable.value_or(BoolAttr()))), BoolAttr((_result_scalableEnable.value_or(BoolAttr()))), IntegerAttr((_result_width.value_or(IntegerAttr()))), LoopAnnotationAttr((_result_followupVectorized.value_or(LoopAnnotationAttr()))), LoopAnnotationAttr((_result_followupEpilogue.value_or(LoopAnnotationAttr()))), LoopAnnotationAttr((_result_followupAll.value_or(LoopAnnotationAttr())))); } void LoopVectorizeAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getDisable() == BoolAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "disable = "; if (!(getDisable() == BoolAttr())) { odsPrinter.printStrippedAttrOrType(getDisable()); } } if (!(getPredicateEnable() == BoolAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "predicateEnable = "; if (!(getPredicateEnable() == BoolAttr())) { odsPrinter.printStrippedAttrOrType(getPredicateEnable()); } } if (!(getScalableEnable() == BoolAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "scalableEnable = "; if (!(getScalableEnable() == BoolAttr())) { odsPrinter.printStrippedAttrOrType(getScalableEnable()); } } if (!(getWidth() == IntegerAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "width = "; if (!(getWidth() == IntegerAttr())) { odsPrinter.printStrippedAttrOrType(getWidth()); } } if (!(getFollowupVectorized() == LoopAnnotationAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "followupVectorized = "; if (!(getFollowupVectorized() == LoopAnnotationAttr())) { odsPrinter.printStrippedAttrOrType(getFollowupVectorized()); } } if (!(getFollowupEpilogue() == LoopAnnotationAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "followupEpilogue = "; if (!(getFollowupEpilogue() == LoopAnnotationAttr())) { odsPrinter.printStrippedAttrOrType(getFollowupEpilogue()); } } if (!(getFollowupAll() == LoopAnnotationAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "followupAll = "; if (!(getFollowupAll() == LoopAnnotationAttr())) { odsPrinter.printStrippedAttrOrType(getFollowupAll()); } } } odsPrinter << ">"; } BoolAttr LoopVectorizeAttr::getDisable() const { return getImpl()->disable; } BoolAttr LoopVectorizeAttr::getPredicateEnable() const { return getImpl()->predicateEnable; } BoolAttr LoopVectorizeAttr::getScalableEnable() const { return getImpl()->scalableEnable; } IntegerAttr LoopVectorizeAttr::getWidth() const { return getImpl()->width; } LoopAnnotationAttr LoopVectorizeAttr::getFollowupVectorized() const { return getImpl()->followupVectorized; } LoopAnnotationAttr LoopVectorizeAttr::getFollowupEpilogue() const { return getImpl()->followupEpilogue; } LoopAnnotationAttr LoopVectorizeAttr::getFollowupAll() const { return getImpl()->followupAll; } ::mlir::OpAsmAliasResult LoopVectorizeAttr::getAlias(::llvm::raw_ostream &os) const { os << "loop_vectorize"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopVectorizeAttr) namespace mlir::LLVM { namespace detail { struct LoopInterleaveAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; LoopInterleaveAttrStorage(IntegerAttr count) : count(std::move(count)) {} KeyTy getAsKey() const { return KeyTy(count); } bool operator==(const KeyTy &tblgenKey) const { return (count == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static LoopInterleaveAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto count = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) LoopInterleaveAttrStorage(std::move(count)); } IntegerAttr count; }; } // namespace detail LoopInterleaveAttr LoopInterleaveAttr::get(::mlir::MLIRContext *context, IntegerAttr count) { return Base::get(context, std::move(count)); } ::mlir::Attribute LoopInterleaveAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_count; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_count = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_count && _paramKey == "count") { _seen_count = true; // Parse variable 'count' _result_count = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_count)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopInterleaveAttr parameter 'count' which is to be a `IntegerAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; for (unsigned odsStructIndex = 0; odsStructIndex < 1; ++odsStructIndex) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; if ((odsStructIndex != 1 - 1) && odsParser.parseComma()) return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_count)); return LoopInterleaveAttr::get(odsParser.getContext(), IntegerAttr((*_result_count))); } void LoopInterleaveAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "count = "; odsPrinter.printStrippedAttrOrType(getCount()); } odsPrinter << ">"; } IntegerAttr LoopInterleaveAttr::getCount() const { return getImpl()->count; } ::mlir::OpAsmAliasResult LoopInterleaveAttr::getAlias(::llvm::raw_ostream &os) const { os << "loop_interleave"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopInterleaveAttr) namespace mlir::LLVM { namespace detail { struct LoopUnrollAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; LoopUnrollAttrStorage(BoolAttr disable, IntegerAttr count, BoolAttr runtimeDisable, BoolAttr full, LoopAnnotationAttr followupUnrolled, LoopAnnotationAttr followupRemainder, LoopAnnotationAttr followupAll) : disable(std::move(disable)), count(std::move(count)), runtimeDisable(std::move(runtimeDisable)), full(std::move(full)), followupUnrolled(std::move(followupUnrolled)), followupRemainder(std::move(followupRemainder)), followupAll(std::move(followupAll)) {} KeyTy getAsKey() const { return KeyTy(disable, count, runtimeDisable, full, followupUnrolled, followupRemainder, followupAll); } bool operator==(const KeyTy &tblgenKey) const { return (disable == std::get<0>(tblgenKey)) && (count == std::get<1>(tblgenKey)) && (runtimeDisable == std::get<2>(tblgenKey)) && (full == std::get<3>(tblgenKey)) && (followupUnrolled == std::get<4>(tblgenKey)) && (followupRemainder == std::get<5>(tblgenKey)) && (followupAll == std::get<6>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey)); } static LoopUnrollAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto disable = std::move(std::get<0>(tblgenKey)); auto count = std::move(std::get<1>(tblgenKey)); auto runtimeDisable = std::move(std::get<2>(tblgenKey)); auto full = std::move(std::get<3>(tblgenKey)); auto followupUnrolled = std::move(std::get<4>(tblgenKey)); auto followupRemainder = std::move(std::get<5>(tblgenKey)); auto followupAll = std::move(std::get<6>(tblgenKey)); return new (allocator.allocate()) LoopUnrollAttrStorage(std::move(disable), std::move(count), std::move(runtimeDisable), std::move(full), std::move(followupUnrolled), std::move(followupRemainder), std::move(followupAll)); } BoolAttr disable; IntegerAttr count; BoolAttr runtimeDisable; BoolAttr full; LoopAnnotationAttr followupUnrolled; LoopAnnotationAttr followupRemainder; LoopAnnotationAttr followupAll; }; } // namespace detail LoopUnrollAttr LoopUnrollAttr::get(::mlir::MLIRContext *context, BoolAttr disable, IntegerAttr count, BoolAttr runtimeDisable, BoolAttr full, LoopAnnotationAttr followupUnrolled, LoopAnnotationAttr followupRemainder, LoopAnnotationAttr followupAll) { return Base::get(context, std::move(disable), std::move(count), std::move(runtimeDisable), std::move(full), std::move(followupUnrolled), std::move(followupRemainder), std::move(followupAll)); } ::mlir::Attribute LoopUnrollAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_disable; ::mlir::FailureOr _result_count; ::mlir::FailureOr _result_runtimeDisable; ::mlir::FailureOr _result_full; ::mlir::FailureOr _result_followupUnrolled; ::mlir::FailureOr _result_followupRemainder; ::mlir::FailureOr _result_followupAll; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_disable = false; bool _seen_count = false; bool _seen_runtimeDisable = false; bool _seen_full = false; bool _seen_followupUnrolled = false; bool _seen_followupRemainder = false; bool _seen_followupAll = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_disable && _paramKey == "disable") { _seen_disable = true; // Parse variable 'disable' _result_disable = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_disable)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'disable' which is to be a `BoolAttr`"); return {}; } } else if (!_seen_count && _paramKey == "count") { _seen_count = true; // Parse variable 'count' _result_count = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_count)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'count' which is to be a `IntegerAttr`"); return {}; } } else if (!_seen_runtimeDisable && _paramKey == "runtimeDisable") { _seen_runtimeDisable = true; // Parse variable 'runtimeDisable' _result_runtimeDisable = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_runtimeDisable)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'runtimeDisable' which is to be a `BoolAttr`"); return {}; } } else if (!_seen_full && _paramKey == "full") { _seen_full = true; // Parse variable 'full' _result_full = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_full)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'full' which is to be a `BoolAttr`"); return {}; } } else if (!_seen_followupUnrolled && _paramKey == "followupUnrolled") { _seen_followupUnrolled = true; // Parse variable 'followupUnrolled' _result_followupUnrolled = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_followupUnrolled)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'followupUnrolled' which is to be a `LoopAnnotationAttr`"); return {}; } } else if (!_seen_followupRemainder && _paramKey == "followupRemainder") { _seen_followupRemainder = true; // Parse variable 'followupRemainder' _result_followupRemainder = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_followupRemainder)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'followupRemainder' which is to be a `LoopAnnotationAttr`"); return {}; } } else if (!_seen_followupAll && _paramKey == "followupAll") { _seen_followupAll = true; // Parse variable 'followupAll' _result_followupAll = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_followupAll)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAttr parameter 'followupAll' which is to be a `LoopAnnotationAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return LoopUnrollAttr::get(odsParser.getContext(), BoolAttr((_result_disable.value_or(BoolAttr()))), IntegerAttr((_result_count.value_or(IntegerAttr()))), BoolAttr((_result_runtimeDisable.value_or(BoolAttr()))), BoolAttr((_result_full.value_or(BoolAttr()))), LoopAnnotationAttr((_result_followupUnrolled.value_or(LoopAnnotationAttr()))), LoopAnnotationAttr((_result_followupRemainder.value_or(LoopAnnotationAttr()))), LoopAnnotationAttr((_result_followupAll.value_or(LoopAnnotationAttr())))); } void LoopUnrollAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getDisable() == BoolAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "disable = "; if (!(getDisable() == BoolAttr())) { odsPrinter.printStrippedAttrOrType(getDisable()); } } if (!(getCount() == IntegerAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "count = "; if (!(getCount() == IntegerAttr())) { odsPrinter.printStrippedAttrOrType(getCount()); } } if (!(getRuntimeDisable() == BoolAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "runtimeDisable = "; if (!(getRuntimeDisable() == BoolAttr())) { odsPrinter.printStrippedAttrOrType(getRuntimeDisable()); } } if (!(getFull() == BoolAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "full = "; if (!(getFull() == BoolAttr())) { odsPrinter.printStrippedAttrOrType(getFull()); } } if (!(getFollowupUnrolled() == LoopAnnotationAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "followupUnrolled = "; if (!(getFollowupUnrolled() == LoopAnnotationAttr())) { odsPrinter.printStrippedAttrOrType(getFollowupUnrolled()); } } if (!(getFollowupRemainder() == LoopAnnotationAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "followupRemainder = "; if (!(getFollowupRemainder() == LoopAnnotationAttr())) { odsPrinter.printStrippedAttrOrType(getFollowupRemainder()); } } if (!(getFollowupAll() == LoopAnnotationAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "followupAll = "; if (!(getFollowupAll() == LoopAnnotationAttr())) { odsPrinter.printStrippedAttrOrType(getFollowupAll()); } } } odsPrinter << ">"; } BoolAttr LoopUnrollAttr::getDisable() const { return getImpl()->disable; } IntegerAttr LoopUnrollAttr::getCount() const { return getImpl()->count; } BoolAttr LoopUnrollAttr::getRuntimeDisable() const { return getImpl()->runtimeDisable; } BoolAttr LoopUnrollAttr::getFull() const { return getImpl()->full; } LoopAnnotationAttr LoopUnrollAttr::getFollowupUnrolled() const { return getImpl()->followupUnrolled; } LoopAnnotationAttr LoopUnrollAttr::getFollowupRemainder() const { return getImpl()->followupRemainder; } LoopAnnotationAttr LoopUnrollAttr::getFollowupAll() const { return getImpl()->followupAll; } ::mlir::OpAsmAliasResult LoopUnrollAttr::getAlias(::llvm::raw_ostream &os) const { os << "loop_unroll"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopUnrollAttr) namespace mlir::LLVM { namespace detail { struct LoopUnrollAndJamAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; LoopUnrollAndJamAttrStorage(BoolAttr disable, IntegerAttr count, LoopAnnotationAttr followupOuter, LoopAnnotationAttr followupInner, LoopAnnotationAttr followupRemainderOuter, LoopAnnotationAttr followupRemainderInner, LoopAnnotationAttr followupAll) : disable(std::move(disable)), count(std::move(count)), followupOuter(std::move(followupOuter)), followupInner(std::move(followupInner)), followupRemainderOuter(std::move(followupRemainderOuter)), followupRemainderInner(std::move(followupRemainderInner)), followupAll(std::move(followupAll)) {} KeyTy getAsKey() const { return KeyTy(disable, count, followupOuter, followupInner, followupRemainderOuter, followupRemainderInner, followupAll); } bool operator==(const KeyTy &tblgenKey) const { return (disable == std::get<0>(tblgenKey)) && (count == std::get<1>(tblgenKey)) && (followupOuter == std::get<2>(tblgenKey)) && (followupInner == std::get<3>(tblgenKey)) && (followupRemainderOuter == std::get<4>(tblgenKey)) && (followupRemainderInner == std::get<5>(tblgenKey)) && (followupAll == std::get<6>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey)); } static LoopUnrollAndJamAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto disable = std::move(std::get<0>(tblgenKey)); auto count = std::move(std::get<1>(tblgenKey)); auto followupOuter = std::move(std::get<2>(tblgenKey)); auto followupInner = std::move(std::get<3>(tblgenKey)); auto followupRemainderOuter = std::move(std::get<4>(tblgenKey)); auto followupRemainderInner = std::move(std::get<5>(tblgenKey)); auto followupAll = std::move(std::get<6>(tblgenKey)); return new (allocator.allocate()) LoopUnrollAndJamAttrStorage(std::move(disable), std::move(count), std::move(followupOuter), std::move(followupInner), std::move(followupRemainderOuter), std::move(followupRemainderInner), std::move(followupAll)); } BoolAttr disable; IntegerAttr count; LoopAnnotationAttr followupOuter; LoopAnnotationAttr followupInner; LoopAnnotationAttr followupRemainderOuter; LoopAnnotationAttr followupRemainderInner; LoopAnnotationAttr followupAll; }; } // namespace detail LoopUnrollAndJamAttr LoopUnrollAndJamAttr::get(::mlir::MLIRContext *context, BoolAttr disable, IntegerAttr count, LoopAnnotationAttr followupOuter, LoopAnnotationAttr followupInner, LoopAnnotationAttr followupRemainderOuter, LoopAnnotationAttr followupRemainderInner, LoopAnnotationAttr followupAll) { return Base::get(context, std::move(disable), std::move(count), std::move(followupOuter), std::move(followupInner), std::move(followupRemainderOuter), std::move(followupRemainderInner), std::move(followupAll)); } ::mlir::Attribute LoopUnrollAndJamAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_disable; ::mlir::FailureOr _result_count; ::mlir::FailureOr _result_followupOuter; ::mlir::FailureOr _result_followupInner; ::mlir::FailureOr _result_followupRemainderOuter; ::mlir::FailureOr _result_followupRemainderInner; ::mlir::FailureOr _result_followupAll; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_disable = false; bool _seen_count = false; bool _seen_followupOuter = false; bool _seen_followupInner = false; bool _seen_followupRemainderOuter = false; bool _seen_followupRemainderInner = false; bool _seen_followupAll = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_disable && _paramKey == "disable") { _seen_disable = true; // Parse variable 'disable' _result_disable = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_disable)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'disable' which is to be a `BoolAttr`"); return {}; } } else if (!_seen_count && _paramKey == "count") { _seen_count = true; // Parse variable 'count' _result_count = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_count)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'count' which is to be a `IntegerAttr`"); return {}; } } else if (!_seen_followupOuter && _paramKey == "followupOuter") { _seen_followupOuter = true; // Parse variable 'followupOuter' _result_followupOuter = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_followupOuter)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'followupOuter' which is to be a `LoopAnnotationAttr`"); return {}; } } else if (!_seen_followupInner && _paramKey == "followupInner") { _seen_followupInner = true; // Parse variable 'followupInner' _result_followupInner = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_followupInner)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'followupInner' which is to be a `LoopAnnotationAttr`"); return {}; } } else if (!_seen_followupRemainderOuter && _paramKey == "followupRemainderOuter") { _seen_followupRemainderOuter = true; // Parse variable 'followupRemainderOuter' _result_followupRemainderOuter = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_followupRemainderOuter)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'followupRemainderOuter' which is to be a `LoopAnnotationAttr`"); return {}; } } else if (!_seen_followupRemainderInner && _paramKey == "followupRemainderInner") { _seen_followupRemainderInner = true; // Parse variable 'followupRemainderInner' _result_followupRemainderInner = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_followupRemainderInner)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'followupRemainderInner' which is to be a `LoopAnnotationAttr`"); return {}; } } else if (!_seen_followupAll && _paramKey == "followupAll") { _seen_followupAll = true; // Parse variable 'followupAll' _result_followupAll = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_followupAll)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnrollAndJamAttr parameter 'followupAll' which is to be a `LoopAnnotationAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return LoopUnrollAndJamAttr::get(odsParser.getContext(), BoolAttr((_result_disable.value_or(BoolAttr()))), IntegerAttr((_result_count.value_or(IntegerAttr()))), LoopAnnotationAttr((_result_followupOuter.value_or(LoopAnnotationAttr()))), LoopAnnotationAttr((_result_followupInner.value_or(LoopAnnotationAttr()))), LoopAnnotationAttr((_result_followupRemainderOuter.value_or(LoopAnnotationAttr()))), LoopAnnotationAttr((_result_followupRemainderInner.value_or(LoopAnnotationAttr()))), LoopAnnotationAttr((_result_followupAll.value_or(LoopAnnotationAttr())))); } void LoopUnrollAndJamAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getDisable() == BoolAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "disable = "; if (!(getDisable() == BoolAttr())) { odsPrinter.printStrippedAttrOrType(getDisable()); } } if (!(getCount() == IntegerAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "count = "; if (!(getCount() == IntegerAttr())) { odsPrinter.printStrippedAttrOrType(getCount()); } } if (!(getFollowupOuter() == LoopAnnotationAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "followupOuter = "; if (!(getFollowupOuter() == LoopAnnotationAttr())) { odsPrinter.printStrippedAttrOrType(getFollowupOuter()); } } if (!(getFollowupInner() == LoopAnnotationAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "followupInner = "; if (!(getFollowupInner() == LoopAnnotationAttr())) { odsPrinter.printStrippedAttrOrType(getFollowupInner()); } } if (!(getFollowupRemainderOuter() == LoopAnnotationAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "followupRemainderOuter = "; if (!(getFollowupRemainderOuter() == LoopAnnotationAttr())) { odsPrinter.printStrippedAttrOrType(getFollowupRemainderOuter()); } } if (!(getFollowupRemainderInner() == LoopAnnotationAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "followupRemainderInner = "; if (!(getFollowupRemainderInner() == LoopAnnotationAttr())) { odsPrinter.printStrippedAttrOrType(getFollowupRemainderInner()); } } if (!(getFollowupAll() == LoopAnnotationAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "followupAll = "; if (!(getFollowupAll() == LoopAnnotationAttr())) { odsPrinter.printStrippedAttrOrType(getFollowupAll()); } } } odsPrinter << ">"; } BoolAttr LoopUnrollAndJamAttr::getDisable() const { return getImpl()->disable; } IntegerAttr LoopUnrollAndJamAttr::getCount() const { return getImpl()->count; } LoopAnnotationAttr LoopUnrollAndJamAttr::getFollowupOuter() const { return getImpl()->followupOuter; } LoopAnnotationAttr LoopUnrollAndJamAttr::getFollowupInner() const { return getImpl()->followupInner; } LoopAnnotationAttr LoopUnrollAndJamAttr::getFollowupRemainderOuter() const { return getImpl()->followupRemainderOuter; } LoopAnnotationAttr LoopUnrollAndJamAttr::getFollowupRemainderInner() const { return getImpl()->followupRemainderInner; } LoopAnnotationAttr LoopUnrollAndJamAttr::getFollowupAll() const { return getImpl()->followupAll; } ::mlir::OpAsmAliasResult LoopUnrollAndJamAttr::getAlias(::llvm::raw_ostream &os) const { os << "loop_unroll_and_jam"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopUnrollAndJamAttr) namespace mlir::LLVM { namespace detail { struct LoopLICMAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; LoopLICMAttrStorage(BoolAttr disable, BoolAttr versioningDisable) : disable(std::move(disable)), versioningDisable(std::move(versioningDisable)) {} KeyTy getAsKey() const { return KeyTy(disable, versioningDisable); } bool operator==(const KeyTy &tblgenKey) const { return (disable == std::get<0>(tblgenKey)) && (versioningDisable == std::get<1>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static LoopLICMAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto disable = std::move(std::get<0>(tblgenKey)); auto versioningDisable = std::move(std::get<1>(tblgenKey)); return new (allocator.allocate()) LoopLICMAttrStorage(std::move(disable), std::move(versioningDisable)); } BoolAttr disable; BoolAttr versioningDisable; }; } // namespace detail LoopLICMAttr LoopLICMAttr::get(::mlir::MLIRContext *context, BoolAttr disable, BoolAttr versioningDisable) { return Base::get(context, std::move(disable), std::move(versioningDisable)); } ::mlir::Attribute LoopLICMAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_disable; ::mlir::FailureOr _result_versioningDisable; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_disable = false; bool _seen_versioningDisable = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_disable && _paramKey == "disable") { _seen_disable = true; // Parse variable 'disable' _result_disable = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_disable)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopLICMAttr parameter 'disable' which is to be a `BoolAttr`"); return {}; } } else if (!_seen_versioningDisable && _paramKey == "versioningDisable") { _seen_versioningDisable = true; // Parse variable 'versioningDisable' _result_versioningDisable = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_versioningDisable)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopLICMAttr parameter 'versioningDisable' which is to be a `BoolAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return LoopLICMAttr::get(odsParser.getContext(), BoolAttr((_result_disable.value_or(BoolAttr()))), BoolAttr((_result_versioningDisable.value_or(BoolAttr())))); } void LoopLICMAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getDisable() == BoolAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "disable = "; if (!(getDisable() == BoolAttr())) { odsPrinter.printStrippedAttrOrType(getDisable()); } } if (!(getVersioningDisable() == BoolAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "versioningDisable = "; if (!(getVersioningDisable() == BoolAttr())) { odsPrinter.printStrippedAttrOrType(getVersioningDisable()); } } } odsPrinter << ">"; } BoolAttr LoopLICMAttr::getDisable() const { return getImpl()->disable; } BoolAttr LoopLICMAttr::getVersioningDisable() const { return getImpl()->versioningDisable; } ::mlir::OpAsmAliasResult LoopLICMAttr::getAlias(::llvm::raw_ostream &os) const { os << "loop_licm"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopLICMAttr) namespace mlir::LLVM { namespace detail { struct LoopDistributeAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; LoopDistributeAttrStorage(BoolAttr disable, LoopAnnotationAttr followupCoincident, LoopAnnotationAttr followupSequential, LoopAnnotationAttr followupFallback, LoopAnnotationAttr followupAll) : disable(std::move(disable)), followupCoincident(std::move(followupCoincident)), followupSequential(std::move(followupSequential)), followupFallback(std::move(followupFallback)), followupAll(std::move(followupAll)) {} KeyTy getAsKey() const { return KeyTy(disable, followupCoincident, followupSequential, followupFallback, followupAll); } bool operator==(const KeyTy &tblgenKey) const { return (disable == std::get<0>(tblgenKey)) && (followupCoincident == std::get<1>(tblgenKey)) && (followupSequential == std::get<2>(tblgenKey)) && (followupFallback == std::get<3>(tblgenKey)) && (followupAll == std::get<4>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey)); } static LoopDistributeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto disable = std::move(std::get<0>(tblgenKey)); auto followupCoincident = std::move(std::get<1>(tblgenKey)); auto followupSequential = std::move(std::get<2>(tblgenKey)); auto followupFallback = std::move(std::get<3>(tblgenKey)); auto followupAll = std::move(std::get<4>(tblgenKey)); return new (allocator.allocate()) LoopDistributeAttrStorage(std::move(disable), std::move(followupCoincident), std::move(followupSequential), std::move(followupFallback), std::move(followupAll)); } BoolAttr disable; LoopAnnotationAttr followupCoincident; LoopAnnotationAttr followupSequential; LoopAnnotationAttr followupFallback; LoopAnnotationAttr followupAll; }; } // namespace detail LoopDistributeAttr LoopDistributeAttr::get(::mlir::MLIRContext *context, BoolAttr disable, LoopAnnotationAttr followupCoincident, LoopAnnotationAttr followupSequential, LoopAnnotationAttr followupFallback, LoopAnnotationAttr followupAll) { return Base::get(context, std::move(disable), std::move(followupCoincident), std::move(followupSequential), std::move(followupFallback), std::move(followupAll)); } ::mlir::Attribute LoopDistributeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_disable; ::mlir::FailureOr _result_followupCoincident; ::mlir::FailureOr _result_followupSequential; ::mlir::FailureOr _result_followupFallback; ::mlir::FailureOr _result_followupAll; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_disable = false; bool _seen_followupCoincident = false; bool _seen_followupSequential = false; bool _seen_followupFallback = false; bool _seen_followupAll = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_disable && _paramKey == "disable") { _seen_disable = true; // Parse variable 'disable' _result_disable = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_disable)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopDistributeAttr parameter 'disable' which is to be a `BoolAttr`"); return {}; } } else if (!_seen_followupCoincident && _paramKey == "followupCoincident") { _seen_followupCoincident = true; // Parse variable 'followupCoincident' _result_followupCoincident = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_followupCoincident)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopDistributeAttr parameter 'followupCoincident' which is to be a `LoopAnnotationAttr`"); return {}; } } else if (!_seen_followupSequential && _paramKey == "followupSequential") { _seen_followupSequential = true; // Parse variable 'followupSequential' _result_followupSequential = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_followupSequential)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopDistributeAttr parameter 'followupSequential' which is to be a `LoopAnnotationAttr`"); return {}; } } else if (!_seen_followupFallback && _paramKey == "followupFallback") { _seen_followupFallback = true; // Parse variable 'followupFallback' _result_followupFallback = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_followupFallback)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopDistributeAttr parameter 'followupFallback' which is to be a `LoopAnnotationAttr`"); return {}; } } else if (!_seen_followupAll && _paramKey == "followupAll") { _seen_followupAll = true; // Parse variable 'followupAll' _result_followupAll = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_followupAll)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopDistributeAttr parameter 'followupAll' which is to be a `LoopAnnotationAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return LoopDistributeAttr::get(odsParser.getContext(), BoolAttr((_result_disable.value_or(BoolAttr()))), LoopAnnotationAttr((_result_followupCoincident.value_or(LoopAnnotationAttr()))), LoopAnnotationAttr((_result_followupSequential.value_or(LoopAnnotationAttr()))), LoopAnnotationAttr((_result_followupFallback.value_or(LoopAnnotationAttr()))), LoopAnnotationAttr((_result_followupAll.value_or(LoopAnnotationAttr())))); } void LoopDistributeAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getDisable() == BoolAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "disable = "; if (!(getDisable() == BoolAttr())) { odsPrinter.printStrippedAttrOrType(getDisable()); } } if (!(getFollowupCoincident() == LoopAnnotationAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "followupCoincident = "; if (!(getFollowupCoincident() == LoopAnnotationAttr())) { odsPrinter.printStrippedAttrOrType(getFollowupCoincident()); } } if (!(getFollowupSequential() == LoopAnnotationAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "followupSequential = "; if (!(getFollowupSequential() == LoopAnnotationAttr())) { odsPrinter.printStrippedAttrOrType(getFollowupSequential()); } } if (!(getFollowupFallback() == LoopAnnotationAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "followupFallback = "; if (!(getFollowupFallback() == LoopAnnotationAttr())) { odsPrinter.printStrippedAttrOrType(getFollowupFallback()); } } if (!(getFollowupAll() == LoopAnnotationAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "followupAll = "; if (!(getFollowupAll() == LoopAnnotationAttr())) { odsPrinter.printStrippedAttrOrType(getFollowupAll()); } } } odsPrinter << ">"; } BoolAttr LoopDistributeAttr::getDisable() const { return getImpl()->disable; } LoopAnnotationAttr LoopDistributeAttr::getFollowupCoincident() const { return getImpl()->followupCoincident; } LoopAnnotationAttr LoopDistributeAttr::getFollowupSequential() const { return getImpl()->followupSequential; } LoopAnnotationAttr LoopDistributeAttr::getFollowupFallback() const { return getImpl()->followupFallback; } LoopAnnotationAttr LoopDistributeAttr::getFollowupAll() const { return getImpl()->followupAll; } ::mlir::OpAsmAliasResult LoopDistributeAttr::getAlias(::llvm::raw_ostream &os) const { os << "loop_distribute"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopDistributeAttr) namespace mlir::LLVM { namespace detail { struct LoopPipelineAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; LoopPipelineAttrStorage(BoolAttr disable, IntegerAttr initiationinterval) : disable(std::move(disable)), initiationinterval(std::move(initiationinterval)) {} KeyTy getAsKey() const { return KeyTy(disable, initiationinterval); } bool operator==(const KeyTy &tblgenKey) const { return (disable == std::get<0>(tblgenKey)) && (initiationinterval == std::get<1>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static LoopPipelineAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto disable = std::move(std::get<0>(tblgenKey)); auto initiationinterval = std::move(std::get<1>(tblgenKey)); return new (allocator.allocate()) LoopPipelineAttrStorage(std::move(disable), std::move(initiationinterval)); } BoolAttr disable; IntegerAttr initiationinterval; }; } // namespace detail LoopPipelineAttr LoopPipelineAttr::get(::mlir::MLIRContext *context, BoolAttr disable, IntegerAttr initiationinterval) { return Base::get(context, std::move(disable), std::move(initiationinterval)); } ::mlir::Attribute LoopPipelineAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_disable; ::mlir::FailureOr _result_initiationinterval; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_disable = false; bool _seen_initiationinterval = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_disable && _paramKey == "disable") { _seen_disable = true; // Parse variable 'disable' _result_disable = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_disable)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopPipelineAttr parameter 'disable' which is to be a `BoolAttr`"); return {}; } } else if (!_seen_initiationinterval && _paramKey == "initiationinterval") { _seen_initiationinterval = true; // Parse variable 'initiationinterval' _result_initiationinterval = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_initiationinterval)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopPipelineAttr parameter 'initiationinterval' which is to be a `IntegerAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return LoopPipelineAttr::get(odsParser.getContext(), BoolAttr((_result_disable.value_or(BoolAttr()))), IntegerAttr((_result_initiationinterval.value_or(IntegerAttr())))); } void LoopPipelineAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getDisable() == BoolAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "disable = "; if (!(getDisable() == BoolAttr())) { odsPrinter.printStrippedAttrOrType(getDisable()); } } if (!(getInitiationinterval() == IntegerAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "initiationinterval = "; if (!(getInitiationinterval() == IntegerAttr())) { odsPrinter.printStrippedAttrOrType(getInitiationinterval()); } } } odsPrinter << ">"; } BoolAttr LoopPipelineAttr::getDisable() const { return getImpl()->disable; } IntegerAttr LoopPipelineAttr::getInitiationinterval() const { return getImpl()->initiationinterval; } ::mlir::OpAsmAliasResult LoopPipelineAttr::getAlias(::llvm::raw_ostream &os) const { os << "loop_pipeline"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopPipelineAttr) namespace mlir::LLVM { namespace detail { struct LoopPeeledAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; LoopPeeledAttrStorage(IntegerAttr count) : count(std::move(count)) {} KeyTy getAsKey() const { return KeyTy(count); } bool operator==(const KeyTy &tblgenKey) const { return (count == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static LoopPeeledAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto count = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) LoopPeeledAttrStorage(std::move(count)); } IntegerAttr count; }; } // namespace detail LoopPeeledAttr LoopPeeledAttr::get(::mlir::MLIRContext *context, IntegerAttr count) { return Base::get(context, std::move(count)); } ::mlir::Attribute LoopPeeledAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_count; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_count = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_count && _paramKey == "count") { _seen_count = true; // Parse variable 'count' _result_count = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_count)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopPeeledAttr parameter 'count' which is to be a `IntegerAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return LoopPeeledAttr::get(odsParser.getContext(), IntegerAttr((_result_count.value_or(IntegerAttr())))); } void LoopPeeledAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getCount() == IntegerAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "count = "; if (!(getCount() == IntegerAttr())) { odsPrinter.printStrippedAttrOrType(getCount()); } } } odsPrinter << ">"; } IntegerAttr LoopPeeledAttr::getCount() const { return getImpl()->count; } ::mlir::OpAsmAliasResult LoopPeeledAttr::getAlias(::llvm::raw_ostream &os) const { os << "loop_peeled"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopPeeledAttr) namespace mlir::LLVM { namespace detail { struct LoopUnswitchAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; LoopUnswitchAttrStorage(BoolAttr partialDisable) : partialDisable(std::move(partialDisable)) {} KeyTy getAsKey() const { return KeyTy(partialDisable); } bool operator==(const KeyTy &tblgenKey) const { return (partialDisable == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static LoopUnswitchAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto partialDisable = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) LoopUnswitchAttrStorage(std::move(partialDisable)); } BoolAttr partialDisable; }; } // namespace detail LoopUnswitchAttr LoopUnswitchAttr::get(::mlir::MLIRContext *context, BoolAttr partialDisable) { return Base::get(context, std::move(partialDisable)); } ::mlir::Attribute LoopUnswitchAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_partialDisable; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_partialDisable = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_partialDisable && _paramKey == "partialDisable") { _seen_partialDisable = true; // Parse variable 'partialDisable' _result_partialDisable = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_partialDisable)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopUnswitchAttr parameter 'partialDisable' which is to be a `BoolAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return LoopUnswitchAttr::get(odsParser.getContext(), BoolAttr((_result_partialDisable.value_or(BoolAttr())))); } void LoopUnswitchAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getPartialDisable() == BoolAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "partialDisable = "; if (!(getPartialDisable() == BoolAttr())) { odsPrinter.printStrippedAttrOrType(getPartialDisable()); } } } odsPrinter << ">"; } BoolAttr LoopUnswitchAttr::getPartialDisable() const { return getImpl()->partialDisable; } ::mlir::OpAsmAliasResult LoopUnswitchAttr::getAlias(::llvm::raw_ostream &os) const { os << "loop_unswitch"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopUnswitchAttr) namespace mlir::LLVM { namespace detail { struct LoopAnnotationAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple>; LoopAnnotationAttrStorage(BoolAttr disableNonforced, LoopVectorizeAttr vectorize, LoopInterleaveAttr interleave, LoopUnrollAttr unroll, LoopUnrollAndJamAttr unrollAndJam, LoopLICMAttr licm, LoopDistributeAttr distribute, LoopPipelineAttr pipeline, LoopPeeledAttr peeled, LoopUnswitchAttr unswitch, BoolAttr mustProgress, BoolAttr isVectorized, FusedLoc startLoc, FusedLoc endLoc, ::llvm::ArrayRef parallelAccesses) : disableNonforced(std::move(disableNonforced)), vectorize(std::move(vectorize)), interleave(std::move(interleave)), unroll(std::move(unroll)), unrollAndJam(std::move(unrollAndJam)), licm(std::move(licm)), distribute(std::move(distribute)), pipeline(std::move(pipeline)), peeled(std::move(peeled)), unswitch(std::move(unswitch)), mustProgress(std::move(mustProgress)), isVectorized(std::move(isVectorized)), startLoc(std::move(startLoc)), endLoc(std::move(endLoc)), parallelAccesses(std::move(parallelAccesses)) {} KeyTy getAsKey() const { return KeyTy(disableNonforced, vectorize, interleave, unroll, unrollAndJam, licm, distribute, pipeline, peeled, unswitch, mustProgress, isVectorized, startLoc, endLoc, parallelAccesses); } bool operator==(const KeyTy &tblgenKey) const { return (disableNonforced == std::get<0>(tblgenKey)) && (vectorize == std::get<1>(tblgenKey)) && (interleave == std::get<2>(tblgenKey)) && (unroll == std::get<3>(tblgenKey)) && (unrollAndJam == std::get<4>(tblgenKey)) && (licm == std::get<5>(tblgenKey)) && (distribute == std::get<6>(tblgenKey)) && (pipeline == std::get<7>(tblgenKey)) && (peeled == std::get<8>(tblgenKey)) && (unswitch == std::get<9>(tblgenKey)) && (mustProgress == std::get<10>(tblgenKey)) && (isVectorized == std::get<11>(tblgenKey)) && (startLoc == std::get<12>(tblgenKey)) && (endLoc == std::get<13>(tblgenKey)) && (::llvm::ArrayRef(parallelAccesses) == ::llvm::ArrayRef(std::get<14>(tblgenKey))); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey), std::get<7>(tblgenKey), std::get<8>(tblgenKey), std::get<9>(tblgenKey), std::get<10>(tblgenKey), std::get<11>(tblgenKey), std::get<12>(tblgenKey), std::get<13>(tblgenKey), std::get<14>(tblgenKey)); } static LoopAnnotationAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto disableNonforced = std::move(std::get<0>(tblgenKey)); auto vectorize = std::move(std::get<1>(tblgenKey)); auto interleave = std::move(std::get<2>(tblgenKey)); auto unroll = std::move(std::get<3>(tblgenKey)); auto unrollAndJam = std::move(std::get<4>(tblgenKey)); auto licm = std::move(std::get<5>(tblgenKey)); auto distribute = std::move(std::get<6>(tblgenKey)); auto pipeline = std::move(std::get<7>(tblgenKey)); auto peeled = std::move(std::get<8>(tblgenKey)); auto unswitch = std::move(std::get<9>(tblgenKey)); auto mustProgress = std::move(std::get<10>(tblgenKey)); auto isVectorized = std::move(std::get<11>(tblgenKey)); auto startLoc = std::move(std::get<12>(tblgenKey)); auto endLoc = std::move(std::get<13>(tblgenKey)); auto parallelAccesses = std::move(std::get<14>(tblgenKey)); parallelAccesses = allocator.copyInto(parallelAccesses); return new (allocator.allocate()) LoopAnnotationAttrStorage(std::move(disableNonforced), std::move(vectorize), std::move(interleave), std::move(unroll), std::move(unrollAndJam), std::move(licm), std::move(distribute), std::move(pipeline), std::move(peeled), std::move(unswitch), std::move(mustProgress), std::move(isVectorized), std::move(startLoc), std::move(endLoc), std::move(parallelAccesses)); } BoolAttr disableNonforced; LoopVectorizeAttr vectorize; LoopInterleaveAttr interleave; LoopUnrollAttr unroll; LoopUnrollAndJamAttr unrollAndJam; LoopLICMAttr licm; LoopDistributeAttr distribute; LoopPipelineAttr pipeline; LoopPeeledAttr peeled; LoopUnswitchAttr unswitch; BoolAttr mustProgress; BoolAttr isVectorized; FusedLoc startLoc; FusedLoc endLoc; ::llvm::ArrayRef parallelAccesses; }; } // namespace detail LoopAnnotationAttr LoopAnnotationAttr::get(::mlir::MLIRContext *context, BoolAttr disableNonforced, LoopVectorizeAttr vectorize, LoopInterleaveAttr interleave, LoopUnrollAttr unroll, LoopUnrollAndJamAttr unrollAndJam, LoopLICMAttr licm, LoopDistributeAttr distribute, LoopPipelineAttr pipeline, LoopPeeledAttr peeled, LoopUnswitchAttr unswitch, BoolAttr mustProgress, BoolAttr isVectorized, FusedLoc startLoc, FusedLoc endLoc, ::llvm::ArrayRef parallelAccesses) { return Base::get(context, std::move(disableNonforced), std::move(vectorize), std::move(interleave), std::move(unroll), std::move(unrollAndJam), std::move(licm), std::move(distribute), std::move(pipeline), std::move(peeled), std::move(unswitch), std::move(mustProgress), std::move(isVectorized), std::move(startLoc), std::move(endLoc), std::move(parallelAccesses)); } ::mlir::Attribute LoopAnnotationAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_disableNonforced; ::mlir::FailureOr _result_vectorize; ::mlir::FailureOr _result_interleave; ::mlir::FailureOr _result_unroll; ::mlir::FailureOr _result_unrollAndJam; ::mlir::FailureOr _result_licm; ::mlir::FailureOr _result_distribute; ::mlir::FailureOr _result_pipeline; ::mlir::FailureOr _result_peeled; ::mlir::FailureOr _result_unswitch; ::mlir::FailureOr _result_mustProgress; ::mlir::FailureOr _result_isVectorized; ::mlir::FailureOr _result_startLoc; ::mlir::FailureOr _result_endLoc; ::mlir::FailureOr<::llvm::SmallVector> _result_parallelAccesses; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_disableNonforced = false; bool _seen_vectorize = false; bool _seen_interleave = false; bool _seen_unroll = false; bool _seen_unrollAndJam = false; bool _seen_licm = false; bool _seen_distribute = false; bool _seen_pipeline = false; bool _seen_peeled = false; bool _seen_unswitch = false; bool _seen_mustProgress = false; bool _seen_isVectorized = false; bool _seen_startLoc = false; bool _seen_endLoc = false; bool _seen_parallelAccesses = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_disableNonforced && _paramKey == "disableNonforced") { _seen_disableNonforced = true; // Parse variable 'disableNonforced' _result_disableNonforced = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_disableNonforced)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'disableNonforced' which is to be a `BoolAttr`"); return {}; } } else if (!_seen_vectorize && _paramKey == "vectorize") { _seen_vectorize = true; // Parse variable 'vectorize' _result_vectorize = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_vectorize)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'vectorize' which is to be a `LoopVectorizeAttr`"); return {}; } } else if (!_seen_interleave && _paramKey == "interleave") { _seen_interleave = true; // Parse variable 'interleave' _result_interleave = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_interleave)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'interleave' which is to be a `LoopInterleaveAttr`"); return {}; } } else if (!_seen_unroll && _paramKey == "unroll") { _seen_unroll = true; // Parse variable 'unroll' _result_unroll = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_unroll)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'unroll' which is to be a `LoopUnrollAttr`"); return {}; } } else if (!_seen_unrollAndJam && _paramKey == "unrollAndJam") { _seen_unrollAndJam = true; // Parse variable 'unrollAndJam' _result_unrollAndJam = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_unrollAndJam)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'unrollAndJam' which is to be a `LoopUnrollAndJamAttr`"); return {}; } } else if (!_seen_licm && _paramKey == "licm") { _seen_licm = true; // Parse variable 'licm' _result_licm = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_licm)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'licm' which is to be a `LoopLICMAttr`"); return {}; } } else if (!_seen_distribute && _paramKey == "distribute") { _seen_distribute = true; // Parse variable 'distribute' _result_distribute = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_distribute)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'distribute' which is to be a `LoopDistributeAttr`"); return {}; } } else if (!_seen_pipeline && _paramKey == "pipeline") { _seen_pipeline = true; // Parse variable 'pipeline' _result_pipeline = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_pipeline)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'pipeline' which is to be a `LoopPipelineAttr`"); return {}; } } else if (!_seen_peeled && _paramKey == "peeled") { _seen_peeled = true; // Parse variable 'peeled' _result_peeled = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_peeled)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'peeled' which is to be a `LoopPeeledAttr`"); return {}; } } else if (!_seen_unswitch && _paramKey == "unswitch") { _seen_unswitch = true; // Parse variable 'unswitch' _result_unswitch = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_unswitch)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'unswitch' which is to be a `LoopUnswitchAttr`"); return {}; } } else if (!_seen_mustProgress && _paramKey == "mustProgress") { _seen_mustProgress = true; // Parse variable 'mustProgress' _result_mustProgress = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_mustProgress)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'mustProgress' which is to be a `BoolAttr`"); return {}; } } else if (!_seen_isVectorized && _paramKey == "isVectorized") { _seen_isVectorized = true; // Parse variable 'isVectorized' _result_isVectorized = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_isVectorized)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'isVectorized' which is to be a `BoolAttr`"); return {}; } } else if (!_seen_startLoc && _paramKey == "startLoc") { _seen_startLoc = true; // Parse variable 'startLoc' _result_startLoc = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_startLoc)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'startLoc' which is to be a `FusedLoc`"); return {}; } } else if (!_seen_endLoc && _paramKey == "endLoc") { _seen_endLoc = true; // Parse variable 'endLoc' _result_endLoc = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_endLoc)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'endLoc' which is to be a `FusedLoc`"); return {}; } } else if (!_seen_parallelAccesses && _paramKey == "parallelAccesses") { _seen_parallelAccesses = true; // Parse variable 'parallelAccesses' _result_parallelAccesses = ::mlir::FieldParser<::llvm::SmallVector>::parse(odsParser); if (::mlir::failed(_result_parallelAccesses)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LoopAnnotationAttr parameter 'parallelAccesses' which is to be a `::llvm::ArrayRef`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return LoopAnnotationAttr::get(odsParser.getContext(), BoolAttr((_result_disableNonforced.value_or(BoolAttr()))), LoopVectorizeAttr((_result_vectorize.value_or(LoopVectorizeAttr()))), LoopInterleaveAttr((_result_interleave.value_or(LoopInterleaveAttr()))), LoopUnrollAttr((_result_unroll.value_or(LoopUnrollAttr()))), LoopUnrollAndJamAttr((_result_unrollAndJam.value_or(LoopUnrollAndJamAttr()))), LoopLICMAttr((_result_licm.value_or(LoopLICMAttr()))), LoopDistributeAttr((_result_distribute.value_or(LoopDistributeAttr()))), LoopPipelineAttr((_result_pipeline.value_or(LoopPipelineAttr()))), LoopPeeledAttr((_result_peeled.value_or(LoopPeeledAttr()))), LoopUnswitchAttr((_result_unswitch.value_or(LoopUnswitchAttr()))), BoolAttr((_result_mustProgress.value_or(BoolAttr()))), BoolAttr((_result_isVectorized.value_or(BoolAttr()))), FusedLoc((_result_startLoc.value_or(FusedLoc()))), FusedLoc((_result_endLoc.value_or(FusedLoc()))), ::llvm::ArrayRef((_result_parallelAccesses.value_or(::llvm::SmallVector())))); } void LoopAnnotationAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getDisableNonforced() == BoolAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "disableNonforced = "; if (!(getDisableNonforced() == BoolAttr())) { odsPrinter.printStrippedAttrOrType(getDisableNonforced()); } } if (!(getVectorize() == LoopVectorizeAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "vectorize = "; if (!(getVectorize() == LoopVectorizeAttr())) { odsPrinter.printStrippedAttrOrType(getVectorize()); } } if (!(getInterleave() == LoopInterleaveAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "interleave = "; if (!(getInterleave() == LoopInterleaveAttr())) { odsPrinter.printStrippedAttrOrType(getInterleave()); } } if (!(getUnroll() == LoopUnrollAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "unroll = "; if (!(getUnroll() == LoopUnrollAttr())) { odsPrinter.printStrippedAttrOrType(getUnroll()); } } if (!(getUnrollAndJam() == LoopUnrollAndJamAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "unrollAndJam = "; if (!(getUnrollAndJam() == LoopUnrollAndJamAttr())) { odsPrinter.printStrippedAttrOrType(getUnrollAndJam()); } } if (!(getLicm() == LoopLICMAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "licm = "; if (!(getLicm() == LoopLICMAttr())) { odsPrinter.printStrippedAttrOrType(getLicm()); } } if (!(getDistribute() == LoopDistributeAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "distribute = "; if (!(getDistribute() == LoopDistributeAttr())) { odsPrinter.printStrippedAttrOrType(getDistribute()); } } if (!(getPipeline() == LoopPipelineAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "pipeline = "; if (!(getPipeline() == LoopPipelineAttr())) { odsPrinter.printStrippedAttrOrType(getPipeline()); } } if (!(getPeeled() == LoopPeeledAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "peeled = "; if (!(getPeeled() == LoopPeeledAttr())) { odsPrinter.printStrippedAttrOrType(getPeeled()); } } if (!(getUnswitch() == LoopUnswitchAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "unswitch = "; if (!(getUnswitch() == LoopUnswitchAttr())) { odsPrinter.printStrippedAttrOrType(getUnswitch()); } } if (!(getMustProgress() == BoolAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "mustProgress = "; if (!(getMustProgress() == BoolAttr())) { odsPrinter.printStrippedAttrOrType(getMustProgress()); } } if (!(getIsVectorized() == BoolAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "isVectorized = "; if (!(getIsVectorized() == BoolAttr())) { odsPrinter.printStrippedAttrOrType(getIsVectorized()); } } if (!(getStartLoc() == FusedLoc())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "startLoc = "; if (!(getStartLoc() == FusedLoc())) { odsPrinter.printStrippedAttrOrType(getStartLoc()); } } if (!(getEndLoc() == FusedLoc())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "endLoc = "; if (!(getEndLoc() == FusedLoc())) { odsPrinter.printStrippedAttrOrType(getEndLoc()); } } if (!(::llvm::ArrayRef(getParallelAccesses()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "parallelAccesses = "; if (!(::llvm::ArrayRef(getParallelAccesses()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { odsPrinter.printStrippedAttrOrType(getParallelAccesses()); } } } odsPrinter << ">"; } BoolAttr LoopAnnotationAttr::getDisableNonforced() const { return getImpl()->disableNonforced; } LoopVectorizeAttr LoopAnnotationAttr::getVectorize() const { return getImpl()->vectorize; } LoopInterleaveAttr LoopAnnotationAttr::getInterleave() const { return getImpl()->interleave; } LoopUnrollAttr LoopAnnotationAttr::getUnroll() const { return getImpl()->unroll; } LoopUnrollAndJamAttr LoopAnnotationAttr::getUnrollAndJam() const { return getImpl()->unrollAndJam; } LoopLICMAttr LoopAnnotationAttr::getLicm() const { return getImpl()->licm; } LoopDistributeAttr LoopAnnotationAttr::getDistribute() const { return getImpl()->distribute; } LoopPipelineAttr LoopAnnotationAttr::getPipeline() const { return getImpl()->pipeline; } LoopPeeledAttr LoopAnnotationAttr::getPeeled() const { return getImpl()->peeled; } LoopUnswitchAttr LoopAnnotationAttr::getUnswitch() const { return getImpl()->unswitch; } BoolAttr LoopAnnotationAttr::getMustProgress() const { return getImpl()->mustProgress; } BoolAttr LoopAnnotationAttr::getIsVectorized() const { return getImpl()->isVectorized; } FusedLoc LoopAnnotationAttr::getStartLoc() const { return getImpl()->startLoc; } FusedLoc LoopAnnotationAttr::getEndLoc() const { return getImpl()->endLoc; } ::llvm::ArrayRef LoopAnnotationAttr::getParallelAccesses() const { return getImpl()->parallelAccesses; } ::mlir::OpAsmAliasResult LoopAnnotationAttr::getAlias(::llvm::raw_ostream &os) const { os << "loop_annotation"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::LoopAnnotationAttr) namespace mlir::LLVM { namespace detail { struct DIExpressionElemAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple>; DIExpressionElemAttrStorage(unsigned opcode, ::llvm::ArrayRef arguments) : opcode(std::move(opcode)), arguments(std::move(arguments)) {} KeyTy getAsKey() const { return KeyTy(opcode, arguments); } bool operator==(const KeyTy &tblgenKey) const { return (opcode == std::get<0>(tblgenKey)) && (::llvm::ArrayRef(arguments) == ::llvm::ArrayRef(std::get<1>(tblgenKey))); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static DIExpressionElemAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto opcode = std::move(std::get<0>(tblgenKey)); auto arguments = std::move(std::get<1>(tblgenKey)); arguments = allocator.copyInto(arguments); return new (allocator.allocate()) DIExpressionElemAttrStorage(std::move(opcode), std::move(arguments)); } unsigned opcode; ::llvm::ArrayRef arguments; }; } // namespace detail DIExpressionElemAttr DIExpressionElemAttr::get(::mlir::MLIRContext *context, unsigned opcode, ::llvm::ArrayRef arguments) { return Base::get(context, std::move(opcode), std::move(arguments)); } ::mlir::Attribute DIExpressionElemAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_opcode; ::mlir::FailureOr<::llvm::SmallVector> _result_arguments; // Parse variable 'opcode' _result_opcode = [&]() -> FailureOr { SMLoc tagLoc = odsParser.getCurrentLocation(); StringRef name; if (odsParser.parseKeyword(&name)) return failure(); unsigned tag = llvm::dwarf::getOperationEncoding(name); if (tag == 0) return odsParser.emitError(tagLoc) << "invalid debug info debug info operation encoding name: " << name; return tag; }() ; if (::mlir::failed(_result_opcode)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIExpressionElemAttr parameter 'opcode' which is to be a `unsigned`"); return {}; } // Parse literal '(' if (odsParser.parseOptionalLParen()) { } else { { auto odsCustomLoc = odsParser.getCurrentLocation(); (void)odsCustomLoc; auto odsCustomResult = parseExpressionArg(odsParser, *_result_opcode, ::mlir::detail::unwrapForCustomParse(_result_arguments)); if (::mlir::failed(odsCustomResult)) return {}; } // Parse literal ')' if (odsParser.parseRParen()) return {}; } assert(::mlir::succeeded(_result_opcode)); return DIExpressionElemAttr::get(odsParser.getContext(), unsigned((*_result_opcode)), ::llvm::ArrayRef((_result_arguments.value_or(::llvm::SmallVector())))); } void DIExpressionElemAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << llvm::dwarf::OperationEncodingString(getOpcode()); if (!(::llvm::ArrayRef(getArguments()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { odsPrinter << "("; printExpressionArg(odsPrinter, getOpcode(), getArguments()); odsPrinter << ")"; } else { } } unsigned DIExpressionElemAttr::getOpcode() const { return getImpl()->opcode; } ::llvm::ArrayRef DIExpressionElemAttr::getArguments() const { return getImpl()->arguments; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIExpressionElemAttr) namespace mlir::LLVM { namespace detail { struct DIExpressionAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::llvm::ArrayRef>; DIExpressionAttrStorage(::llvm::ArrayRef operations) : operations(std::move(operations)) {} KeyTy getAsKey() const { return KeyTy(operations); } bool operator==(const KeyTy &tblgenKey) const { return (::llvm::ArrayRef(operations) == ::llvm::ArrayRef(std::get<0>(tblgenKey))); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static DIExpressionAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto operations = std::move(std::get<0>(tblgenKey)); operations = allocator.copyInto(operations); return new (allocator.allocate()) DIExpressionAttrStorage(std::move(operations)); } ::llvm::ArrayRef operations; }; } // namespace detail DIExpressionAttr DIExpressionAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef operations) { return Base::get(context, std::move(operations)); } ::mlir::Attribute DIExpressionAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::llvm::SmallVector> _result_operations; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse literal '[' if (odsParser.parseOptionalLSquare()) { } else { // Parse variable 'operations' _result_operations = ::mlir::FieldParser<::llvm::SmallVector>::parse(odsParser); if (::mlir::failed(_result_operations)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIExpressionAttr parameter 'operations' which is to be a `::llvm::ArrayRef`"); return {}; } // Parse literal ']' if (odsParser.parseRSquare()) return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; return DIExpressionAttr::get(odsParser.getContext(), ::llvm::ArrayRef((_result_operations.value_or(::llvm::SmallVector())))); } void DIExpressionAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; if (!(::llvm::ArrayRef(getOperations()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { odsPrinter << "["; if (!(::llvm::ArrayRef(getOperations()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { odsPrinter.printStrippedAttrOrType(getOperations()); } odsPrinter << "]"; } else { } odsPrinter << ">"; } ::llvm::ArrayRef DIExpressionAttr::getOperations() const { return getImpl()->operations; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIExpressionAttr) namespace mlir::LLVM { ::mlir::OpAsmAliasResult DINullTypeAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_null_type"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DINullTypeAttr) namespace mlir::LLVM { namespace detail { struct DIBasicTypeAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; DIBasicTypeAttrStorage(unsigned tag, StringAttr name, uint64_t sizeInBits, unsigned encoding) : tag(std::move(tag)), name(std::move(name)), sizeInBits(std::move(sizeInBits)), encoding(std::move(encoding)) {} KeyTy getAsKey() const { return KeyTy(tag, name, sizeInBits, encoding); } bool operator==(const KeyTy &tblgenKey) const { return (tag == std::get<0>(tblgenKey)) && (name == std::get<1>(tblgenKey)) && (sizeInBits == std::get<2>(tblgenKey)) && (encoding == std::get<3>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); } static DIBasicTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto tag = std::move(std::get<0>(tblgenKey)); auto name = std::move(std::get<1>(tblgenKey)); auto sizeInBits = std::move(std::get<2>(tblgenKey)); auto encoding = std::move(std::get<3>(tblgenKey)); return new (allocator.allocate()) DIBasicTypeAttrStorage(std::move(tag), std::move(name), std::move(sizeInBits), std::move(encoding)); } unsigned tag; StringAttr name; uint64_t sizeInBits; unsigned encoding; }; } // namespace detail DIBasicTypeAttr DIBasicTypeAttr::get(::mlir::MLIRContext *context, unsigned tag, StringAttr name, uint64_t sizeInBits, unsigned encoding) { return Base::get(context, std::move(tag), std::move(name), std::move(sizeInBits), std::move(encoding)); } DIBasicTypeAttr DIBasicTypeAttr::get(::mlir::MLIRContext *context, unsigned tag, const Twine &name, uint64_t sizeInBits, unsigned encoding) { return Base::get(context, tag, StringAttr::get(context, name), sizeInBits, encoding); } ::mlir::Attribute DIBasicTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_tag; ::mlir::FailureOr _result_name; ::mlir::FailureOr _result_sizeInBits; ::mlir::FailureOr _result_encoding; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_tag = false; bool _seen_name = false; bool _seen_sizeInBits = false; bool _seen_encoding = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_tag && _paramKey == "tag") { _seen_tag = true; // Parse variable 'tag' _result_tag = [&]() -> FailureOr { SMLoc tagLoc = odsParser.getCurrentLocation(); StringRef name; if (odsParser.parseKeyword(&name)) return failure(); unsigned tag = llvm::dwarf::getTag(name); if (tag == llvm::dwarf::DW_TAG_invalid) return odsParser.emitError(tagLoc) << "invalid debug info debug info tag name: " << name; return tag; }() ; if (::mlir::failed(_result_tag)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIBasicTypeAttr parameter 'tag' which is to be a `unsigned`"); return {}; } } else if (!_seen_name && _paramKey == "name") { _seen_name = true; // Parse variable 'name' _result_name = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_name)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIBasicTypeAttr parameter 'name' which is to be a `StringAttr`"); return {}; } } else if (!_seen_sizeInBits && _paramKey == "sizeInBits") { _seen_sizeInBits = true; // Parse variable 'sizeInBits' _result_sizeInBits = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_sizeInBits)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIBasicTypeAttr parameter 'sizeInBits' which is to be a `uint64_t`"); return {}; } } else if (!_seen_encoding && _paramKey == "encoding") { _seen_encoding = true; // Parse variable 'encoding' _result_encoding = [&]() -> FailureOr { SMLoc tagLoc = odsParser.getCurrentLocation(); StringRef name; if (odsParser.parseKeyword(&name)) return failure(); unsigned tag = llvm::dwarf::getAttributeEncoding(name); if (tag == 0) return odsParser.emitError(tagLoc) << "invalid debug info debug info encoding name: " << name; return tag; }() ; if (::mlir::failed(_result_encoding)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIBasicTypeAttr parameter 'encoding' which is to be a `unsigned`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return DIBasicTypeAttr::get(odsParser.getContext(), unsigned((_result_tag.value_or(0))), StringAttr((_result_name.value_or(StringAttr()))), uint64_t((_result_sizeInBits.value_or(uint64_t()))), unsigned((_result_encoding.value_or(0)))); } void DIBasicTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getTag() == 0)) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "tag = "; if (!(getTag() == 0)) { odsPrinter << llvm::dwarf::TagString(getTag()); } } if (!(getName() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "name = "; if (!(getName() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getName()); } } if (!(getSizeInBits() == uint64_t())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "sizeInBits = "; if (!(getSizeInBits() == uint64_t())) { odsPrinter.printStrippedAttrOrType(getSizeInBits()); } } if (!(getEncoding() == 0)) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "encoding = "; if (!(getEncoding() == 0)) { odsPrinter << llvm::dwarf::AttributeEncodingString(getEncoding()); } } } odsPrinter << ">"; } unsigned DIBasicTypeAttr::getTag() const { return getImpl()->tag; } StringAttr DIBasicTypeAttr::getName() const { return getImpl()->name; } uint64_t DIBasicTypeAttr::getSizeInBits() const { return getImpl()->sizeInBits; } unsigned DIBasicTypeAttr::getEncoding() const { return getImpl()->encoding; } ::mlir::OpAsmAliasResult DIBasicTypeAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_basic_type"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIBasicTypeAttr) namespace mlir::LLVM { namespace detail { struct DICompileUnitAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple>; DICompileUnitAttrStorage(DistinctAttr recId, bool isRecSelf, DistinctAttr id, unsigned sourceLanguage, DIFileAttr file, StringAttr producer, bool isOptimized, DIEmissionKind emissionKind, bool isDebugInfoForProfiling, DINameTableKind nameTableKind, StringAttr splitDebugFilename, ::llvm::ArrayRef importedEntities) : recId(std::move(recId)), isRecSelf(std::move(isRecSelf)), id(std::move(id)), sourceLanguage(std::move(sourceLanguage)), file(std::move(file)), producer(std::move(producer)), isOptimized(std::move(isOptimized)), emissionKind(std::move(emissionKind)), isDebugInfoForProfiling(std::move(isDebugInfoForProfiling)), nameTableKind(std::move(nameTableKind)), splitDebugFilename(std::move(splitDebugFilename)), importedEntities(std::move(importedEntities)) {} KeyTy getAsKey() const { return KeyTy(recId, isRecSelf, id, sourceLanguage, file, producer, isOptimized, emissionKind, isDebugInfoForProfiling, nameTableKind, splitDebugFilename, importedEntities); } bool operator==(const KeyTy &tblgenKey) const { return (recId == std::get<0>(tblgenKey)) && (isRecSelf == std::get<1>(tblgenKey)) && (id == std::get<2>(tblgenKey)) && (sourceLanguage == std::get<3>(tblgenKey)) && (file == std::get<4>(tblgenKey)) && (producer == std::get<5>(tblgenKey)) && (isOptimized == std::get<6>(tblgenKey)) && (emissionKind == std::get<7>(tblgenKey)) && (isDebugInfoForProfiling == std::get<8>(tblgenKey)) && (nameTableKind == std::get<9>(tblgenKey)) && (splitDebugFilename == std::get<10>(tblgenKey)) && (::llvm::ArrayRef(importedEntities) == ::llvm::ArrayRef(std::get<11>(tblgenKey))); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey), std::get<7>(tblgenKey), std::get<8>(tblgenKey), std::get<9>(tblgenKey), std::get<10>(tblgenKey), std::get<11>(tblgenKey)); } static DICompileUnitAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto recId = std::move(std::get<0>(tblgenKey)); auto isRecSelf = std::move(std::get<1>(tblgenKey)); auto id = std::move(std::get<2>(tblgenKey)); auto sourceLanguage = std::move(std::get<3>(tblgenKey)); auto file = std::move(std::get<4>(tblgenKey)); auto producer = std::move(std::get<5>(tblgenKey)); auto isOptimized = std::move(std::get<6>(tblgenKey)); auto emissionKind = std::move(std::get<7>(tblgenKey)); auto isDebugInfoForProfiling = std::move(std::get<8>(tblgenKey)); auto nameTableKind = std::move(std::get<9>(tblgenKey)); auto splitDebugFilename = std::move(std::get<10>(tblgenKey)); auto importedEntities = std::move(std::get<11>(tblgenKey)); importedEntities = allocator.copyInto(importedEntities); return new (allocator.allocate()) DICompileUnitAttrStorage(std::move(recId), std::move(isRecSelf), std::move(id), std::move(sourceLanguage), std::move(file), std::move(producer), std::move(isOptimized), std::move(emissionKind), std::move(isDebugInfoForProfiling), std::move(nameTableKind), std::move(splitDebugFilename), std::move(importedEntities)); } DistinctAttr recId; bool isRecSelf; DistinctAttr id; unsigned sourceLanguage; DIFileAttr file; StringAttr producer; bool isOptimized; DIEmissionKind emissionKind; bool isDebugInfoForProfiling; DINameTableKind nameTableKind; StringAttr splitDebugFilename; ::llvm::ArrayRef importedEntities; }; } // namespace detail DICompileUnitAttr DICompileUnitAttr::get(::mlir::MLIRContext *context, DistinctAttr recId, bool isRecSelf, DistinctAttr id, unsigned sourceLanguage, DIFileAttr file, StringAttr producer, bool isOptimized, DIEmissionKind emissionKind, bool isDebugInfoForProfiling, DINameTableKind nameTableKind, StringAttr splitDebugFilename, ::llvm::ArrayRef importedEntities) { return Base::get(context, std::move(recId), std::move(isRecSelf), std::move(id), std::move(sourceLanguage), std::move(file), std::move(producer), std::move(isOptimized), std::move(emissionKind), std::move(isDebugInfoForProfiling), std::move(nameTableKind), std::move(splitDebugFilename), std::move(importedEntities)); } DICompileUnitAttr DICompileUnitAttr::get(DistinctAttr id, unsigned sourceLanguage, DIFileAttr file, StringAttr producer, bool isOptimized, DIEmissionKind emissionKind, bool isDebugInfoForProfiling, DINameTableKind nameTableKind, StringAttr splitDebugFilename, ArrayRef importedEntities) { return Base::get(id.getContext(), /*recId=*/nullptr, /*isRecSelf=*/false, id, sourceLanguage, file, producer, isOptimized, emissionKind, isDebugInfoForProfiling, nameTableKind, splitDebugFilename, importedEntities); } ::mlir::Attribute DICompileUnitAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_recId; ::mlir::FailureOr _result_isRecSelf; ::mlir::FailureOr _result_id; ::mlir::FailureOr _result_sourceLanguage; ::mlir::FailureOr _result_file; ::mlir::FailureOr _result_producer; ::mlir::FailureOr _result_isOptimized; ::mlir::FailureOr _result_emissionKind; ::mlir::FailureOr _result_isDebugInfoForProfiling; ::mlir::FailureOr _result_nameTableKind; ::mlir::FailureOr _result_splitDebugFilename; ::mlir::FailureOr<::llvm::SmallVector> _result_importedEntities; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_recId = false; bool _seen_isRecSelf = false; bool _seen_id = false; bool _seen_sourceLanguage = false; bool _seen_file = false; bool _seen_producer = false; bool _seen_isOptimized = false; bool _seen_emissionKind = false; bool _seen_isDebugInfoForProfiling = false; bool _seen_nameTableKind = false; bool _seen_splitDebugFilename = false; bool _seen_importedEntities = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_recId && _paramKey == "recId") { _seen_recId = true; // Parse variable 'recId' _result_recId = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_recId)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'recId' which is to be a `DistinctAttr`"); return {}; } } else if (!_seen_isRecSelf && _paramKey == "isRecSelf") { _seen_isRecSelf = true; // Parse variable 'isRecSelf' _result_isRecSelf = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_isRecSelf)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'isRecSelf' which is to be a `bool`"); return {}; } } else if (!_seen_id && _paramKey == "id") { _seen_id = true; // Parse variable 'id' _result_id = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_id)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'id' which is to be a `DistinctAttr`"); return {}; } } else if (!_seen_sourceLanguage && _paramKey == "sourceLanguage") { _seen_sourceLanguage = true; // Parse variable 'sourceLanguage' _result_sourceLanguage = [&]() -> FailureOr { SMLoc tagLoc = odsParser.getCurrentLocation(); StringRef name; if (odsParser.parseKeyword(&name)) return failure(); unsigned tag = llvm::dwarf::getLanguage(name); if (tag == 0) return odsParser.emitError(tagLoc) << "invalid debug info debug info language name: " << name; return tag; }() ; if (::mlir::failed(_result_sourceLanguage)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'sourceLanguage' which is to be a `unsigned`"); return {}; } } else if (!_seen_file && _paramKey == "file") { _seen_file = true; // Parse variable 'file' _result_file = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_file)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'file' which is to be a `DIFileAttr`"); return {}; } } else if (!_seen_producer && _paramKey == "producer") { _seen_producer = true; // Parse variable 'producer' _result_producer = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_producer)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'producer' which is to be a `StringAttr`"); return {}; } } else if (!_seen_isOptimized && _paramKey == "isOptimized") { _seen_isOptimized = true; // Parse variable 'isOptimized' _result_isOptimized = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_isOptimized)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'isOptimized' which is to be a `bool`"); return {}; } } else if (!_seen_emissionKind && _paramKey == "emissionKind") { _seen_emissionKind = true; // Parse variable 'emissionKind' _result_emissionKind = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_emissionKind)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'emissionKind' which is to be a `DIEmissionKind`"); return {}; } } else if (!_seen_isDebugInfoForProfiling && _paramKey == "isDebugInfoForProfiling") { _seen_isDebugInfoForProfiling = true; // Parse variable 'isDebugInfoForProfiling' _result_isDebugInfoForProfiling = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_isDebugInfoForProfiling)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'isDebugInfoForProfiling' which is to be a `bool`"); return {}; } } else if (!_seen_nameTableKind && _paramKey == "nameTableKind") { _seen_nameTableKind = true; // Parse variable 'nameTableKind' _result_nameTableKind = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_nameTableKind)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'nameTableKind' which is to be a `DINameTableKind`"); return {}; } } else if (!_seen_splitDebugFilename && _paramKey == "splitDebugFilename") { _seen_splitDebugFilename = true; // Parse variable 'splitDebugFilename' _result_splitDebugFilename = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_splitDebugFilename)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'splitDebugFilename' which is to be a `StringAttr`"); return {}; } } else if (!_seen_importedEntities && _paramKey == "importedEntities") { _seen_importedEntities = true; // Parse variable 'importedEntities' _result_importedEntities = ::mlir::FieldParser<::llvm::SmallVector>::parse(odsParser); if (::mlir::failed(_result_importedEntities)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompileUnitAttr parameter 'importedEntities' which is to be a `::llvm::ArrayRef`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return DICompileUnitAttr::get(odsParser.getContext(), DistinctAttr((_result_recId.value_or(DistinctAttr()))), bool((_result_isRecSelf.value_or(bool()))), DistinctAttr((_result_id.value_or(DistinctAttr()))), unsigned((_result_sourceLanguage.value_or(0))), DIFileAttr((_result_file.value_or(DIFileAttr()))), StringAttr((_result_producer.value_or(StringAttr()))), bool((_result_isOptimized.value_or(bool()))), DIEmissionKind((_result_emissionKind.value_or(DIEmissionKind()))), bool((_result_isDebugInfoForProfiling.value_or(bool()))), DINameTableKind((_result_nameTableKind.value_or(DINameTableKind()))), StringAttr((_result_splitDebugFilename.value_or(StringAttr()))), ::llvm::ArrayRef((_result_importedEntities.value_or(::llvm::SmallVector())))); } void DICompileUnitAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getRecId() == DistinctAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "recId = "; if (!(getRecId() == DistinctAttr())) { odsPrinter.printStrippedAttrOrType(getRecId()); } } if (!(getIsRecSelf() == bool())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "isRecSelf = "; if (!(getIsRecSelf() == bool())) { odsPrinter.printStrippedAttrOrType(getIsRecSelf()); } } if (!(getId() == DistinctAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "id = "; if (!(getId() == DistinctAttr())) { odsPrinter.printStrippedAttrOrType(getId()); } } if (!(getSourceLanguage() == 0)) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "sourceLanguage = "; if (!(getSourceLanguage() == 0)) { odsPrinter << llvm::dwarf::LanguageString(getSourceLanguage()); } } if (!(getFile() == DIFileAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "file = "; if (!(getFile() == DIFileAttr())) { odsPrinter.printStrippedAttrOrType(getFile()); } } if (!(getProducer() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "producer = "; if (!(getProducer() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getProducer()); } } if (!(getIsOptimized() == bool())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "isOptimized = "; if (!(getIsOptimized() == bool())) { odsPrinter.printStrippedAttrOrType(getIsOptimized()); } } if (!(getEmissionKind() == DIEmissionKind())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "emissionKind = "; if (!(getEmissionKind() == DIEmissionKind())) { odsPrinter.printStrippedAttrOrType(getEmissionKind()); } } if (!(getIsDebugInfoForProfiling() == bool())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "isDebugInfoForProfiling = "; if (!(getIsDebugInfoForProfiling() == bool())) { odsPrinter.printStrippedAttrOrType(getIsDebugInfoForProfiling()); } } if (!(getNameTableKind() == DINameTableKind())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "nameTableKind = "; if (!(getNameTableKind() == DINameTableKind())) { odsPrinter.printStrippedAttrOrType(getNameTableKind()); } } if (!(getSplitDebugFilename() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "splitDebugFilename = "; if (!(getSplitDebugFilename() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getSplitDebugFilename()); } } if (!(::llvm::ArrayRef(getImportedEntities()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "importedEntities = "; if (!(::llvm::ArrayRef(getImportedEntities()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { odsPrinter.printStrippedAttrOrType(getImportedEntities()); } } } odsPrinter << ">"; } DistinctAttr DICompileUnitAttr::getRecId() const { return getImpl()->recId; } bool DICompileUnitAttr::getIsRecSelf() const { return getImpl()->isRecSelf; } DistinctAttr DICompileUnitAttr::getId() const { return getImpl()->id; } unsigned DICompileUnitAttr::getSourceLanguage() const { return getImpl()->sourceLanguage; } DIFileAttr DICompileUnitAttr::getFile() const { return getImpl()->file; } StringAttr DICompileUnitAttr::getProducer() const { return getImpl()->producer; } bool DICompileUnitAttr::getIsOptimized() const { return getImpl()->isOptimized; } DIEmissionKind DICompileUnitAttr::getEmissionKind() const { return getImpl()->emissionKind; } bool DICompileUnitAttr::getIsDebugInfoForProfiling() const { return getImpl()->isDebugInfoForProfiling; } DINameTableKind DICompileUnitAttr::getNameTableKind() const { return getImpl()->nameTableKind; } StringAttr DICompileUnitAttr::getSplitDebugFilename() const { return getImpl()->splitDebugFilename; } ::llvm::ArrayRef DICompileUnitAttr::getImportedEntities() const { return getImpl()->importedEntities; } ::mlir::OpAsmAliasResult DICompileUnitAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_compile_unit"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DICompileUnitAttr) namespace mlir::LLVM { namespace detail { struct DICompositeTypeAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple>; DICompositeTypeAttrStorage(DistinctAttr recId, bool isRecSelf, unsigned tag, StringAttr name, DIFileAttr file, uint32_t line, DIScopeAttr scope, DITypeAttr baseType, DIFlags flags, uint64_t sizeInBits, uint64_t alignInBits, DIExpressionAttr dataLocation, DIExpressionAttr rank, DIExpressionAttr allocated, DIExpressionAttr associated, StringAttr identifier, DIDerivedTypeAttr discriminator, ::llvm::ArrayRef elements) : recId(std::move(recId)), isRecSelf(std::move(isRecSelf)), tag(std::move(tag)), name(std::move(name)), file(std::move(file)), line(std::move(line)), scope(std::move(scope)), baseType(std::move(baseType)), flags(std::move(flags)), sizeInBits(std::move(sizeInBits)), alignInBits(std::move(alignInBits)), dataLocation(std::move(dataLocation)), rank(std::move(rank)), allocated(std::move(allocated)), associated(std::move(associated)), identifier(std::move(identifier)), discriminator(std::move(discriminator)), elements(std::move(elements)) {} KeyTy getAsKey() const { return KeyTy(recId, isRecSelf, tag, name, file, line, scope, baseType, flags, sizeInBits, alignInBits, dataLocation, rank, allocated, associated, identifier, discriminator, elements); } bool operator==(const KeyTy &tblgenKey) const { return (recId == std::get<0>(tblgenKey)) && (isRecSelf == std::get<1>(tblgenKey)) && (tag == std::get<2>(tblgenKey)) && (name == std::get<3>(tblgenKey)) && (file == std::get<4>(tblgenKey)) && (line == std::get<5>(tblgenKey)) && (scope == std::get<6>(tblgenKey)) && (baseType == std::get<7>(tblgenKey)) && (flags == std::get<8>(tblgenKey)) && (sizeInBits == std::get<9>(tblgenKey)) && (alignInBits == std::get<10>(tblgenKey)) && (dataLocation == std::get<11>(tblgenKey)) && (rank == std::get<12>(tblgenKey)) && (allocated == std::get<13>(tblgenKey)) && (associated == std::get<14>(tblgenKey)) && (identifier == std::get<15>(tblgenKey)) && (discriminator == std::get<16>(tblgenKey)) && (::llvm::ArrayRef(elements) == ::llvm::ArrayRef(std::get<17>(tblgenKey))); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey), std::get<7>(tblgenKey), std::get<8>(tblgenKey), std::get<9>(tblgenKey), std::get<10>(tblgenKey), std::get<11>(tblgenKey), std::get<12>(tblgenKey), std::get<13>(tblgenKey), std::get<14>(tblgenKey), std::get<15>(tblgenKey), std::get<16>(tblgenKey), std::get<17>(tblgenKey)); } static DICompositeTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto recId = std::move(std::get<0>(tblgenKey)); auto isRecSelf = std::move(std::get<1>(tblgenKey)); auto tag = std::move(std::get<2>(tblgenKey)); auto name = std::move(std::get<3>(tblgenKey)); auto file = std::move(std::get<4>(tblgenKey)); auto line = std::move(std::get<5>(tblgenKey)); auto scope = std::move(std::get<6>(tblgenKey)); auto baseType = std::move(std::get<7>(tblgenKey)); auto flags = std::move(std::get<8>(tblgenKey)); auto sizeInBits = std::move(std::get<9>(tblgenKey)); auto alignInBits = std::move(std::get<10>(tblgenKey)); auto dataLocation = std::move(std::get<11>(tblgenKey)); auto rank = std::move(std::get<12>(tblgenKey)); auto allocated = std::move(std::get<13>(tblgenKey)); auto associated = std::move(std::get<14>(tblgenKey)); auto identifier = std::move(std::get<15>(tblgenKey)); auto discriminator = std::move(std::get<16>(tblgenKey)); auto elements = std::move(std::get<17>(tblgenKey)); elements = allocator.copyInto(elements); return new (allocator.allocate()) DICompositeTypeAttrStorage(std::move(recId), std::move(isRecSelf), std::move(tag), std::move(name), std::move(file), std::move(line), std::move(scope), std::move(baseType), std::move(flags), std::move(sizeInBits), std::move(alignInBits), std::move(dataLocation), std::move(rank), std::move(allocated), std::move(associated), std::move(identifier), std::move(discriminator), std::move(elements)); } DistinctAttr recId; bool isRecSelf; unsigned tag; StringAttr name; DIFileAttr file; uint32_t line; DIScopeAttr scope; DITypeAttr baseType; DIFlags flags; uint64_t sizeInBits; uint64_t alignInBits; DIExpressionAttr dataLocation; DIExpressionAttr rank; DIExpressionAttr allocated; DIExpressionAttr associated; StringAttr identifier; DIDerivedTypeAttr discriminator; ::llvm::ArrayRef elements; }; } // namespace detail DICompositeTypeAttr DICompositeTypeAttr::get(::mlir::MLIRContext *context, DistinctAttr recId, bool isRecSelf, unsigned tag, StringAttr name, DIFileAttr file, uint32_t line, DIScopeAttr scope, DITypeAttr baseType, DIFlags flags, uint64_t sizeInBits, uint64_t alignInBits, DIExpressionAttr dataLocation, DIExpressionAttr rank, DIExpressionAttr allocated, DIExpressionAttr associated, StringAttr identifier, DIDerivedTypeAttr discriminator, ::llvm::ArrayRef elements) { return Base::get(context, std::move(recId), std::move(isRecSelf), std::move(tag), std::move(name), std::move(file), std::move(line), std::move(scope), std::move(baseType), std::move(flags), std::move(sizeInBits), std::move(alignInBits), std::move(dataLocation), std::move(rank), std::move(allocated), std::move(associated), std::move(identifier), std::move(discriminator), std::move(elements)); } DICompositeTypeAttr DICompositeTypeAttr::get(::mlir::MLIRContext *context, unsigned tag, StringAttr name, DIFileAttr file, uint32_t line, DIScopeAttr scope, DITypeAttr baseType, DIFlags flags, uint64_t sizeInBits, uint64_t alignInBits, DIExpressionAttr dataLocation, DIExpressionAttr rank, DIExpressionAttr allocated, DIExpressionAttr associated, StringAttr identifier, DIDerivedTypeAttr discriminator, ArrayRef elements) { return Base::get(context, /*recId=*/nullptr, /*isRecSelf=*/false, tag, name, file, line, scope, baseType, flags, sizeInBits, alignInBits, dataLocation, rank, allocated, associated, identifier, discriminator, elements); } ::mlir::Attribute DICompositeTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_recId; ::mlir::FailureOr _result_isRecSelf; ::mlir::FailureOr _result_tag; ::mlir::FailureOr _result_name; ::mlir::FailureOr _result_file; ::mlir::FailureOr _result_line; ::mlir::FailureOr _result_scope; ::mlir::FailureOr _result_baseType; ::mlir::FailureOr _result_flags; ::mlir::FailureOr _result_sizeInBits; ::mlir::FailureOr _result_alignInBits; ::mlir::FailureOr _result_dataLocation; ::mlir::FailureOr _result_rank; ::mlir::FailureOr _result_allocated; ::mlir::FailureOr _result_associated; ::mlir::FailureOr _result_identifier; ::mlir::FailureOr _result_discriminator; ::mlir::FailureOr<::llvm::SmallVector> _result_elements; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_recId = false; bool _seen_isRecSelf = false; bool _seen_tag = false; bool _seen_name = false; bool _seen_file = false; bool _seen_line = false; bool _seen_scope = false; bool _seen_baseType = false; bool _seen_flags = false; bool _seen_sizeInBits = false; bool _seen_alignInBits = false; bool _seen_dataLocation = false; bool _seen_rank = false; bool _seen_allocated = false; bool _seen_associated = false; bool _seen_identifier = false; bool _seen_discriminator = false; bool _seen_elements = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_recId && _paramKey == "recId") { _seen_recId = true; // Parse variable 'recId' _result_recId = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_recId)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'recId' which is to be a `DistinctAttr`"); return {}; } } else if (!_seen_isRecSelf && _paramKey == "isRecSelf") { _seen_isRecSelf = true; // Parse variable 'isRecSelf' _result_isRecSelf = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_isRecSelf)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'isRecSelf' which is to be a `bool`"); return {}; } } else if (!_seen_tag && _paramKey == "tag") { _seen_tag = true; // Parse variable 'tag' _result_tag = [&]() -> FailureOr { SMLoc tagLoc = odsParser.getCurrentLocation(); StringRef name; if (odsParser.parseKeyword(&name)) return failure(); unsigned tag = llvm::dwarf::getTag(name); if (tag == llvm::dwarf::DW_TAG_invalid) return odsParser.emitError(tagLoc) << "invalid debug info debug info tag name: " << name; return tag; }() ; if (::mlir::failed(_result_tag)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'tag' which is to be a `unsigned`"); return {}; } } else if (!_seen_name && _paramKey == "name") { _seen_name = true; // Parse variable 'name' _result_name = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_name)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'name' which is to be a `StringAttr`"); return {}; } } else if (!_seen_file && _paramKey == "file") { _seen_file = true; // Parse variable 'file' _result_file = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_file)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'file' which is to be a `DIFileAttr`"); return {}; } } else if (!_seen_line && _paramKey == "line") { _seen_line = true; // Parse variable 'line' _result_line = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_line)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'line' which is to be a `uint32_t`"); return {}; } } else if (!_seen_scope && _paramKey == "scope") { _seen_scope = true; // Parse variable 'scope' _result_scope = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_scope)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'scope' which is to be a `DIScopeAttr`"); return {}; } } else if (!_seen_baseType && _paramKey == "baseType") { _seen_baseType = true; // Parse variable 'baseType' _result_baseType = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_baseType)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'baseType' which is to be a `DITypeAttr`"); return {}; } } else if (!_seen_flags && _paramKey == "flags") { _seen_flags = true; // Parse variable 'flags' _result_flags = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_flags)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'flags' which is to be a `DIFlags`"); return {}; } } else if (!_seen_sizeInBits && _paramKey == "sizeInBits") { _seen_sizeInBits = true; // Parse variable 'sizeInBits' _result_sizeInBits = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_sizeInBits)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'sizeInBits' which is to be a `uint64_t`"); return {}; } } else if (!_seen_alignInBits && _paramKey == "alignInBits") { _seen_alignInBits = true; // Parse variable 'alignInBits' _result_alignInBits = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_alignInBits)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'alignInBits' which is to be a `uint64_t`"); return {}; } } else if (!_seen_dataLocation && _paramKey == "dataLocation") { _seen_dataLocation = true; // Parse variable 'dataLocation' _result_dataLocation = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_dataLocation)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'dataLocation' which is to be a `DIExpressionAttr`"); return {}; } } else if (!_seen_rank && _paramKey == "rank") { _seen_rank = true; // Parse variable 'rank' _result_rank = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_rank)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'rank' which is to be a `DIExpressionAttr`"); return {}; } } else if (!_seen_allocated && _paramKey == "allocated") { _seen_allocated = true; // Parse variable 'allocated' _result_allocated = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_allocated)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'allocated' which is to be a `DIExpressionAttr`"); return {}; } } else if (!_seen_associated && _paramKey == "associated") { _seen_associated = true; // Parse variable 'associated' _result_associated = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_associated)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'associated' which is to be a `DIExpressionAttr`"); return {}; } } else if (!_seen_identifier && _paramKey == "identifier") { _seen_identifier = true; // Parse variable 'identifier' _result_identifier = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_identifier)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'identifier' which is to be a `StringAttr`"); return {}; } } else if (!_seen_discriminator && _paramKey == "discriminator") { _seen_discriminator = true; // Parse variable 'discriminator' _result_discriminator = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_discriminator)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'discriminator' which is to be a `DIDerivedTypeAttr`"); return {}; } } else if (!_seen_elements && _paramKey == "elements") { _seen_elements = true; // Parse variable 'elements' _result_elements = ::mlir::FieldParser<::llvm::SmallVector>::parse(odsParser); if (::mlir::failed(_result_elements)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICompositeTypeAttr parameter 'elements' which is to be a `::llvm::ArrayRef`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return DICompositeTypeAttr::get(odsParser.getContext(), DistinctAttr((_result_recId.value_or(DistinctAttr()))), bool((_result_isRecSelf.value_or(bool()))), unsigned((_result_tag.value_or(0))), StringAttr((_result_name.value_or(StringAttr()))), DIFileAttr((_result_file.value_or(DIFileAttr()))), uint32_t((_result_line.value_or(uint32_t()))), DIScopeAttr((_result_scope.value_or(DIScopeAttr()))), DITypeAttr((_result_baseType.value_or(DITypeAttr()))), DIFlags((_result_flags.value_or(DIFlags()))), uint64_t((_result_sizeInBits.value_or(uint64_t()))), uint64_t((_result_alignInBits.value_or(uint64_t()))), DIExpressionAttr((_result_dataLocation.value_or(DIExpressionAttr()))), DIExpressionAttr((_result_rank.value_or(DIExpressionAttr()))), DIExpressionAttr((_result_allocated.value_or(DIExpressionAttr()))), DIExpressionAttr((_result_associated.value_or(DIExpressionAttr()))), StringAttr((_result_identifier.value_or(StringAttr()))), DIDerivedTypeAttr((_result_discriminator.value_or(DIDerivedTypeAttr()))), ::llvm::ArrayRef((_result_elements.value_or(::llvm::SmallVector())))); } void DICompositeTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getRecId() == DistinctAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "recId = "; if (!(getRecId() == DistinctAttr())) { odsPrinter.printStrippedAttrOrType(getRecId()); } } if (!(getIsRecSelf() == bool())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "isRecSelf = "; if (!(getIsRecSelf() == bool())) { odsPrinter.printStrippedAttrOrType(getIsRecSelf()); } } if (!(getTag() == 0)) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "tag = "; if (!(getTag() == 0)) { odsPrinter << llvm::dwarf::TagString(getTag()); } } if (!(getName() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "name = "; if (!(getName() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getName()); } } if (!(getFile() == DIFileAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "file = "; if (!(getFile() == DIFileAttr())) { odsPrinter.printStrippedAttrOrType(getFile()); } } if (!(getLine() == uint32_t())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "line = "; if (!(getLine() == uint32_t())) { odsPrinter.printStrippedAttrOrType(getLine()); } } if (!(getScope() == DIScopeAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "scope = "; if (!(getScope() == DIScopeAttr())) { odsPrinter.printStrippedAttrOrType(getScope()); } } if (!(getBaseType() == DITypeAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "baseType = "; if (!(getBaseType() == DITypeAttr())) { odsPrinter.printStrippedAttrOrType(getBaseType()); } } if (!(getFlags() == DIFlags())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "flags = "; if (!(getFlags() == DIFlags())) { odsPrinter.printStrippedAttrOrType(getFlags()); } } if (!(getSizeInBits() == uint64_t())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "sizeInBits = "; if (!(getSizeInBits() == uint64_t())) { odsPrinter.printStrippedAttrOrType(getSizeInBits()); } } if (!(getAlignInBits() == uint64_t())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "alignInBits = "; if (!(getAlignInBits() == uint64_t())) { odsPrinter.printStrippedAttrOrType(getAlignInBits()); } } if (!(getDataLocation() == DIExpressionAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "dataLocation = "; if (!(getDataLocation() == DIExpressionAttr())) { odsPrinter.printStrippedAttrOrType(getDataLocation()); } } if (!(getRank() == DIExpressionAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "rank = "; if (!(getRank() == DIExpressionAttr())) { odsPrinter.printStrippedAttrOrType(getRank()); } } if (!(getAllocated() == DIExpressionAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "allocated = "; if (!(getAllocated() == DIExpressionAttr())) { odsPrinter.printStrippedAttrOrType(getAllocated()); } } if (!(getAssociated() == DIExpressionAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "associated = "; if (!(getAssociated() == DIExpressionAttr())) { odsPrinter.printStrippedAttrOrType(getAssociated()); } } if (!(getIdentifier() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "identifier = "; if (!(getIdentifier() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getIdentifier()); } } if (!(getDiscriminator() == DIDerivedTypeAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "discriminator = "; if (!(getDiscriminator() == DIDerivedTypeAttr())) { odsPrinter.printStrippedAttrOrType(getDiscriminator()); } } if (!(::llvm::ArrayRef(getElements()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "elements = "; if (!(::llvm::ArrayRef(getElements()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { odsPrinter.printStrippedAttrOrType(getElements()); } } } odsPrinter << ">"; } DistinctAttr DICompositeTypeAttr::getRecId() const { return getImpl()->recId; } bool DICompositeTypeAttr::getIsRecSelf() const { return getImpl()->isRecSelf; } unsigned DICompositeTypeAttr::getTag() const { return getImpl()->tag; } StringAttr DICompositeTypeAttr::getName() const { return getImpl()->name; } DIFileAttr DICompositeTypeAttr::getFile() const { return getImpl()->file; } uint32_t DICompositeTypeAttr::getLine() const { return getImpl()->line; } DIScopeAttr DICompositeTypeAttr::getScope() const { return getImpl()->scope; } DITypeAttr DICompositeTypeAttr::getBaseType() const { return getImpl()->baseType; } DIFlags DICompositeTypeAttr::getFlags() const { return getImpl()->flags; } uint64_t DICompositeTypeAttr::getSizeInBits() const { return getImpl()->sizeInBits; } uint64_t DICompositeTypeAttr::getAlignInBits() const { return getImpl()->alignInBits; } DIExpressionAttr DICompositeTypeAttr::getDataLocation() const { return getImpl()->dataLocation; } DIExpressionAttr DICompositeTypeAttr::getRank() const { return getImpl()->rank; } DIExpressionAttr DICompositeTypeAttr::getAllocated() const { return getImpl()->allocated; } DIExpressionAttr DICompositeTypeAttr::getAssociated() const { return getImpl()->associated; } StringAttr DICompositeTypeAttr::getIdentifier() const { return getImpl()->identifier; } DIDerivedTypeAttr DICompositeTypeAttr::getDiscriminator() const { return getImpl()->discriminator; } ::llvm::ArrayRef DICompositeTypeAttr::getElements() const { return getImpl()->elements; } ::mlir::OpAsmAliasResult DICompositeTypeAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_composite_type"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DICompositeTypeAttr) namespace mlir::LLVM { namespace detail { struct DIDerivedTypeAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple, DIFlags, Attribute>; DIDerivedTypeAttrStorage(unsigned tag, StringAttr name, DIFileAttr file, uint32_t line, DIScopeAttr scope, DITypeAttr baseType, uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits, std::optional dwarfAddressSpace, DIFlags flags, Attribute extraData) : tag(std::move(tag)), name(std::move(name)), file(std::move(file)), line(std::move(line)), scope(std::move(scope)), baseType(std::move(baseType)), sizeInBits(std::move(sizeInBits)), alignInBits(std::move(alignInBits)), offsetInBits(std::move(offsetInBits)), dwarfAddressSpace(std::move(dwarfAddressSpace)), flags(std::move(flags)), extraData(std::move(extraData)) {} KeyTy getAsKey() const { return KeyTy(tag, name, file, line, scope, baseType, sizeInBits, alignInBits, offsetInBits, dwarfAddressSpace, flags, extraData); } bool operator==(const KeyTy &tblgenKey) const { return (tag == std::get<0>(tblgenKey)) && (name == std::get<1>(tblgenKey)) && (file == std::get<2>(tblgenKey)) && (line == std::get<3>(tblgenKey)) && (scope == std::get<4>(tblgenKey)) && (baseType == std::get<5>(tblgenKey)) && (sizeInBits == std::get<6>(tblgenKey)) && (alignInBits == std::get<7>(tblgenKey)) && (offsetInBits == std::get<8>(tblgenKey)) && (dwarfAddressSpace == std::get<9>(tblgenKey)) && (flags == std::get<10>(tblgenKey)) && (extraData == std::get<11>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey), std::get<7>(tblgenKey), std::get<8>(tblgenKey), std::get<9>(tblgenKey), std::get<10>(tblgenKey), std::get<11>(tblgenKey)); } static DIDerivedTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto tag = std::move(std::get<0>(tblgenKey)); auto name = std::move(std::get<1>(tblgenKey)); auto file = std::move(std::get<2>(tblgenKey)); auto line = std::move(std::get<3>(tblgenKey)); auto scope = std::move(std::get<4>(tblgenKey)); auto baseType = std::move(std::get<5>(tblgenKey)); auto sizeInBits = std::move(std::get<6>(tblgenKey)); auto alignInBits = std::move(std::get<7>(tblgenKey)); auto offsetInBits = std::move(std::get<8>(tblgenKey)); auto dwarfAddressSpace = std::move(std::get<9>(tblgenKey)); auto flags = std::move(std::get<10>(tblgenKey)); auto extraData = std::move(std::get<11>(tblgenKey)); return new (allocator.allocate()) DIDerivedTypeAttrStorage(std::move(tag), std::move(name), std::move(file), std::move(line), std::move(scope), std::move(baseType), std::move(sizeInBits), std::move(alignInBits), std::move(offsetInBits), std::move(dwarfAddressSpace), std::move(flags), std::move(extraData)); } unsigned tag; StringAttr name; DIFileAttr file; uint32_t line; DIScopeAttr scope; DITypeAttr baseType; uint64_t sizeInBits; uint32_t alignInBits; uint64_t offsetInBits; std::optional dwarfAddressSpace; DIFlags flags; Attribute extraData; }; } // namespace detail DIDerivedTypeAttr DIDerivedTypeAttr::get(::mlir::MLIRContext *context, unsigned tag, StringAttr name, DIFileAttr file, uint32_t line, DIScopeAttr scope, DITypeAttr baseType, uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits, std::optional dwarfAddressSpace, DIFlags flags, Attribute extraData) { return Base::get(context, std::move(tag), std::move(name), std::move(file), std::move(line), std::move(scope), std::move(baseType), std::move(sizeInBits), std::move(alignInBits), std::move(offsetInBits), std::move(dwarfAddressSpace), std::move(flags), std::move(extraData)); } DIDerivedTypeAttr DIDerivedTypeAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, unsigned tag, StringAttr name, DIFileAttr file, uint32_t line, DIScopeAttr scope, DITypeAttr baseType, uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits, std::optional dwarfAddressSpace, DIFlags flags, Attribute extraData) { return Base::getChecked(emitError, context, std::move(tag), std::move(name), std::move(file), std::move(line), std::move(scope), std::move(baseType), std::move(sizeInBits), std::move(alignInBits), std::move(offsetInBits), std::move(dwarfAddressSpace), std::move(flags), std::move(extraData)); } ::llvm::LogicalResult DIDerivedTypeAttr::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, unsigned tag, StringAttr name, DIFileAttr file, uint32_t line, DIScopeAttr scope, DITypeAttr baseType, uint64_t sizeInBits, uint32_t alignInBits, uint64_t offsetInBits, std::optional dwarfAddressSpace, DIFlags flags, Attribute extraData) { if (::mlir::failed(verify(emitError, tag, name, file, line, scope, baseType, sizeInBits, alignInBits, offsetInBits, dwarfAddressSpace, flags, extraData))) return ::mlir::failure(); return ::mlir::success(); } ::mlir::Attribute DIDerivedTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_tag; ::mlir::FailureOr _result_name; ::mlir::FailureOr _result_file; ::mlir::FailureOr _result_line; ::mlir::FailureOr _result_scope; ::mlir::FailureOr _result_baseType; ::mlir::FailureOr _result_sizeInBits; ::mlir::FailureOr _result_alignInBits; ::mlir::FailureOr _result_offsetInBits; ::mlir::FailureOr> _result_dwarfAddressSpace; ::mlir::FailureOr _result_flags; ::mlir::FailureOr _result_extraData; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_tag = false; bool _seen_name = false; bool _seen_file = false; bool _seen_line = false; bool _seen_scope = false; bool _seen_baseType = false; bool _seen_sizeInBits = false; bool _seen_alignInBits = false; bool _seen_offsetInBits = false; bool _seen_dwarfAddressSpace = false; bool _seen_flags = false; bool _seen_extraData = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_tag && _paramKey == "tag") { _seen_tag = true; // Parse variable 'tag' _result_tag = [&]() -> FailureOr { SMLoc tagLoc = odsParser.getCurrentLocation(); StringRef name; if (odsParser.parseKeyword(&name)) return failure(); unsigned tag = llvm::dwarf::getTag(name); if (tag == llvm::dwarf::DW_TAG_invalid) return odsParser.emitError(tagLoc) << "invalid debug info debug info tag name: " << name; return tag; }() ; if (::mlir::failed(_result_tag)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'tag' which is to be a `unsigned`"); return {}; } } else if (!_seen_name && _paramKey == "name") { _seen_name = true; // Parse variable 'name' _result_name = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_name)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'name' which is to be a `StringAttr`"); return {}; } } else if (!_seen_file && _paramKey == "file") { _seen_file = true; // Parse variable 'file' _result_file = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_file)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'file' which is to be a `DIFileAttr`"); return {}; } } else if (!_seen_line && _paramKey == "line") { _seen_line = true; // Parse variable 'line' _result_line = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_line)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'line' which is to be a `uint32_t`"); return {}; } } else if (!_seen_scope && _paramKey == "scope") { _seen_scope = true; // Parse variable 'scope' _result_scope = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_scope)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'scope' which is to be a `DIScopeAttr`"); return {}; } } else if (!_seen_baseType && _paramKey == "baseType") { _seen_baseType = true; // Parse variable 'baseType' _result_baseType = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_baseType)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'baseType' which is to be a `DITypeAttr`"); return {}; } } else if (!_seen_sizeInBits && _paramKey == "sizeInBits") { _seen_sizeInBits = true; // Parse variable 'sizeInBits' _result_sizeInBits = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_sizeInBits)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'sizeInBits' which is to be a `uint64_t`"); return {}; } } else if (!_seen_alignInBits && _paramKey == "alignInBits") { _seen_alignInBits = true; // Parse variable 'alignInBits' _result_alignInBits = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_alignInBits)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'alignInBits' which is to be a `uint32_t`"); return {}; } } else if (!_seen_offsetInBits && _paramKey == "offsetInBits") { _seen_offsetInBits = true; // Parse variable 'offsetInBits' _result_offsetInBits = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_offsetInBits)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'offsetInBits' which is to be a `uint64_t`"); return {}; } } else if (!_seen_dwarfAddressSpace && _paramKey == "dwarfAddressSpace") { _seen_dwarfAddressSpace = true; // Parse variable 'dwarfAddressSpace' _result_dwarfAddressSpace = ::mlir::FieldParser>::parse(odsParser); if (::mlir::failed(_result_dwarfAddressSpace)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'dwarfAddressSpace' which is to be a `std::optional`"); return {}; } } else if (!_seen_flags && _paramKey == "flags") { _seen_flags = true; // Parse variable 'flags' _result_flags = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_flags)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'flags' which is to be a `DIFlags`"); return {}; } } else if (!_seen_extraData && _paramKey == "extraData") { _seen_extraData = true; // Parse variable 'extraData' _result_extraData = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_extraData)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIDerivedTypeAttr parameter 'extraData' which is to be a `Attribute`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return odsParser.getChecked(odsLoc, odsParser.getContext(), unsigned((_result_tag.value_or(0))), StringAttr((_result_name.value_or(StringAttr()))), DIFileAttr((_result_file.value_or(DIFileAttr()))), uint32_t((_result_line.value_or(uint32_t()))), DIScopeAttr((_result_scope.value_or(DIScopeAttr()))), DITypeAttr((_result_baseType.value_or(DITypeAttr()))), uint64_t((_result_sizeInBits.value_or(uint64_t()))), uint32_t((_result_alignInBits.value_or(uint32_t()))), uint64_t((_result_offsetInBits.value_or(uint64_t()))), std::optional((_result_dwarfAddressSpace.value_or(std::optional()))), DIFlags((_result_flags.value_or(DIFlags()))), Attribute((_result_extraData.value_or(Attribute())))); } void DIDerivedTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getTag() == 0)) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "tag = "; if (!(getTag() == 0)) { odsPrinter << llvm::dwarf::TagString(getTag()); } } if (!(getName() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "name = "; if (!(getName() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getName()); } } if (!(getFile() == DIFileAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "file = "; if (!(getFile() == DIFileAttr())) { odsPrinter.printStrippedAttrOrType(getFile()); } } if (!(getLine() == uint32_t())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "line = "; if (!(getLine() == uint32_t())) { odsPrinter.printStrippedAttrOrType(getLine()); } } if (!(getScope() == DIScopeAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "scope = "; if (!(getScope() == DIScopeAttr())) { odsPrinter.printStrippedAttrOrType(getScope()); } } if (!(getBaseType() == DITypeAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "baseType = "; if (!(getBaseType() == DITypeAttr())) { odsPrinter.printStrippedAttrOrType(getBaseType()); } } if (!(getSizeInBits() == uint64_t())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "sizeInBits = "; if (!(getSizeInBits() == uint64_t())) { odsPrinter.printStrippedAttrOrType(getSizeInBits()); } } if (!(getAlignInBits() == uint32_t())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "alignInBits = "; if (!(getAlignInBits() == uint32_t())) { odsPrinter.printStrippedAttrOrType(getAlignInBits()); } } if (!(getOffsetInBits() == uint64_t())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "offsetInBits = "; if (!(getOffsetInBits() == uint64_t())) { odsPrinter.printStrippedAttrOrType(getOffsetInBits()); } } if (!(getDwarfAddressSpace() == std::optional())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "dwarfAddressSpace = "; if (!(getDwarfAddressSpace() == std::optional())) { odsPrinter.printStrippedAttrOrType(getDwarfAddressSpace()); } } if (!(getFlags() == DIFlags())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "flags = "; if (!(getFlags() == DIFlags())) { odsPrinter.printStrippedAttrOrType(getFlags()); } } if (!(getExtraData() == Attribute())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "extraData = "; if (!(getExtraData() == Attribute())) { odsPrinter.printStrippedAttrOrType(getExtraData()); } } } odsPrinter << ">"; } unsigned DIDerivedTypeAttr::getTag() const { return getImpl()->tag; } StringAttr DIDerivedTypeAttr::getName() const { return getImpl()->name; } DIFileAttr DIDerivedTypeAttr::getFile() const { return getImpl()->file; } uint32_t DIDerivedTypeAttr::getLine() const { return getImpl()->line; } DIScopeAttr DIDerivedTypeAttr::getScope() const { return getImpl()->scope; } DITypeAttr DIDerivedTypeAttr::getBaseType() const { return getImpl()->baseType; } uint64_t DIDerivedTypeAttr::getSizeInBits() const { return getImpl()->sizeInBits; } uint32_t DIDerivedTypeAttr::getAlignInBits() const { return getImpl()->alignInBits; } uint64_t DIDerivedTypeAttr::getOffsetInBits() const { return getImpl()->offsetInBits; } std::optional DIDerivedTypeAttr::getDwarfAddressSpace() const { return getImpl()->dwarfAddressSpace; } DIFlags DIDerivedTypeAttr::getFlags() const { return getImpl()->flags; } Attribute DIDerivedTypeAttr::getExtraData() const { return getImpl()->extraData; } ::mlir::OpAsmAliasResult DIDerivedTypeAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_derived_type"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIDerivedTypeAttr) namespace mlir::LLVM { namespace detail { struct DIFileAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; DIFileAttrStorage(StringAttr name, StringAttr directory) : name(std::move(name)), directory(std::move(directory)) {} KeyTy getAsKey() const { return KeyTy(name, directory); } bool operator==(const KeyTy &tblgenKey) const { return (name == std::get<0>(tblgenKey)) && (directory == std::get<1>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static DIFileAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto name = std::move(std::get<0>(tblgenKey)); auto directory = std::move(std::get<1>(tblgenKey)); return new (allocator.allocate()) DIFileAttrStorage(std::move(name), std::move(directory)); } StringAttr name; StringAttr directory; }; } // namespace detail DIFileAttr DIFileAttr::get(::mlir::MLIRContext *context, StringAttr name, StringAttr directory) { return Base::get(context, std::move(name), std::move(directory)); } DIFileAttr DIFileAttr::get(::mlir::MLIRContext *context, StringRef name, StringRef directory) { return Base::get(context, StringAttr::get(context, name), StringAttr::get(context, directory)); } ::mlir::Attribute DIFileAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_name; ::mlir::FailureOr _result_directory; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'name' _result_name = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_name)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIFileAttr parameter 'name' which is to be a `StringAttr`"); return {}; } // Parse literal 'in' if (odsParser.parseKeyword("in")) return {}; // Parse variable 'directory' _result_directory = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_directory)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIFileAttr parameter 'directory' which is to be a `StringAttr`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_name)); assert(::mlir::succeeded(_result_directory)); return DIFileAttr::get(odsParser.getContext(), StringAttr((*_result_name)), StringAttr((*_result_directory))); } void DIFileAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printStrippedAttrOrType(getName()); odsPrinter << ' ' << "in"; odsPrinter << ' '; odsPrinter.printStrippedAttrOrType(getDirectory()); odsPrinter << ">"; } StringAttr DIFileAttr::getName() const { return getImpl()->name; } StringAttr DIFileAttr::getDirectory() const { return getImpl()->directory; } ::mlir::OpAsmAliasResult DIFileAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_file"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIFileAttr) namespace mlir::LLVM { namespace detail { struct DIGlobalVariableExpressionAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; DIGlobalVariableExpressionAttrStorage(DIGlobalVariableAttr var, DIExpressionAttr expr) : var(std::move(var)), expr(std::move(expr)) {} KeyTy getAsKey() const { return KeyTy(var, expr); } bool operator==(const KeyTy &tblgenKey) const { return (var == std::get<0>(tblgenKey)) && (expr == std::get<1>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static DIGlobalVariableExpressionAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto var = std::move(std::get<0>(tblgenKey)); auto expr = std::move(std::get<1>(tblgenKey)); return new (allocator.allocate()) DIGlobalVariableExpressionAttrStorage(std::move(var), std::move(expr)); } DIGlobalVariableAttr var; DIExpressionAttr expr; }; } // namespace detail DIGlobalVariableExpressionAttr DIGlobalVariableExpressionAttr::get(::mlir::MLIRContext *context, DIGlobalVariableAttr var, DIExpressionAttr expr) { return Base::get(context, std::move(var), std::move(expr)); } ::mlir::Attribute DIGlobalVariableExpressionAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_var; ::mlir::FailureOr _result_expr; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_var = false; bool _seen_expr = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_var && _paramKey == "var") { _seen_var = true; // Parse variable 'var' _result_var = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_var)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIGlobalVariableExpressionAttr parameter 'var' which is to be a `DIGlobalVariableAttr`"); return {}; } } else if (!_seen_expr && _paramKey == "expr") { _seen_expr = true; // Parse variable 'expr' _result_expr = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_expr)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIGlobalVariableExpressionAttr parameter 'expr' which is to be a `DIExpressionAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_var) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "var"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_var)); return DIGlobalVariableExpressionAttr::get(odsParser.getContext(), DIGlobalVariableAttr((*_result_var)), DIExpressionAttr((_result_expr.value_or(DIExpressionAttr())))); } void DIGlobalVariableExpressionAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "var = "; odsPrinter.printStrippedAttrOrType(getVar()); if (!(getExpr() == DIExpressionAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "expr = "; if (!(getExpr() == DIExpressionAttr())) { odsPrinter.printStrippedAttrOrType(getExpr()); } } } odsPrinter << ">"; } DIGlobalVariableAttr DIGlobalVariableExpressionAttr::getVar() const { return getImpl()->var; } DIExpressionAttr DIGlobalVariableExpressionAttr::getExpr() const { return getImpl()->expr; } ::mlir::OpAsmAliasResult DIGlobalVariableExpressionAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_global_variable_expression"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIGlobalVariableExpressionAttr) namespace mlir::LLVM { namespace detail { struct DIGlobalVariableAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; DIGlobalVariableAttrStorage(DIScopeAttr scope, StringAttr name, StringAttr linkageName, DIFileAttr file, unsigned line, DITypeAttr type, bool isLocalToUnit, bool isDefined, unsigned alignInBits) : scope(std::move(scope)), name(std::move(name)), linkageName(std::move(linkageName)), file(std::move(file)), line(std::move(line)), type(std::move(type)), isLocalToUnit(std::move(isLocalToUnit)), isDefined(std::move(isDefined)), alignInBits(std::move(alignInBits)) {} KeyTy getAsKey() const { return KeyTy(scope, name, linkageName, file, line, type, isLocalToUnit, isDefined, alignInBits); } bool operator==(const KeyTy &tblgenKey) const { return (scope == std::get<0>(tblgenKey)) && (name == std::get<1>(tblgenKey)) && (linkageName == std::get<2>(tblgenKey)) && (file == std::get<3>(tblgenKey)) && (line == std::get<4>(tblgenKey)) && (type == std::get<5>(tblgenKey)) && (isLocalToUnit == std::get<6>(tblgenKey)) && (isDefined == std::get<7>(tblgenKey)) && (alignInBits == std::get<8>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey), std::get<7>(tblgenKey), std::get<8>(tblgenKey)); } static DIGlobalVariableAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto scope = std::move(std::get<0>(tblgenKey)); auto name = std::move(std::get<1>(tblgenKey)); auto linkageName = std::move(std::get<2>(tblgenKey)); auto file = std::move(std::get<3>(tblgenKey)); auto line = std::move(std::get<4>(tblgenKey)); auto type = std::move(std::get<5>(tblgenKey)); auto isLocalToUnit = std::move(std::get<6>(tblgenKey)); auto isDefined = std::move(std::get<7>(tblgenKey)); auto alignInBits = std::move(std::get<8>(tblgenKey)); return new (allocator.allocate()) DIGlobalVariableAttrStorage(std::move(scope), std::move(name), std::move(linkageName), std::move(file), std::move(line), std::move(type), std::move(isLocalToUnit), std::move(isDefined), std::move(alignInBits)); } DIScopeAttr scope; StringAttr name; StringAttr linkageName; DIFileAttr file; unsigned line; DITypeAttr type; bool isLocalToUnit; bool isDefined; unsigned alignInBits; }; } // namespace detail DIGlobalVariableAttr DIGlobalVariableAttr::get(::mlir::MLIRContext *context, DIScopeAttr scope, StringAttr name, StringAttr linkageName, DIFileAttr file, unsigned line, DITypeAttr type, bool isLocalToUnit, bool isDefined, unsigned alignInBits) { return Base::get(context, std::move(scope), std::move(name), std::move(linkageName), std::move(file), std::move(line), std::move(type), std::move(isLocalToUnit), std::move(isDefined), std::move(alignInBits)); } ::mlir::Attribute DIGlobalVariableAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_scope; ::mlir::FailureOr _result_name; ::mlir::FailureOr _result_linkageName; ::mlir::FailureOr _result_file; ::mlir::FailureOr _result_line; ::mlir::FailureOr _result_type; ::mlir::FailureOr _result_isLocalToUnit; ::mlir::FailureOr _result_isDefined; ::mlir::FailureOr _result_alignInBits; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_scope = false; bool _seen_name = false; bool _seen_linkageName = false; bool _seen_file = false; bool _seen_line = false; bool _seen_type = false; bool _seen_isLocalToUnit = false; bool _seen_isDefined = false; bool _seen_alignInBits = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_scope && _paramKey == "scope") { _seen_scope = true; // Parse variable 'scope' _result_scope = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_scope)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIGlobalVariable parameter 'scope' which is to be a `DIScopeAttr`"); return {}; } } else if (!_seen_name && _paramKey == "name") { _seen_name = true; // Parse variable 'name' _result_name = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_name)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIGlobalVariable parameter 'name' which is to be a `StringAttr`"); return {}; } } else if (!_seen_linkageName && _paramKey == "linkageName") { _seen_linkageName = true; // Parse variable 'linkageName' _result_linkageName = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_linkageName)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIGlobalVariable parameter 'linkageName' which is to be a `StringAttr`"); return {}; } } else if (!_seen_file && _paramKey == "file") { _seen_file = true; // Parse variable 'file' _result_file = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_file)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIGlobalVariable parameter 'file' which is to be a `DIFileAttr`"); return {}; } } else if (!_seen_line && _paramKey == "line") { _seen_line = true; // Parse variable 'line' _result_line = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_line)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIGlobalVariable parameter 'line' which is to be a `unsigned`"); return {}; } } else if (!_seen_type && _paramKey == "type") { _seen_type = true; // Parse variable 'type' _result_type = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_type)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIGlobalVariable parameter 'type' which is to be a `DITypeAttr`"); return {}; } } else if (!_seen_isLocalToUnit && _paramKey == "isLocalToUnit") { _seen_isLocalToUnit = true; // Parse variable 'isLocalToUnit' _result_isLocalToUnit = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_isLocalToUnit)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIGlobalVariable parameter 'isLocalToUnit' which is to be a `bool`"); return {}; } } else if (!_seen_isDefined && _paramKey == "isDefined") { _seen_isDefined = true; // Parse variable 'isDefined' _result_isDefined = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_isDefined)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIGlobalVariable parameter 'isDefined' which is to be a `bool`"); return {}; } } else if (!_seen_alignInBits && _paramKey == "alignInBits") { _seen_alignInBits = true; // Parse variable 'alignInBits' _result_alignInBits = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_alignInBits)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIGlobalVariable parameter 'alignInBits' which is to be a `unsigned`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_file) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "file"; return {}; } if (!_seen_line) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "line"; return {}; } if (!_seen_type) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "type"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_file)); assert(::mlir::succeeded(_result_line)); assert(::mlir::succeeded(_result_type)); return DIGlobalVariableAttr::get(odsParser.getContext(), DIScopeAttr((_result_scope.value_or(DIScopeAttr()))), StringAttr((_result_name.value_or(StringAttr()))), StringAttr((_result_linkageName.value_or(StringAttr()))), DIFileAttr((*_result_file)), unsigned((*_result_line)), DITypeAttr((*_result_type)), bool((_result_isLocalToUnit.value_or(bool()))), bool((_result_isDefined.value_or(bool()))), unsigned((_result_alignInBits.value_or(unsigned())))); } void DIGlobalVariableAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getScope() == DIScopeAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "scope = "; if (!(getScope() == DIScopeAttr())) { odsPrinter.printStrippedAttrOrType(getScope()); } } if (!(getName() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "name = "; if (!(getName() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getName()); } } if (!(getLinkageName() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "linkageName = "; if (!(getLinkageName() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getLinkageName()); } } if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "file = "; odsPrinter.printStrippedAttrOrType(getFile()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "line = "; odsPrinter.printStrippedAttrOrType(getLine()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "type = "; odsPrinter.printStrippedAttrOrType(getType()); if (!(getIsLocalToUnit() == bool())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "isLocalToUnit = "; if (!(getIsLocalToUnit() == bool())) { odsPrinter.printStrippedAttrOrType(getIsLocalToUnit()); } } if (!(getIsDefined() == bool())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "isDefined = "; if (!(getIsDefined() == bool())) { odsPrinter.printStrippedAttrOrType(getIsDefined()); } } if (!(getAlignInBits() == unsigned())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "alignInBits = "; if (!(getAlignInBits() == unsigned())) { odsPrinter.printStrippedAttrOrType(getAlignInBits()); } } } odsPrinter << ">"; } DIScopeAttr DIGlobalVariableAttr::getScope() const { return getImpl()->scope; } StringAttr DIGlobalVariableAttr::getName() const { return getImpl()->name; } StringAttr DIGlobalVariableAttr::getLinkageName() const { return getImpl()->linkageName; } DIFileAttr DIGlobalVariableAttr::getFile() const { return getImpl()->file; } unsigned DIGlobalVariableAttr::getLine() const { return getImpl()->line; } DITypeAttr DIGlobalVariableAttr::getType() const { return getImpl()->type; } bool DIGlobalVariableAttr::getIsLocalToUnit() const { return getImpl()->isLocalToUnit; } bool DIGlobalVariableAttr::getIsDefined() const { return getImpl()->isDefined; } unsigned DIGlobalVariableAttr::getAlignInBits() const { return getImpl()->alignInBits; } ::mlir::OpAsmAliasResult DIGlobalVariableAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_global_variable"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIGlobalVariableAttr) namespace mlir::LLVM { namespace detail { struct DILexicalBlockAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; DILexicalBlockAttrStorage(DIScopeAttr scope, DIFileAttr file, unsigned line, unsigned column) : scope(std::move(scope)), file(std::move(file)), line(std::move(line)), column(std::move(column)) {} KeyTy getAsKey() const { return KeyTy(scope, file, line, column); } bool operator==(const KeyTy &tblgenKey) const { return (scope == std::get<0>(tblgenKey)) && (file == std::get<1>(tblgenKey)) && (line == std::get<2>(tblgenKey)) && (column == std::get<3>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); } static DILexicalBlockAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto scope = std::move(std::get<0>(tblgenKey)); auto file = std::move(std::get<1>(tblgenKey)); auto line = std::move(std::get<2>(tblgenKey)); auto column = std::move(std::get<3>(tblgenKey)); return new (allocator.allocate()) DILexicalBlockAttrStorage(std::move(scope), std::move(file), std::move(line), std::move(column)); } DIScopeAttr scope; DIFileAttr file; unsigned line; unsigned column; }; } // namespace detail DILexicalBlockAttr DILexicalBlockAttr::get(::mlir::MLIRContext *context, DIScopeAttr scope, DIFileAttr file, unsigned line, unsigned column) { return Base::get(context, std::move(scope), std::move(file), std::move(line), std::move(column)); } DILexicalBlockAttr DILexicalBlockAttr::get(DIScopeAttr scope, DIFileAttr file, unsigned line, unsigned column) { return Base::get(scope.getContext(), scope, file, line, column); } ::mlir::Attribute DILexicalBlockAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_scope; ::mlir::FailureOr _result_file; ::mlir::FailureOr _result_line; ::mlir::FailureOr _result_column; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_scope = false; bool _seen_file = false; bool _seen_line = false; bool _seen_column = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_scope && _paramKey == "scope") { _seen_scope = true; // Parse variable 'scope' _result_scope = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_scope)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockAttr parameter 'scope' which is to be a `DIScopeAttr`"); return {}; } } else if (!_seen_file && _paramKey == "file") { _seen_file = true; // Parse variable 'file' _result_file = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_file)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockAttr parameter 'file' which is to be a `DIFileAttr`"); return {}; } } else if (!_seen_line && _paramKey == "line") { _seen_line = true; // Parse variable 'line' _result_line = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_line)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockAttr parameter 'line' which is to be a `unsigned`"); return {}; } } else if (!_seen_column && _paramKey == "column") { _seen_column = true; // Parse variable 'column' _result_column = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_column)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockAttr parameter 'column' which is to be a `unsigned`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_scope) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_scope)); return DILexicalBlockAttr::get(odsParser.getContext(), DIScopeAttr((*_result_scope)), DIFileAttr((_result_file.value_or(DIFileAttr()))), unsigned((_result_line.value_or(unsigned()))), unsigned((_result_column.value_or(unsigned())))); } void DILexicalBlockAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "scope = "; odsPrinter.printStrippedAttrOrType(getScope()); if (!(getFile() == DIFileAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "file = "; if (!(getFile() == DIFileAttr())) { odsPrinter.printStrippedAttrOrType(getFile()); } } if (!(getLine() == unsigned())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "line = "; if (!(getLine() == unsigned())) { odsPrinter.printStrippedAttrOrType(getLine()); } } if (!(getColumn() == unsigned())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "column = "; if (!(getColumn() == unsigned())) { odsPrinter.printStrippedAttrOrType(getColumn()); } } } odsPrinter << ">"; } DIScopeAttr DILexicalBlockAttr::getScope() const { return getImpl()->scope; } DIFileAttr DILexicalBlockAttr::getFile() const { return getImpl()->file; } unsigned DILexicalBlockAttr::getLine() const { return getImpl()->line; } unsigned DILexicalBlockAttr::getColumn() const { return getImpl()->column; } ::mlir::OpAsmAliasResult DILexicalBlockAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_lexical_block"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILexicalBlockAttr) namespace mlir::LLVM { namespace detail { struct DILexicalBlockFileAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; DILexicalBlockFileAttrStorage(DIScopeAttr scope, DIFileAttr file, unsigned discriminator) : scope(std::move(scope)), file(std::move(file)), discriminator(std::move(discriminator)) {} KeyTy getAsKey() const { return KeyTy(scope, file, discriminator); } bool operator==(const KeyTy &tblgenKey) const { return (scope == std::get<0>(tblgenKey)) && (file == std::get<1>(tblgenKey)) && (discriminator == std::get<2>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); } static DILexicalBlockFileAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto scope = std::move(std::get<0>(tblgenKey)); auto file = std::move(std::get<1>(tblgenKey)); auto discriminator = std::move(std::get<2>(tblgenKey)); return new (allocator.allocate()) DILexicalBlockFileAttrStorage(std::move(scope), std::move(file), std::move(discriminator)); } DIScopeAttr scope; DIFileAttr file; unsigned discriminator; }; } // namespace detail DILexicalBlockFileAttr DILexicalBlockFileAttr::get(::mlir::MLIRContext *context, DIScopeAttr scope, DIFileAttr file, unsigned discriminator) { return Base::get(context, std::move(scope), std::move(file), std::move(discriminator)); } DILexicalBlockFileAttr DILexicalBlockFileAttr::get(DIScopeAttr scope, DIFileAttr file, unsigned discriminator) { return Base::get(scope.getContext(), scope, file, discriminator); } ::mlir::Attribute DILexicalBlockFileAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_scope; ::mlir::FailureOr _result_file; ::mlir::FailureOr _result_discriminator; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_scope = false; bool _seen_file = false; bool _seen_discriminator = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_scope && _paramKey == "scope") { _seen_scope = true; // Parse variable 'scope' _result_scope = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_scope)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockFile parameter 'scope' which is to be a `DIScopeAttr`"); return {}; } } else if (!_seen_file && _paramKey == "file") { _seen_file = true; // Parse variable 'file' _result_file = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_file)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockFile parameter 'file' which is to be a `DIFileAttr`"); return {}; } } else if (!_seen_discriminator && _paramKey == "discriminator") { _seen_discriminator = true; // Parse variable 'discriminator' _result_discriminator = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_discriminator)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILexicalBlockFile parameter 'discriminator' which is to be a `unsigned`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_scope) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope"; return {}; } if (!_seen_discriminator) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "discriminator"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_scope)); assert(::mlir::succeeded(_result_discriminator)); return DILexicalBlockFileAttr::get(odsParser.getContext(), DIScopeAttr((*_result_scope)), DIFileAttr((_result_file.value_or(DIFileAttr()))), unsigned((*_result_discriminator))); } void DILexicalBlockFileAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "scope = "; odsPrinter.printStrippedAttrOrType(getScope()); if (!(getFile() == DIFileAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "file = "; if (!(getFile() == DIFileAttr())) { odsPrinter.printStrippedAttrOrType(getFile()); } } if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "discriminator = "; odsPrinter.printStrippedAttrOrType(getDiscriminator()); } odsPrinter << ">"; } DIScopeAttr DILexicalBlockFileAttr::getScope() const { return getImpl()->scope; } DIFileAttr DILexicalBlockFileAttr::getFile() const { return getImpl()->file; } unsigned DILexicalBlockFileAttr::getDiscriminator() const { return getImpl()->discriminator; } ::mlir::OpAsmAliasResult DILexicalBlockFileAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_lexical_block_file"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILexicalBlockFileAttr) namespace mlir::LLVM { namespace detail { struct DILocalVariableAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; DILocalVariableAttrStorage(DIScopeAttr scope, StringAttr name, DIFileAttr file, unsigned line, unsigned arg, unsigned alignInBits, DITypeAttr type, DIFlags flags) : scope(std::move(scope)), name(std::move(name)), file(std::move(file)), line(std::move(line)), arg(std::move(arg)), alignInBits(std::move(alignInBits)), type(std::move(type)), flags(std::move(flags)) {} KeyTy getAsKey() const { return KeyTy(scope, name, file, line, arg, alignInBits, type, flags); } bool operator==(const KeyTy &tblgenKey) const { return (scope == std::get<0>(tblgenKey)) && (name == std::get<1>(tblgenKey)) && (file == std::get<2>(tblgenKey)) && (line == std::get<3>(tblgenKey)) && (arg == std::get<4>(tblgenKey)) && (alignInBits == std::get<5>(tblgenKey)) && (type == std::get<6>(tblgenKey)) && (flags == std::get<7>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey), std::get<7>(tblgenKey)); } static DILocalVariableAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto scope = std::move(std::get<0>(tblgenKey)); auto name = std::move(std::get<1>(tblgenKey)); auto file = std::move(std::get<2>(tblgenKey)); auto line = std::move(std::get<3>(tblgenKey)); auto arg = std::move(std::get<4>(tblgenKey)); auto alignInBits = std::move(std::get<5>(tblgenKey)); auto type = std::move(std::get<6>(tblgenKey)); auto flags = std::move(std::get<7>(tblgenKey)); return new (allocator.allocate()) DILocalVariableAttrStorage(std::move(scope), std::move(name), std::move(file), std::move(line), std::move(arg), std::move(alignInBits), std::move(type), std::move(flags)); } DIScopeAttr scope; StringAttr name; DIFileAttr file; unsigned line; unsigned arg; unsigned alignInBits; DITypeAttr type; DIFlags flags; }; } // namespace detail DILocalVariableAttr DILocalVariableAttr::get(::mlir::MLIRContext *context, DIScopeAttr scope, StringAttr name, DIFileAttr file, unsigned line, unsigned arg, unsigned alignInBits, DITypeAttr type, DIFlags flags) { return Base::get(context, std::move(scope), std::move(name), std::move(file), std::move(line), std::move(arg), std::move(alignInBits), std::move(type), std::move(flags)); } DILocalVariableAttr DILocalVariableAttr::get(DIScopeAttr scope, StringRef name, DIFileAttr file, unsigned line, unsigned arg, unsigned alignInBits, DITypeAttr type, DIFlags flags) { MLIRContext *ctx = scope.getContext(); return Base::get(ctx, scope, StringAttr::get(ctx, name), file, line, arg, alignInBits, type, flags); } ::mlir::Attribute DILocalVariableAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_scope; ::mlir::FailureOr _result_name; ::mlir::FailureOr _result_file; ::mlir::FailureOr _result_line; ::mlir::FailureOr _result_arg; ::mlir::FailureOr _result_alignInBits; ::mlir::FailureOr _result_type; ::mlir::FailureOr _result_flags; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_scope = false; bool _seen_name = false; bool _seen_file = false; bool _seen_line = false; bool _seen_arg = false; bool _seen_alignInBits = false; bool _seen_type = false; bool _seen_flags = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_scope && _paramKey == "scope") { _seen_scope = true; // Parse variable 'scope' _result_scope = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_scope)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'scope' which is to be a `DIScopeAttr`"); return {}; } } else if (!_seen_name && _paramKey == "name") { _seen_name = true; // Parse variable 'name' _result_name = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_name)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'name' which is to be a `StringAttr`"); return {}; } } else if (!_seen_file && _paramKey == "file") { _seen_file = true; // Parse variable 'file' _result_file = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_file)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'file' which is to be a `DIFileAttr`"); return {}; } } else if (!_seen_line && _paramKey == "line") { _seen_line = true; // Parse variable 'line' _result_line = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_line)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'line' which is to be a `unsigned`"); return {}; } } else if (!_seen_arg && _paramKey == "arg") { _seen_arg = true; // Parse variable 'arg' _result_arg = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_arg)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'arg' which is to be a `unsigned`"); return {}; } } else if (!_seen_alignInBits && _paramKey == "alignInBits") { _seen_alignInBits = true; // Parse variable 'alignInBits' _result_alignInBits = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_alignInBits)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'alignInBits' which is to be a `unsigned`"); return {}; } } else if (!_seen_type && _paramKey == "type") { _seen_type = true; // Parse variable 'type' _result_type = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_type)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'type' which is to be a `DITypeAttr`"); return {}; } } else if (!_seen_flags && _paramKey == "flags") { _seen_flags = true; // Parse variable 'flags' _result_flags = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_flags)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILocalVariableAttr parameter 'flags' which is to be a `DIFlags`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_scope) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_scope)); return DILocalVariableAttr::get(odsParser.getContext(), DIScopeAttr((*_result_scope)), StringAttr((_result_name.value_or(StringAttr()))), DIFileAttr((_result_file.value_or(DIFileAttr()))), unsigned((_result_line.value_or(unsigned()))), unsigned((_result_arg.value_or(unsigned()))), unsigned((_result_alignInBits.value_or(unsigned()))), DITypeAttr((_result_type.value_or(DITypeAttr()))), DIFlags((_result_flags.value_or(DIFlags())))); } void DILocalVariableAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "scope = "; odsPrinter.printStrippedAttrOrType(getScope()); if (!(getName() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "name = "; if (!(getName() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getName()); } } if (!(getFile() == DIFileAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "file = "; if (!(getFile() == DIFileAttr())) { odsPrinter.printStrippedAttrOrType(getFile()); } } if (!(getLine() == unsigned())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "line = "; if (!(getLine() == unsigned())) { odsPrinter.printStrippedAttrOrType(getLine()); } } if (!(getArg() == unsigned())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "arg = "; if (!(getArg() == unsigned())) { odsPrinter.printStrippedAttrOrType(getArg()); } } if (!(getAlignInBits() == unsigned())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "alignInBits = "; if (!(getAlignInBits() == unsigned())) { odsPrinter.printStrippedAttrOrType(getAlignInBits()); } } if (!(getType() == DITypeAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "type = "; if (!(getType() == DITypeAttr())) { odsPrinter.printStrippedAttrOrType(getType()); } } if (!(getFlags() == DIFlags())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "flags = "; if (!(getFlags() == DIFlags())) { odsPrinter.printStrippedAttrOrType(getFlags()); } } } odsPrinter << ">"; } DIScopeAttr DILocalVariableAttr::getScope() const { return getImpl()->scope; } StringAttr DILocalVariableAttr::getName() const { return getImpl()->name; } DIFileAttr DILocalVariableAttr::getFile() const { return getImpl()->file; } unsigned DILocalVariableAttr::getLine() const { return getImpl()->line; } unsigned DILocalVariableAttr::getArg() const { return getImpl()->arg; } unsigned DILocalVariableAttr::getAlignInBits() const { return getImpl()->alignInBits; } DITypeAttr DILocalVariableAttr::getType() const { return getImpl()->type; } DIFlags DILocalVariableAttr::getFlags() const { return getImpl()->flags; } ::mlir::OpAsmAliasResult DILocalVariableAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_local_variable"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILocalVariableAttr) namespace mlir::LLVM { namespace detail { struct DISubprogramAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple, ::llvm::ArrayRef>; DISubprogramAttrStorage(DistinctAttr recId, bool isRecSelf, DistinctAttr id, DICompileUnitAttr compileUnit, DIScopeAttr scope, StringAttr name, StringAttr linkageName, DIFileAttr file, unsigned line, unsigned scopeLine, DISubprogramFlags subprogramFlags, DISubroutineTypeAttr type, ::llvm::ArrayRef retainedNodes, ::llvm::ArrayRef annotations) : recId(std::move(recId)), isRecSelf(std::move(isRecSelf)), id(std::move(id)), compileUnit(std::move(compileUnit)), scope(std::move(scope)), name(std::move(name)), linkageName(std::move(linkageName)), file(std::move(file)), line(std::move(line)), scopeLine(std::move(scopeLine)), subprogramFlags(std::move(subprogramFlags)), type(std::move(type)), retainedNodes(std::move(retainedNodes)), annotations(std::move(annotations)) {} KeyTy getAsKey() const { return KeyTy(recId, isRecSelf, id, compileUnit, scope, name, linkageName, file, line, scopeLine, subprogramFlags, type, retainedNodes, annotations); } bool operator==(const KeyTy &tblgenKey) const { return (recId == std::get<0>(tblgenKey)) && (isRecSelf == std::get<1>(tblgenKey)) && (id == std::get<2>(tblgenKey)) && (compileUnit == std::get<3>(tblgenKey)) && (scope == std::get<4>(tblgenKey)) && (name == std::get<5>(tblgenKey)) && (linkageName == std::get<6>(tblgenKey)) && (file == std::get<7>(tblgenKey)) && (line == std::get<8>(tblgenKey)) && (scopeLine == std::get<9>(tblgenKey)) && (subprogramFlags == std::get<10>(tblgenKey)) && (type == std::get<11>(tblgenKey)) && (::llvm::ArrayRef(retainedNodes) == ::llvm::ArrayRef(std::get<12>(tblgenKey))) && (::llvm::ArrayRef(annotations) == ::llvm::ArrayRef(std::get<13>(tblgenKey))); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey), std::get<7>(tblgenKey), std::get<8>(tblgenKey), std::get<9>(tblgenKey), std::get<10>(tblgenKey), std::get<11>(tblgenKey), std::get<12>(tblgenKey), std::get<13>(tblgenKey)); } static DISubprogramAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto recId = std::move(std::get<0>(tblgenKey)); auto isRecSelf = std::move(std::get<1>(tblgenKey)); auto id = std::move(std::get<2>(tblgenKey)); auto compileUnit = std::move(std::get<3>(tblgenKey)); auto scope = std::move(std::get<4>(tblgenKey)); auto name = std::move(std::get<5>(tblgenKey)); auto linkageName = std::move(std::get<6>(tblgenKey)); auto file = std::move(std::get<7>(tblgenKey)); auto line = std::move(std::get<8>(tblgenKey)); auto scopeLine = std::move(std::get<9>(tblgenKey)); auto subprogramFlags = std::move(std::get<10>(tblgenKey)); auto type = std::move(std::get<11>(tblgenKey)); auto retainedNodes = std::move(std::get<12>(tblgenKey)); auto annotations = std::move(std::get<13>(tblgenKey)); retainedNodes = allocator.copyInto(retainedNodes); annotations = allocator.copyInto(annotations); return new (allocator.allocate()) DISubprogramAttrStorage(std::move(recId), std::move(isRecSelf), std::move(id), std::move(compileUnit), std::move(scope), std::move(name), std::move(linkageName), std::move(file), std::move(line), std::move(scopeLine), std::move(subprogramFlags), std::move(type), std::move(retainedNodes), std::move(annotations)); } DistinctAttr recId; bool isRecSelf; DistinctAttr id; DICompileUnitAttr compileUnit; DIScopeAttr scope; StringAttr name; StringAttr linkageName; DIFileAttr file; unsigned line; unsigned scopeLine; DISubprogramFlags subprogramFlags; DISubroutineTypeAttr type; ::llvm::ArrayRef retainedNodes; ::llvm::ArrayRef annotations; }; } // namespace detail DISubprogramAttr DISubprogramAttr::get(::mlir::MLIRContext *context, DistinctAttr recId, bool isRecSelf, DistinctAttr id, DICompileUnitAttr compileUnit, DIScopeAttr scope, StringAttr name, StringAttr linkageName, DIFileAttr file, unsigned line, unsigned scopeLine, DISubprogramFlags subprogramFlags, DISubroutineTypeAttr type, ::llvm::ArrayRef retainedNodes, ::llvm::ArrayRef annotations) { return Base::get(context, std::move(recId), std::move(isRecSelf), std::move(id), std::move(compileUnit), std::move(scope), std::move(name), std::move(linkageName), std::move(file), std::move(line), std::move(scopeLine), std::move(subprogramFlags), std::move(type), std::move(retainedNodes), std::move(annotations)); } DISubprogramAttr DISubprogramAttr::get(::mlir::MLIRContext *context, DistinctAttr id, DICompileUnitAttr compileUnit, DIScopeAttr scope, StringAttr name, StringAttr linkageName, DIFileAttr file, unsigned line, unsigned scopeLine, DISubprogramFlags subprogramFlags, DISubroutineTypeAttr type, ArrayRef retainedNodes, ArrayRef annotations) { return Base::get(context, /*recId=*/nullptr, /*isRecSelf=*/false, id, compileUnit, scope, name, linkageName, file, line, scopeLine, subprogramFlags, type, retainedNodes, annotations); } ::mlir::Attribute DISubprogramAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_recId; ::mlir::FailureOr _result_isRecSelf; ::mlir::FailureOr _result_id; ::mlir::FailureOr _result_compileUnit; ::mlir::FailureOr _result_scope; ::mlir::FailureOr _result_name; ::mlir::FailureOr _result_linkageName; ::mlir::FailureOr _result_file; ::mlir::FailureOr _result_line; ::mlir::FailureOr _result_scopeLine; ::mlir::FailureOr _result_subprogramFlags; ::mlir::FailureOr _result_type; ::mlir::FailureOr<::llvm::SmallVector> _result_retainedNodes; ::mlir::FailureOr<::llvm::SmallVector> _result_annotations; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_recId = false; bool _seen_isRecSelf = false; bool _seen_id = false; bool _seen_compileUnit = false; bool _seen_scope = false; bool _seen_name = false; bool _seen_linkageName = false; bool _seen_file = false; bool _seen_line = false; bool _seen_scopeLine = false; bool _seen_subprogramFlags = false; bool _seen_type = false; bool _seen_retainedNodes = false; bool _seen_annotations = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_recId && _paramKey == "recId") { _seen_recId = true; // Parse variable 'recId' _result_recId = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_recId)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'recId' which is to be a `DistinctAttr`"); return {}; } } else if (!_seen_isRecSelf && _paramKey == "isRecSelf") { _seen_isRecSelf = true; // Parse variable 'isRecSelf' _result_isRecSelf = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_isRecSelf)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'isRecSelf' which is to be a `bool`"); return {}; } } else if (!_seen_id && _paramKey == "id") { _seen_id = true; // Parse variable 'id' _result_id = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_id)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'id' which is to be a `DistinctAttr`"); return {}; } } else if (!_seen_compileUnit && _paramKey == "compileUnit") { _seen_compileUnit = true; // Parse variable 'compileUnit' _result_compileUnit = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_compileUnit)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'compileUnit' which is to be a `DICompileUnitAttr`"); return {}; } } else if (!_seen_scope && _paramKey == "scope") { _seen_scope = true; // Parse variable 'scope' _result_scope = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_scope)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'scope' which is to be a `DIScopeAttr`"); return {}; } } else if (!_seen_name && _paramKey == "name") { _seen_name = true; // Parse variable 'name' _result_name = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_name)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'name' which is to be a `StringAttr`"); return {}; } } else if (!_seen_linkageName && _paramKey == "linkageName") { _seen_linkageName = true; // Parse variable 'linkageName' _result_linkageName = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_linkageName)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'linkageName' which is to be a `StringAttr`"); return {}; } } else if (!_seen_file && _paramKey == "file") { _seen_file = true; // Parse variable 'file' _result_file = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_file)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'file' which is to be a `DIFileAttr`"); return {}; } } else if (!_seen_line && _paramKey == "line") { _seen_line = true; // Parse variable 'line' _result_line = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_line)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'line' which is to be a `unsigned`"); return {}; } } else if (!_seen_scopeLine && _paramKey == "scopeLine") { _seen_scopeLine = true; // Parse variable 'scopeLine' _result_scopeLine = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_scopeLine)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'scopeLine' which is to be a `unsigned`"); return {}; } } else if (!_seen_subprogramFlags && _paramKey == "subprogramFlags") { _seen_subprogramFlags = true; // Parse variable 'subprogramFlags' _result_subprogramFlags = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_subprogramFlags)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'subprogramFlags' which is to be a `DISubprogramFlags`"); return {}; } } else if (!_seen_type && _paramKey == "type") { _seen_type = true; // Parse variable 'type' _result_type = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_type)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'type' which is to be a `DISubroutineTypeAttr`"); return {}; } } else if (!_seen_retainedNodes && _paramKey == "retainedNodes") { _seen_retainedNodes = true; // Parse literal '[' if (odsParser.parseLSquare()) return {}; // Parse variable 'retainedNodes' _result_retainedNodes = ::mlir::FieldParser<::llvm::SmallVector>::parse(odsParser); if (::mlir::failed(_result_retainedNodes)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'retainedNodes' which is to be a `::llvm::ArrayRef`"); return {}; } // Parse literal ']' if (odsParser.parseRSquare()) return {}; } else if (!_seen_annotations && _paramKey == "annotations") { _seen_annotations = true; // Parse variable 'annotations' _result_annotations = ::mlir::FieldParser<::llvm::SmallVector>::parse(odsParser); if (::mlir::failed(_result_annotations)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubprogramAttr parameter 'annotations' which is to be a `::llvm::ArrayRef`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return DISubprogramAttr::get(odsParser.getContext(), DistinctAttr((_result_recId.value_or(DistinctAttr()))), bool((_result_isRecSelf.value_or(bool()))), DistinctAttr((_result_id.value_or(DistinctAttr()))), DICompileUnitAttr((_result_compileUnit.value_or(DICompileUnitAttr()))), DIScopeAttr((_result_scope.value_or(DIScopeAttr()))), StringAttr((_result_name.value_or(StringAttr()))), StringAttr((_result_linkageName.value_or(StringAttr()))), DIFileAttr((_result_file.value_or(DIFileAttr()))), unsigned((_result_line.value_or(unsigned()))), unsigned((_result_scopeLine.value_or(unsigned()))), DISubprogramFlags((_result_subprogramFlags.value_or(DISubprogramFlags()))), DISubroutineTypeAttr((_result_type.value_or(DISubroutineTypeAttr()))), ::llvm::ArrayRef((_result_retainedNodes.value_or(::llvm::SmallVector()))), ::llvm::ArrayRef((_result_annotations.value_or(::llvm::SmallVector())))); } void DISubprogramAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getRecId() == DistinctAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "recId = "; if (!(getRecId() == DistinctAttr())) { odsPrinter.printStrippedAttrOrType(getRecId()); } } if (!(getIsRecSelf() == bool())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "isRecSelf = "; if (!(getIsRecSelf() == bool())) { odsPrinter.printStrippedAttrOrType(getIsRecSelf()); } } if (!(getId() == DistinctAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "id = "; if (!(getId() == DistinctAttr())) { odsPrinter.printStrippedAttrOrType(getId()); } } if (!(getCompileUnit() == DICompileUnitAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "compileUnit = "; if (!(getCompileUnit() == DICompileUnitAttr())) { odsPrinter.printStrippedAttrOrType(getCompileUnit()); } } if (!(getScope() == DIScopeAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "scope = "; if (!(getScope() == DIScopeAttr())) { odsPrinter.printStrippedAttrOrType(getScope()); } } if (!(getName() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "name = "; if (!(getName() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getName()); } } if (!(getLinkageName() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "linkageName = "; if (!(getLinkageName() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getLinkageName()); } } if (!(getFile() == DIFileAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "file = "; if (!(getFile() == DIFileAttr())) { odsPrinter.printStrippedAttrOrType(getFile()); } } if (!(getLine() == unsigned())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "line = "; if (!(getLine() == unsigned())) { odsPrinter.printStrippedAttrOrType(getLine()); } } if (!(getScopeLine() == unsigned())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "scopeLine = "; if (!(getScopeLine() == unsigned())) { odsPrinter.printStrippedAttrOrType(getScopeLine()); } } if (!(getSubprogramFlags() == DISubprogramFlags())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "subprogramFlags = "; if (!(getSubprogramFlags() == DISubprogramFlags())) { odsPrinter.printStrippedAttrOrType(getSubprogramFlags()); } } if (!(getType() == DISubroutineTypeAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "type = "; if (!(getType() == DISubroutineTypeAttr())) { odsPrinter.printStrippedAttrOrType(getType()); } } if (!(::llvm::ArrayRef(getRetainedNodes()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "retainedNodes = "; odsPrinter << "["; if (!(::llvm::ArrayRef(getRetainedNodes()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { odsPrinter.printStrippedAttrOrType(getRetainedNodes()); } odsPrinter << "]"; } if (!(::llvm::ArrayRef(getAnnotations()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "annotations = "; if (!(::llvm::ArrayRef(getAnnotations()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { odsPrinter.printStrippedAttrOrType(getAnnotations()); } } } odsPrinter << ">"; } DistinctAttr DISubprogramAttr::getRecId() const { return getImpl()->recId; } bool DISubprogramAttr::getIsRecSelf() const { return getImpl()->isRecSelf; } DistinctAttr DISubprogramAttr::getId() const { return getImpl()->id; } DICompileUnitAttr DISubprogramAttr::getCompileUnit() const { return getImpl()->compileUnit; } DIScopeAttr DISubprogramAttr::getScope() const { return getImpl()->scope; } StringAttr DISubprogramAttr::getName() const { return getImpl()->name; } StringAttr DISubprogramAttr::getLinkageName() const { return getImpl()->linkageName; } DIFileAttr DISubprogramAttr::getFile() const { return getImpl()->file; } unsigned DISubprogramAttr::getLine() const { return getImpl()->line; } unsigned DISubprogramAttr::getScopeLine() const { return getImpl()->scopeLine; } DISubprogramFlags DISubprogramAttr::getSubprogramFlags() const { return getImpl()->subprogramFlags; } DISubroutineTypeAttr DISubprogramAttr::getType() const { return getImpl()->type; } ::llvm::ArrayRef DISubprogramAttr::getRetainedNodes() const { return getImpl()->retainedNodes; } ::llvm::ArrayRef DISubprogramAttr::getAnnotations() const { return getImpl()->annotations; } ::mlir::OpAsmAliasResult DISubprogramAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_subprogram"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DISubprogramAttr) namespace mlir::LLVM { namespace detail { struct DIModuleAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; DIModuleAttrStorage(DIFileAttr file, DIScopeAttr scope, StringAttr name, StringAttr configMacros, StringAttr includePath, StringAttr apinotes, unsigned line, bool isDecl) : file(std::move(file)), scope(std::move(scope)), name(std::move(name)), configMacros(std::move(configMacros)), includePath(std::move(includePath)), apinotes(std::move(apinotes)), line(std::move(line)), isDecl(std::move(isDecl)) {} KeyTy getAsKey() const { return KeyTy(file, scope, name, configMacros, includePath, apinotes, line, isDecl); } bool operator==(const KeyTy &tblgenKey) const { return (file == std::get<0>(tblgenKey)) && (scope == std::get<1>(tblgenKey)) && (name == std::get<2>(tblgenKey)) && (configMacros == std::get<3>(tblgenKey)) && (includePath == std::get<4>(tblgenKey)) && (apinotes == std::get<5>(tblgenKey)) && (line == std::get<6>(tblgenKey)) && (isDecl == std::get<7>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey), std::get<7>(tblgenKey)); } static DIModuleAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto file = std::move(std::get<0>(tblgenKey)); auto scope = std::move(std::get<1>(tblgenKey)); auto name = std::move(std::get<2>(tblgenKey)); auto configMacros = std::move(std::get<3>(tblgenKey)); auto includePath = std::move(std::get<4>(tblgenKey)); auto apinotes = std::move(std::get<5>(tblgenKey)); auto line = std::move(std::get<6>(tblgenKey)); auto isDecl = std::move(std::get<7>(tblgenKey)); return new (allocator.allocate()) DIModuleAttrStorage(std::move(file), std::move(scope), std::move(name), std::move(configMacros), std::move(includePath), std::move(apinotes), std::move(line), std::move(isDecl)); } DIFileAttr file; DIScopeAttr scope; StringAttr name; StringAttr configMacros; StringAttr includePath; StringAttr apinotes; unsigned line; bool isDecl; }; } // namespace detail DIModuleAttr DIModuleAttr::get(::mlir::MLIRContext *context, DIFileAttr file, DIScopeAttr scope, StringAttr name, StringAttr configMacros, StringAttr includePath, StringAttr apinotes, unsigned line, bool isDecl) { return Base::get(context, std::move(file), std::move(scope), std::move(name), std::move(configMacros), std::move(includePath), std::move(apinotes), std::move(line), std::move(isDecl)); } ::mlir::Attribute DIModuleAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_file; ::mlir::FailureOr _result_scope; ::mlir::FailureOr _result_name; ::mlir::FailureOr _result_configMacros; ::mlir::FailureOr _result_includePath; ::mlir::FailureOr _result_apinotes; ::mlir::FailureOr _result_line; ::mlir::FailureOr _result_isDecl; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_file = false; bool _seen_scope = false; bool _seen_name = false; bool _seen_configMacros = false; bool _seen_includePath = false; bool _seen_apinotes = false; bool _seen_line = false; bool _seen_isDecl = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_file && _paramKey == "file") { _seen_file = true; // Parse variable 'file' _result_file = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_file)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIModuleAttr parameter 'file' which is to be a `DIFileAttr`"); return {}; } } else if (!_seen_scope && _paramKey == "scope") { _seen_scope = true; // Parse variable 'scope' _result_scope = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_scope)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIModuleAttr parameter 'scope' which is to be a `DIScopeAttr`"); return {}; } } else if (!_seen_name && _paramKey == "name") { _seen_name = true; // Parse variable 'name' _result_name = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_name)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIModuleAttr parameter 'name' which is to be a `StringAttr`"); return {}; } } else if (!_seen_configMacros && _paramKey == "configMacros") { _seen_configMacros = true; // Parse variable 'configMacros' _result_configMacros = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_configMacros)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIModuleAttr parameter 'configMacros' which is to be a `StringAttr`"); return {}; } } else if (!_seen_includePath && _paramKey == "includePath") { _seen_includePath = true; // Parse variable 'includePath' _result_includePath = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_includePath)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIModuleAttr parameter 'includePath' which is to be a `StringAttr`"); return {}; } } else if (!_seen_apinotes && _paramKey == "apinotes") { _seen_apinotes = true; // Parse variable 'apinotes' _result_apinotes = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_apinotes)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIModuleAttr parameter 'apinotes' which is to be a `StringAttr`"); return {}; } } else if (!_seen_line && _paramKey == "line") { _seen_line = true; // Parse variable 'line' _result_line = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_line)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIModuleAttr parameter 'line' which is to be a `unsigned`"); return {}; } } else if (!_seen_isDecl && _paramKey == "isDecl") { _seen_isDecl = true; // Parse variable 'isDecl' _result_isDecl = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_isDecl)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIModuleAttr parameter 'isDecl' which is to be a `bool`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return DIModuleAttr::get(odsParser.getContext(), DIFileAttr((_result_file.value_or(DIFileAttr()))), DIScopeAttr((_result_scope.value_or(DIScopeAttr()))), StringAttr((_result_name.value_or(StringAttr()))), StringAttr((_result_configMacros.value_or(StringAttr()))), StringAttr((_result_includePath.value_or(StringAttr()))), StringAttr((_result_apinotes.value_or(StringAttr()))), unsigned((_result_line.value_or(unsigned()))), bool((_result_isDecl.value_or(bool())))); } void DIModuleAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getFile() == DIFileAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "file = "; if (!(getFile() == DIFileAttr())) { odsPrinter.printStrippedAttrOrType(getFile()); } } if (!(getScope() == DIScopeAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "scope = "; if (!(getScope() == DIScopeAttr())) { odsPrinter.printStrippedAttrOrType(getScope()); } } if (!(getName() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "name = "; if (!(getName() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getName()); } } if (!(getConfigMacros() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "configMacros = "; if (!(getConfigMacros() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getConfigMacros()); } } if (!(getIncludePath() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "includePath = "; if (!(getIncludePath() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getIncludePath()); } } if (!(getApinotes() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "apinotes = "; if (!(getApinotes() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getApinotes()); } } if (!(getLine() == unsigned())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "line = "; if (!(getLine() == unsigned())) { odsPrinter.printStrippedAttrOrType(getLine()); } } if (!(getIsDecl() == bool())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "isDecl = "; if (!(getIsDecl() == bool())) { odsPrinter.printStrippedAttrOrType(getIsDecl()); } } } odsPrinter << ">"; } DIFileAttr DIModuleAttr::getFile() const { return getImpl()->file; } DIScopeAttr DIModuleAttr::getScope() const { return getImpl()->scope; } StringAttr DIModuleAttr::getName() const { return getImpl()->name; } StringAttr DIModuleAttr::getConfigMacros() const { return getImpl()->configMacros; } StringAttr DIModuleAttr::getIncludePath() const { return getImpl()->includePath; } StringAttr DIModuleAttr::getApinotes() const { return getImpl()->apinotes; } unsigned DIModuleAttr::getLine() const { return getImpl()->line; } bool DIModuleAttr::getIsDecl() const { return getImpl()->isDecl; } ::mlir::OpAsmAliasResult DIModuleAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_module"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIModuleAttr) namespace mlir::LLVM { namespace detail { struct DINamespaceAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; DINamespaceAttrStorage(StringAttr name, DIScopeAttr scope, bool exportSymbols) : name(std::move(name)), scope(std::move(scope)), exportSymbols(std::move(exportSymbols)) {} KeyTy getAsKey() const { return KeyTy(name, scope, exportSymbols); } bool operator==(const KeyTy &tblgenKey) const { return (name == std::get<0>(tblgenKey)) && (scope == std::get<1>(tblgenKey)) && (exportSymbols == std::get<2>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); } static DINamespaceAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto name = std::move(std::get<0>(tblgenKey)); auto scope = std::move(std::get<1>(tblgenKey)); auto exportSymbols = std::move(std::get<2>(tblgenKey)); return new (allocator.allocate()) DINamespaceAttrStorage(std::move(name), std::move(scope), std::move(exportSymbols)); } StringAttr name; DIScopeAttr scope; bool exportSymbols; }; } // namespace detail DINamespaceAttr DINamespaceAttr::get(::mlir::MLIRContext *context, StringAttr name, DIScopeAttr scope, bool exportSymbols) { return Base::get(context, std::move(name), std::move(scope), std::move(exportSymbols)); } ::mlir::Attribute DINamespaceAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_name; ::mlir::FailureOr _result_scope; ::mlir::FailureOr _result_exportSymbols; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_name = false; bool _seen_scope = false; bool _seen_exportSymbols = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_name && _paramKey == "name") { _seen_name = true; // Parse variable 'name' _result_name = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_name)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DINamespaceAttr parameter 'name' which is to be a `StringAttr`"); return {}; } } else if (!_seen_scope && _paramKey == "scope") { _seen_scope = true; // Parse variable 'scope' _result_scope = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_scope)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DINamespaceAttr parameter 'scope' which is to be a `DIScopeAttr`"); return {}; } } else if (!_seen_exportSymbols && _paramKey == "exportSymbols") { _seen_exportSymbols = true; // Parse variable 'exportSymbols' _result_exportSymbols = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_exportSymbols)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DINamespaceAttr parameter 'exportSymbols' which is to be a `bool`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_exportSymbols) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "exportSymbols"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_exportSymbols)); return DINamespaceAttr::get(odsParser.getContext(), StringAttr((_result_name.value_or(StringAttr()))), DIScopeAttr((_result_scope.value_or(DIScopeAttr()))), bool((*_result_exportSymbols))); } void DINamespaceAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getName() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "name = "; if (!(getName() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getName()); } } if (!(getScope() == DIScopeAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "scope = "; if (!(getScope() == DIScopeAttr())) { odsPrinter.printStrippedAttrOrType(getScope()); } } if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "exportSymbols = "; odsPrinter.printStrippedAttrOrType(getExportSymbols()); } odsPrinter << ">"; } StringAttr DINamespaceAttr::getName() const { return getImpl()->name; } DIScopeAttr DINamespaceAttr::getScope() const { return getImpl()->scope; } bool DINamespaceAttr::getExportSymbols() const { return getImpl()->exportSymbols; } ::mlir::OpAsmAliasResult DINamespaceAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_namespace"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DINamespaceAttr) namespace mlir::LLVM { namespace detail { struct DIImportedEntityAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple>; DIImportedEntityAttrStorage(unsigned tag, DIScopeAttr scope, DINodeAttr entity, DIFileAttr file, unsigned line, StringAttr name, ::llvm::ArrayRef elements) : tag(std::move(tag)), scope(std::move(scope)), entity(std::move(entity)), file(std::move(file)), line(std::move(line)), name(std::move(name)), elements(std::move(elements)) {} KeyTy getAsKey() const { return KeyTy(tag, scope, entity, file, line, name, elements); } bool operator==(const KeyTy &tblgenKey) const { return (tag == std::get<0>(tblgenKey)) && (scope == std::get<1>(tblgenKey)) && (entity == std::get<2>(tblgenKey)) && (file == std::get<3>(tblgenKey)) && (line == std::get<4>(tblgenKey)) && (name == std::get<5>(tblgenKey)) && (::llvm::ArrayRef(elements) == ::llvm::ArrayRef(std::get<6>(tblgenKey))); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey)); } static DIImportedEntityAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto tag = std::move(std::get<0>(tblgenKey)); auto scope = std::move(std::get<1>(tblgenKey)); auto entity = std::move(std::get<2>(tblgenKey)); auto file = std::move(std::get<3>(tblgenKey)); auto line = std::move(std::get<4>(tblgenKey)); auto name = std::move(std::get<5>(tblgenKey)); auto elements = std::move(std::get<6>(tblgenKey)); elements = allocator.copyInto(elements); return new (allocator.allocate()) DIImportedEntityAttrStorage(std::move(tag), std::move(scope), std::move(entity), std::move(file), std::move(line), std::move(name), std::move(elements)); } unsigned tag; DIScopeAttr scope; DINodeAttr entity; DIFileAttr file; unsigned line; StringAttr name; ::llvm::ArrayRef elements; }; } // namespace detail DIImportedEntityAttr DIImportedEntityAttr::get(::mlir::MLIRContext *context, unsigned tag, DIScopeAttr scope, DINodeAttr entity, DIFileAttr file, unsigned line, StringAttr name, ::llvm::ArrayRef elements) { return Base::get(context, std::move(tag), std::move(scope), std::move(entity), std::move(file), std::move(line), std::move(name), std::move(elements)); } ::mlir::Attribute DIImportedEntityAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_tag; ::mlir::FailureOr _result_scope; ::mlir::FailureOr _result_entity; ::mlir::FailureOr _result_file; ::mlir::FailureOr _result_line; ::mlir::FailureOr _result_name; ::mlir::FailureOr<::llvm::SmallVector> _result_elements; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_tag = false; bool _seen_scope = false; bool _seen_entity = false; bool _seen_file = false; bool _seen_line = false; bool _seen_name = false; bool _seen_elements = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_tag && _paramKey == "tag") { _seen_tag = true; // Parse variable 'tag' _result_tag = [&]() -> FailureOr { SMLoc tagLoc = odsParser.getCurrentLocation(); StringRef name; if (odsParser.parseKeyword(&name)) return failure(); unsigned tag = llvm::dwarf::getTag(name); if (tag == llvm::dwarf::DW_TAG_invalid) return odsParser.emitError(tagLoc) << "invalid debug info debug info tag name: " << name; return tag; }() ; if (::mlir::failed(_result_tag)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIImportedEntityAttr parameter 'tag' which is to be a `unsigned`"); return {}; } } else if (!_seen_scope && _paramKey == "scope") { _seen_scope = true; // Parse variable 'scope' _result_scope = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_scope)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIImportedEntityAttr parameter 'scope' which is to be a `DIScopeAttr`"); return {}; } } else if (!_seen_entity && _paramKey == "entity") { _seen_entity = true; // Parse variable 'entity' _result_entity = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_entity)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIImportedEntityAttr parameter 'entity' which is to be a `DINodeAttr`"); return {}; } } else if (!_seen_file && _paramKey == "file") { _seen_file = true; // Parse variable 'file' _result_file = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_file)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIImportedEntityAttr parameter 'file' which is to be a `DIFileAttr`"); return {}; } } else if (!_seen_line && _paramKey == "line") { _seen_line = true; // Parse variable 'line' _result_line = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_line)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIImportedEntityAttr parameter 'line' which is to be a `unsigned`"); return {}; } } else if (!_seen_name && _paramKey == "name") { _seen_name = true; // Parse variable 'name' _result_name = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_name)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIImportedEntityAttr parameter 'name' which is to be a `StringAttr`"); return {}; } } else if (!_seen_elements && _paramKey == "elements") { _seen_elements = true; // Parse variable 'elements' _result_elements = ::mlir::FieldParser<::llvm::SmallVector>::parse(odsParser); if (::mlir::failed(_result_elements)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIImportedEntityAttr parameter 'elements' which is to be a `::llvm::ArrayRef`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_scope) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope"; return {}; } if (!_seen_entity) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "entity"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_scope)); assert(::mlir::succeeded(_result_entity)); return DIImportedEntityAttr::get(odsParser.getContext(), unsigned((_result_tag.value_or(0))), DIScopeAttr((*_result_scope)), DINodeAttr((*_result_entity)), DIFileAttr((_result_file.value_or(DIFileAttr()))), unsigned((_result_line.value_or(unsigned()))), StringAttr((_result_name.value_or(StringAttr()))), ::llvm::ArrayRef((_result_elements.value_or(::llvm::SmallVector())))); } void DIImportedEntityAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getTag() == 0)) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "tag = "; if (!(getTag() == 0)) { odsPrinter << llvm::dwarf::TagString(getTag()); } } if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "scope = "; odsPrinter.printStrippedAttrOrType(getScope()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "entity = "; odsPrinter.printStrippedAttrOrType(getEntity()); if (!(getFile() == DIFileAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "file = "; if (!(getFile() == DIFileAttr())) { odsPrinter.printStrippedAttrOrType(getFile()); } } if (!(getLine() == unsigned())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "line = "; if (!(getLine() == unsigned())) { odsPrinter.printStrippedAttrOrType(getLine()); } } if (!(getName() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "name = "; if (!(getName() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getName()); } } if (!(::llvm::ArrayRef(getElements()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "elements = "; if (!(::llvm::ArrayRef(getElements()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { odsPrinter.printStrippedAttrOrType(getElements()); } } } odsPrinter << ">"; } unsigned DIImportedEntityAttr::getTag() const { return getImpl()->tag; } DIScopeAttr DIImportedEntityAttr::getScope() const { return getImpl()->scope; } DINodeAttr DIImportedEntityAttr::getEntity() const { return getImpl()->entity; } DIFileAttr DIImportedEntityAttr::getFile() const { return getImpl()->file; } unsigned DIImportedEntityAttr::getLine() const { return getImpl()->line; } StringAttr DIImportedEntityAttr::getName() const { return getImpl()->name; } ::llvm::ArrayRef DIImportedEntityAttr::getElements() const { return getImpl()->elements; } ::mlir::OpAsmAliasResult DIImportedEntityAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_imported_entity"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIImportedEntityAttr) namespace mlir::LLVM { namespace detail { struct DIAnnotationAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; DIAnnotationAttrStorage(StringAttr name, StringAttr value) : name(std::move(name)), value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(name, value); } bool operator==(const KeyTy &tblgenKey) const { return (name == std::get<0>(tblgenKey)) && (value == std::get<1>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static DIAnnotationAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto name = std::move(std::get<0>(tblgenKey)); auto value = std::move(std::get<1>(tblgenKey)); return new (allocator.allocate()) DIAnnotationAttrStorage(std::move(name), std::move(value)); } StringAttr name; StringAttr value; }; } // namespace detail DIAnnotationAttr DIAnnotationAttr::get(::mlir::MLIRContext *context, StringAttr name, StringAttr value) { return Base::get(context, std::move(name), std::move(value)); } ::mlir::Attribute DIAnnotationAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_name; ::mlir::FailureOr _result_value; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_name = false; bool _seen_value = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_name && _paramKey == "name") { _seen_name = true; // Parse variable 'name' _result_name = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_name)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIAnnotationAttr parameter 'name' which is to be a `StringAttr`"); return {}; } } else if (!_seen_value && _paramKey == "value") { _seen_value = true; // Parse variable 'value' _result_value = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIAnnotationAttr parameter 'value' which is to be a `StringAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; for (unsigned odsStructIndex = 0; odsStructIndex < 2; ++odsStructIndex) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; if ((odsStructIndex != 2 - 1) && odsParser.parseComma()) return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_name)); assert(::mlir::succeeded(_result_value)); return DIAnnotationAttr::get(odsParser.getContext(), StringAttr((*_result_name)), StringAttr((*_result_value))); } void DIAnnotationAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "name = "; odsPrinter.printStrippedAttrOrType(getName()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "value = "; odsPrinter.printStrippedAttrOrType(getValue()); } odsPrinter << ">"; } StringAttr DIAnnotationAttr::getName() const { return getImpl()->name; } StringAttr DIAnnotationAttr::getValue() const { return getImpl()->value; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIAnnotationAttr) namespace mlir::LLVM { namespace detail { struct DISubrangeAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::Attribute, ::mlir::Attribute, ::mlir::Attribute, ::mlir::Attribute>; DISubrangeAttrStorage(::mlir::Attribute count, ::mlir::Attribute lowerBound, ::mlir::Attribute upperBound, ::mlir::Attribute stride) : count(std::move(count)), lowerBound(std::move(lowerBound)), upperBound(std::move(upperBound)), stride(std::move(stride)) {} KeyTy getAsKey() const { return KeyTy(count, lowerBound, upperBound, stride); } bool operator==(const KeyTy &tblgenKey) const { return (count == std::get<0>(tblgenKey)) && (lowerBound == std::get<1>(tblgenKey)) && (upperBound == std::get<2>(tblgenKey)) && (stride == std::get<3>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); } static DISubrangeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto count = std::move(std::get<0>(tblgenKey)); auto lowerBound = std::move(std::get<1>(tblgenKey)); auto upperBound = std::move(std::get<2>(tblgenKey)); auto stride = std::move(std::get<3>(tblgenKey)); return new (allocator.allocate()) DISubrangeAttrStorage(std::move(count), std::move(lowerBound), std::move(upperBound), std::move(stride)); } ::mlir::Attribute count; ::mlir::Attribute lowerBound; ::mlir::Attribute upperBound; ::mlir::Attribute stride; }; } // namespace detail DISubrangeAttr DISubrangeAttr::get(::mlir::MLIRContext *context, ::mlir::Attribute count, ::mlir::Attribute lowerBound, ::mlir::Attribute upperBound, ::mlir::Attribute stride) { return Base::get(context, std::move(count), std::move(lowerBound), std::move(upperBound), std::move(stride)); } ::mlir::Attribute DISubrangeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::Attribute> _result_count; ::mlir::FailureOr<::mlir::Attribute> _result_lowerBound; ::mlir::FailureOr<::mlir::Attribute> _result_upperBound; ::mlir::FailureOr<::mlir::Attribute> _result_stride; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_count = false; bool _seen_lowerBound = false; bool _seen_upperBound = false; bool _seen_stride = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_count && _paramKey == "count") { _seen_count = true; // Parse variable 'count' _result_count = ::mlir::FieldParser<::mlir::Attribute>::parse(odsParser); if (::mlir::failed(_result_count)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubrangeAttr parameter 'count' which is to be a `::mlir::Attribute`"); return {}; } } else if (!_seen_lowerBound && _paramKey == "lowerBound") { _seen_lowerBound = true; // Parse variable 'lowerBound' _result_lowerBound = ::mlir::FieldParser<::mlir::Attribute>::parse(odsParser); if (::mlir::failed(_result_lowerBound)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubrangeAttr parameter 'lowerBound' which is to be a `::mlir::Attribute`"); return {}; } } else if (!_seen_upperBound && _paramKey == "upperBound") { _seen_upperBound = true; // Parse variable 'upperBound' _result_upperBound = ::mlir::FieldParser<::mlir::Attribute>::parse(odsParser); if (::mlir::failed(_result_upperBound)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubrangeAttr parameter 'upperBound' which is to be a `::mlir::Attribute`"); return {}; } } else if (!_seen_stride && _paramKey == "stride") { _seen_stride = true; // Parse variable 'stride' _result_stride = ::mlir::FieldParser<::mlir::Attribute>::parse(odsParser); if (::mlir::failed(_result_stride)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubrangeAttr parameter 'stride' which is to be a `::mlir::Attribute`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return DISubrangeAttr::get(odsParser.getContext(), ::mlir::Attribute((_result_count.value_or(::mlir::Attribute()))), ::mlir::Attribute((_result_lowerBound.value_or(::mlir::Attribute()))), ::mlir::Attribute((_result_upperBound.value_or(::mlir::Attribute()))), ::mlir::Attribute((_result_stride.value_or(::mlir::Attribute())))); } void DISubrangeAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getCount() == ::mlir::Attribute())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "count = "; if (!(getCount() == ::mlir::Attribute())) { odsPrinter.printStrippedAttrOrType(getCount()); } } if (!(getLowerBound() == ::mlir::Attribute())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "lowerBound = "; if (!(getLowerBound() == ::mlir::Attribute())) { odsPrinter.printStrippedAttrOrType(getLowerBound()); } } if (!(getUpperBound() == ::mlir::Attribute())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "upperBound = "; if (!(getUpperBound() == ::mlir::Attribute())) { odsPrinter.printStrippedAttrOrType(getUpperBound()); } } if (!(getStride() == ::mlir::Attribute())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "stride = "; if (!(getStride() == ::mlir::Attribute())) { odsPrinter.printStrippedAttrOrType(getStride()); } } } odsPrinter << ">"; } ::mlir::Attribute DISubrangeAttr::getCount() const { return getImpl()->count; } ::mlir::Attribute DISubrangeAttr::getLowerBound() const { return getImpl()->lowerBound; } ::mlir::Attribute DISubrangeAttr::getUpperBound() const { return getImpl()->upperBound; } ::mlir::Attribute DISubrangeAttr::getStride() const { return getImpl()->stride; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DISubrangeAttr) namespace mlir::LLVM { namespace detail { struct DICommonBlockAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; DICommonBlockAttrStorage(DIScopeAttr scope, DIGlobalVariableAttr decl, StringAttr name, DIFileAttr file, unsigned line) : scope(std::move(scope)), decl(std::move(decl)), name(std::move(name)), file(std::move(file)), line(std::move(line)) {} KeyTy getAsKey() const { return KeyTy(scope, decl, name, file, line); } bool operator==(const KeyTy &tblgenKey) const { return (scope == std::get<0>(tblgenKey)) && (decl == std::get<1>(tblgenKey)) && (name == std::get<2>(tblgenKey)) && (file == std::get<3>(tblgenKey)) && (line == std::get<4>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey)); } static DICommonBlockAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto scope = std::move(std::get<0>(tblgenKey)); auto decl = std::move(std::get<1>(tblgenKey)); auto name = std::move(std::get<2>(tblgenKey)); auto file = std::move(std::get<3>(tblgenKey)); auto line = std::move(std::get<4>(tblgenKey)); return new (allocator.allocate()) DICommonBlockAttrStorage(std::move(scope), std::move(decl), std::move(name), std::move(file), std::move(line)); } DIScopeAttr scope; DIGlobalVariableAttr decl; StringAttr name; DIFileAttr file; unsigned line; }; } // namespace detail DICommonBlockAttr DICommonBlockAttr::get(::mlir::MLIRContext *context, DIScopeAttr scope, DIGlobalVariableAttr decl, StringAttr name, DIFileAttr file, unsigned line) { return Base::get(context, std::move(scope), std::move(decl), std::move(name), std::move(file), std::move(line)); } ::mlir::Attribute DICommonBlockAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_scope; ::mlir::FailureOr _result_decl; ::mlir::FailureOr _result_name; ::mlir::FailureOr _result_file; ::mlir::FailureOr _result_line; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_scope = false; bool _seen_decl = false; bool _seen_name = false; bool _seen_file = false; bool _seen_line = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_scope && _paramKey == "scope") { _seen_scope = true; // Parse variable 'scope' _result_scope = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_scope)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICommonBlockAttr parameter 'scope' which is to be a `DIScopeAttr`"); return {}; } } else if (!_seen_decl && _paramKey == "decl") { _seen_decl = true; // Parse variable 'decl' _result_decl = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_decl)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICommonBlockAttr parameter 'decl' which is to be a `DIGlobalVariableAttr`"); return {}; } } else if (!_seen_name && _paramKey == "name") { _seen_name = true; // Parse variable 'name' _result_name = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_name)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICommonBlockAttr parameter 'name' which is to be a `StringAttr`"); return {}; } } else if (!_seen_file && _paramKey == "file") { _seen_file = true; // Parse variable 'file' _result_file = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_file)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICommonBlockAttr parameter 'file' which is to be a `DIFileAttr`"); return {}; } } else if (!_seen_line && _paramKey == "line") { _seen_line = true; // Parse variable 'line' _result_line = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_line)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DICommonBlockAttr parameter 'line' which is to be a `unsigned`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_scope) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope"; return {}; } if (!_seen_name) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "name"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_scope)); assert(::mlir::succeeded(_result_name)); return DICommonBlockAttr::get(odsParser.getContext(), DIScopeAttr((*_result_scope)), DIGlobalVariableAttr((_result_decl.value_or(DIGlobalVariableAttr()))), StringAttr((*_result_name)), DIFileAttr((_result_file.value_or(DIFileAttr()))), unsigned((_result_line.value_or(unsigned())))); } void DICommonBlockAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "scope = "; odsPrinter.printStrippedAttrOrType(getScope()); if (!(getDecl() == DIGlobalVariableAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "decl = "; if (!(getDecl() == DIGlobalVariableAttr())) { odsPrinter.printStrippedAttrOrType(getDecl()); } } if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "name = "; odsPrinter.printStrippedAttrOrType(getName()); if (!(getFile() == DIFileAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "file = "; if (!(getFile() == DIFileAttr())) { odsPrinter.printStrippedAttrOrType(getFile()); } } if (!(getLine() == unsigned())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "line = "; if (!(getLine() == unsigned())) { odsPrinter.printStrippedAttrOrType(getLine()); } } } odsPrinter << ">"; } DIScopeAttr DICommonBlockAttr::getScope() const { return getImpl()->scope; } DIGlobalVariableAttr DICommonBlockAttr::getDecl() const { return getImpl()->decl; } StringAttr DICommonBlockAttr::getName() const { return getImpl()->name; } DIFileAttr DICommonBlockAttr::getFile() const { return getImpl()->file; } unsigned DICommonBlockAttr::getLine() const { return getImpl()->line; } ::mlir::OpAsmAliasResult DICommonBlockAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_common_block"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DICommonBlockAttr) namespace mlir::LLVM { namespace detail { struct DIGenericSubrangeAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::Attribute, ::mlir::Attribute, ::mlir::Attribute, ::mlir::Attribute>; DIGenericSubrangeAttrStorage(::mlir::Attribute count, ::mlir::Attribute lowerBound, ::mlir::Attribute upperBound, ::mlir::Attribute stride) : count(std::move(count)), lowerBound(std::move(lowerBound)), upperBound(std::move(upperBound)), stride(std::move(stride)) {} KeyTy getAsKey() const { return KeyTy(count, lowerBound, upperBound, stride); } bool operator==(const KeyTy &tblgenKey) const { return (count == std::get<0>(tblgenKey)) && (lowerBound == std::get<1>(tblgenKey)) && (upperBound == std::get<2>(tblgenKey)) && (stride == std::get<3>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); } static DIGenericSubrangeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto count = std::move(std::get<0>(tblgenKey)); auto lowerBound = std::move(std::get<1>(tblgenKey)); auto upperBound = std::move(std::get<2>(tblgenKey)); auto stride = std::move(std::get<3>(tblgenKey)); return new (allocator.allocate()) DIGenericSubrangeAttrStorage(std::move(count), std::move(lowerBound), std::move(upperBound), std::move(stride)); } ::mlir::Attribute count; ::mlir::Attribute lowerBound; ::mlir::Attribute upperBound; ::mlir::Attribute stride; }; } // namespace detail DIGenericSubrangeAttr DIGenericSubrangeAttr::get(::mlir::MLIRContext *context, ::mlir::Attribute count, ::mlir::Attribute lowerBound, ::mlir::Attribute upperBound, ::mlir::Attribute stride) { return Base::get(context, std::move(count), std::move(lowerBound), std::move(upperBound), std::move(stride)); } ::mlir::Attribute DIGenericSubrangeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::Attribute> _result_count; ::mlir::FailureOr<::mlir::Attribute> _result_lowerBound; ::mlir::FailureOr<::mlir::Attribute> _result_upperBound; ::mlir::FailureOr<::mlir::Attribute> _result_stride; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_count = false; bool _seen_lowerBound = false; bool _seen_upperBound = false; bool _seen_stride = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_count && _paramKey == "count") { _seen_count = true; // Parse variable 'count' _result_count = ::mlir::FieldParser<::mlir::Attribute>::parse(odsParser); if (::mlir::failed(_result_count)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIGenericSubrangeAttr parameter 'count' which is to be a `::mlir::Attribute`"); return {}; } } else if (!_seen_lowerBound && _paramKey == "lowerBound") { _seen_lowerBound = true; // Parse variable 'lowerBound' _result_lowerBound = ::mlir::FieldParser<::mlir::Attribute>::parse(odsParser); if (::mlir::failed(_result_lowerBound)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIGenericSubrangeAttr parameter 'lowerBound' which is to be a `::mlir::Attribute`"); return {}; } } else if (!_seen_upperBound && _paramKey == "upperBound") { _seen_upperBound = true; // Parse variable 'upperBound' _result_upperBound = ::mlir::FieldParser<::mlir::Attribute>::parse(odsParser); if (::mlir::failed(_result_upperBound)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIGenericSubrangeAttr parameter 'upperBound' which is to be a `::mlir::Attribute`"); return {}; } } else if (!_seen_stride && _paramKey == "stride") { _seen_stride = true; // Parse variable 'stride' _result_stride = ::mlir::FieldParser<::mlir::Attribute>::parse(odsParser); if (::mlir::failed(_result_stride)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIGenericSubrangeAttr parameter 'stride' which is to be a `::mlir::Attribute`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_lowerBound) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "lowerBound"; return {}; } if (!_seen_stride) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "stride"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_lowerBound)); assert(::mlir::succeeded(_result_stride)); return DIGenericSubrangeAttr::get(odsParser.getContext(), ::mlir::Attribute((_result_count.value_or(::mlir::Attribute()))), ::mlir::Attribute((*_result_lowerBound)), ::mlir::Attribute((_result_upperBound.value_or(::mlir::Attribute()))), ::mlir::Attribute((*_result_stride))); } void DIGenericSubrangeAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getCount() == ::mlir::Attribute())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "count = "; if (!(getCount() == ::mlir::Attribute())) { odsPrinter.printStrippedAttrOrType(getCount()); } } if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "lowerBound = "; odsPrinter.printStrippedAttrOrType(getLowerBound()); if (!(getUpperBound() == ::mlir::Attribute())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "upperBound = "; if (!(getUpperBound() == ::mlir::Attribute())) { odsPrinter.printStrippedAttrOrType(getUpperBound()); } } if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "stride = "; odsPrinter.printStrippedAttrOrType(getStride()); } odsPrinter << ">"; } ::mlir::Attribute DIGenericSubrangeAttr::getCount() const { return getImpl()->count; } ::mlir::Attribute DIGenericSubrangeAttr::getLowerBound() const { return getImpl()->lowerBound; } ::mlir::Attribute DIGenericSubrangeAttr::getUpperBound() const { return getImpl()->upperBound; } ::mlir::Attribute DIGenericSubrangeAttr::getStride() const { return getImpl()->stride; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIGenericSubrangeAttr) namespace mlir::LLVM { namespace detail { struct DISubroutineTypeAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple>; DISubroutineTypeAttrStorage(unsigned callingConvention, ::llvm::ArrayRef types) : callingConvention(std::move(callingConvention)), types(std::move(types)) {} KeyTy getAsKey() const { return KeyTy(callingConvention, types); } bool operator==(const KeyTy &tblgenKey) const { return (callingConvention == std::get<0>(tblgenKey)) && (::llvm::ArrayRef(types) == ::llvm::ArrayRef(std::get<1>(tblgenKey))); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static DISubroutineTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto callingConvention = std::move(std::get<0>(tblgenKey)); auto types = std::move(std::get<1>(tblgenKey)); types = allocator.copyInto(types); return new (allocator.allocate()) DISubroutineTypeAttrStorage(std::move(callingConvention), std::move(types)); } unsigned callingConvention; ::llvm::ArrayRef types; }; } // namespace detail DISubroutineTypeAttr DISubroutineTypeAttr::get(::mlir::MLIRContext *context, unsigned callingConvention, ::llvm::ArrayRef types) { return Base::get(context, std::move(callingConvention), std::move(types)); } DISubroutineTypeAttr DISubroutineTypeAttr::get(::mlir::MLIRContext *context, ArrayRef types) { return Base::get(context, /*callingConvention=*/0, types); } ::mlir::Attribute DISubroutineTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_callingConvention; ::mlir::FailureOr<::llvm::SmallVector> _result_types; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_callingConvention = false; bool _seen_types = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_callingConvention && _paramKey == "callingConvention") { _seen_callingConvention = true; // Parse variable 'callingConvention' _result_callingConvention = [&]() -> FailureOr { SMLoc tagLoc = odsParser.getCurrentLocation(); StringRef name; if (odsParser.parseKeyword(&name)) return failure(); unsigned tag = llvm::dwarf::getCallingConvention(name); if (tag == 0) return odsParser.emitError(tagLoc) << "invalid debug info debug info calling convention name: " << name; return tag; }() ; if (::mlir::failed(_result_callingConvention)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubroutineTypeAttr parameter 'callingConvention' which is to be a `unsigned`"); return {}; } } else if (!_seen_types && _paramKey == "types") { _seen_types = true; // Parse variable 'types' _result_types = ::mlir::FieldParser<::llvm::SmallVector>::parse(odsParser); if (::mlir::failed(_result_types)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DISubroutineTypeAttr parameter 'types' which is to be a `::llvm::ArrayRef`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return DISubroutineTypeAttr::get(odsParser.getContext(), unsigned((_result_callingConvention.value_or(0))), ::llvm::ArrayRef((_result_types.value_or(::llvm::SmallVector())))); } void DISubroutineTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getCallingConvention() == 0)) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "callingConvention = "; if (!(getCallingConvention() == 0)) { odsPrinter << llvm::dwarf::ConventionString(getCallingConvention()); } } if (!(::llvm::ArrayRef(getTypes()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "types = "; if (!(::llvm::ArrayRef(getTypes()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { odsPrinter.printStrippedAttrOrType(getTypes()); } } } odsPrinter << ">"; } unsigned DISubroutineTypeAttr::getCallingConvention() const { return getImpl()->callingConvention; } ::llvm::ArrayRef DISubroutineTypeAttr::getTypes() const { return getImpl()->types; } ::mlir::OpAsmAliasResult DISubroutineTypeAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_subroutine_type"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DISubroutineTypeAttr) namespace mlir::LLVM { namespace detail { struct DILabelAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; DILabelAttrStorage(DIScopeAttr scope, StringAttr name, DIFileAttr file, unsigned line) : scope(std::move(scope)), name(std::move(name)), file(std::move(file)), line(std::move(line)) {} KeyTy getAsKey() const { return KeyTy(scope, name, file, line); } bool operator==(const KeyTy &tblgenKey) const { return (scope == std::get<0>(tblgenKey)) && (name == std::get<1>(tblgenKey)) && (file == std::get<2>(tblgenKey)) && (line == std::get<3>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); } static DILabelAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto scope = std::move(std::get<0>(tblgenKey)); auto name = std::move(std::get<1>(tblgenKey)); auto file = std::move(std::get<2>(tblgenKey)); auto line = std::move(std::get<3>(tblgenKey)); return new (allocator.allocate()) DILabelAttrStorage(std::move(scope), std::move(name), std::move(file), std::move(line)); } DIScopeAttr scope; StringAttr name; DIFileAttr file; unsigned line; }; } // namespace detail DILabelAttr DILabelAttr::get(::mlir::MLIRContext *context, DIScopeAttr scope, StringAttr name, DIFileAttr file, unsigned line) { return Base::get(context, std::move(scope), std::move(name), std::move(file), std::move(line)); } DILabelAttr DILabelAttr::get(DIScopeAttr scope, StringRef name, DIFileAttr file, unsigned line) { MLIRContext *ctx = scope.getContext(); return Base::get(ctx, scope, StringAttr::get(ctx, name), file, line); } ::mlir::Attribute DILabelAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_scope; ::mlir::FailureOr _result_name; ::mlir::FailureOr _result_file; ::mlir::FailureOr _result_line; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_scope = false; bool _seen_name = false; bool _seen_file = false; bool _seen_line = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_scope && _paramKey == "scope") { _seen_scope = true; // Parse variable 'scope' _result_scope = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_scope)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILabelAttr parameter 'scope' which is to be a `DIScopeAttr`"); return {}; } } else if (!_seen_name && _paramKey == "name") { _seen_name = true; // Parse variable 'name' _result_name = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_name)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILabelAttr parameter 'name' which is to be a `StringAttr`"); return {}; } } else if (!_seen_file && _paramKey == "file") { _seen_file = true; // Parse variable 'file' _result_file = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_file)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILabelAttr parameter 'file' which is to be a `DIFileAttr`"); return {}; } } else if (!_seen_line && _paramKey == "line") { _seen_line = true; // Parse variable 'line' _result_line = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_line)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DILabelAttr parameter 'line' which is to be a `unsigned`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_scope) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "scope"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_scope)); return DILabelAttr::get(odsParser.getContext(), DIScopeAttr((*_result_scope)), StringAttr((_result_name.value_or(StringAttr()))), DIFileAttr((_result_file.value_or(DIFileAttr()))), unsigned((_result_line.value_or(unsigned())))); } void DILabelAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "scope = "; odsPrinter.printStrippedAttrOrType(getScope()); if (!(getName() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "name = "; if (!(getName() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getName()); } } if (!(getFile() == DIFileAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "file = "; if (!(getFile() == DIFileAttr())) { odsPrinter.printStrippedAttrOrType(getFile()); } } if (!(getLine() == unsigned())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "line = "; if (!(getLine() == unsigned())) { odsPrinter.printStrippedAttrOrType(getLine()); } } } odsPrinter << ">"; } DIScopeAttr DILabelAttr::getScope() const { return getImpl()->scope; } StringAttr DILabelAttr::getName() const { return getImpl()->name; } DIFileAttr DILabelAttr::getFile() const { return getImpl()->file; } unsigned DILabelAttr::getLine() const { return getImpl()->line; } ::mlir::OpAsmAliasResult DILabelAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_label"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DILabelAttr) namespace mlir::LLVM { namespace detail { struct DIStringTypeAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; DIStringTypeAttrStorage(unsigned tag, StringAttr name, uint64_t sizeInBits, uint32_t alignInBits, DIVariableAttr stringLength, DIExpressionAttr stringLengthExp, DIExpressionAttr stringLocationExp, unsigned encoding) : tag(std::move(tag)), name(std::move(name)), sizeInBits(std::move(sizeInBits)), alignInBits(std::move(alignInBits)), stringLength(std::move(stringLength)), stringLengthExp(std::move(stringLengthExp)), stringLocationExp(std::move(stringLocationExp)), encoding(std::move(encoding)) {} KeyTy getAsKey() const { return KeyTy(tag, name, sizeInBits, alignInBits, stringLength, stringLengthExp, stringLocationExp, encoding); } bool operator==(const KeyTy &tblgenKey) const { return (tag == std::get<0>(tblgenKey)) && (name == std::get<1>(tblgenKey)) && (sizeInBits == std::get<2>(tblgenKey)) && (alignInBits == std::get<3>(tblgenKey)) && (stringLength == std::get<4>(tblgenKey)) && (stringLengthExp == std::get<5>(tblgenKey)) && (stringLocationExp == std::get<6>(tblgenKey)) && (encoding == std::get<7>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey), std::get<7>(tblgenKey)); } static DIStringTypeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto tag = std::move(std::get<0>(tblgenKey)); auto name = std::move(std::get<1>(tblgenKey)); auto sizeInBits = std::move(std::get<2>(tblgenKey)); auto alignInBits = std::move(std::get<3>(tblgenKey)); auto stringLength = std::move(std::get<4>(tblgenKey)); auto stringLengthExp = std::move(std::get<5>(tblgenKey)); auto stringLocationExp = std::move(std::get<6>(tblgenKey)); auto encoding = std::move(std::get<7>(tblgenKey)); return new (allocator.allocate()) DIStringTypeAttrStorage(std::move(tag), std::move(name), std::move(sizeInBits), std::move(alignInBits), std::move(stringLength), std::move(stringLengthExp), std::move(stringLocationExp), std::move(encoding)); } unsigned tag; StringAttr name; uint64_t sizeInBits; uint32_t alignInBits; DIVariableAttr stringLength; DIExpressionAttr stringLengthExp; DIExpressionAttr stringLocationExp; unsigned encoding; }; } // namespace detail DIStringTypeAttr DIStringTypeAttr::get(::mlir::MLIRContext *context, unsigned tag, StringAttr name, uint64_t sizeInBits, uint32_t alignInBits, DIVariableAttr stringLength, DIExpressionAttr stringLengthExp, DIExpressionAttr stringLocationExp, unsigned encoding) { return Base::get(context, std::move(tag), std::move(name), std::move(sizeInBits), std::move(alignInBits), std::move(stringLength), std::move(stringLengthExp), std::move(stringLocationExp), std::move(encoding)); } ::mlir::Attribute DIStringTypeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_tag; ::mlir::FailureOr _result_name; ::mlir::FailureOr _result_sizeInBits; ::mlir::FailureOr _result_alignInBits; ::mlir::FailureOr _result_stringLength; ::mlir::FailureOr _result_stringLengthExp; ::mlir::FailureOr _result_stringLocationExp; ::mlir::FailureOr _result_encoding; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_tag = false; bool _seen_name = false; bool _seen_sizeInBits = false; bool _seen_alignInBits = false; bool _seen_stringLength = false; bool _seen_stringLengthExp = false; bool _seen_stringLocationExp = false; bool _seen_encoding = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_tag && _paramKey == "tag") { _seen_tag = true; // Parse variable 'tag' _result_tag = [&]() -> FailureOr { SMLoc tagLoc = odsParser.getCurrentLocation(); StringRef name; if (odsParser.parseKeyword(&name)) return failure(); unsigned tag = llvm::dwarf::getTag(name); if (tag == llvm::dwarf::DW_TAG_invalid) return odsParser.emitError(tagLoc) << "invalid debug info debug info tag name: " << name; return tag; }() ; if (::mlir::failed(_result_tag)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIStringTypeAttr parameter 'tag' which is to be a `unsigned`"); return {}; } } else if (!_seen_name && _paramKey == "name") { _seen_name = true; // Parse variable 'name' _result_name = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_name)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIStringTypeAttr parameter 'name' which is to be a `StringAttr`"); return {}; } } else if (!_seen_sizeInBits && _paramKey == "sizeInBits") { _seen_sizeInBits = true; // Parse variable 'sizeInBits' _result_sizeInBits = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_sizeInBits)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIStringTypeAttr parameter 'sizeInBits' which is to be a `uint64_t`"); return {}; } } else if (!_seen_alignInBits && _paramKey == "alignInBits") { _seen_alignInBits = true; // Parse variable 'alignInBits' _result_alignInBits = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_alignInBits)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIStringTypeAttr parameter 'alignInBits' which is to be a `uint32_t`"); return {}; } } else if (!_seen_stringLength && _paramKey == "stringLength") { _seen_stringLength = true; // Parse variable 'stringLength' _result_stringLength = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_stringLength)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIStringTypeAttr parameter 'stringLength' which is to be a `DIVariableAttr`"); return {}; } } else if (!_seen_stringLengthExp && _paramKey == "stringLengthExp") { _seen_stringLengthExp = true; // Parse variable 'stringLengthExp' _result_stringLengthExp = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_stringLengthExp)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIStringTypeAttr parameter 'stringLengthExp' which is to be a `DIExpressionAttr`"); return {}; } } else if (!_seen_stringLocationExp && _paramKey == "stringLocationExp") { _seen_stringLocationExp = true; // Parse variable 'stringLocationExp' _result_stringLocationExp = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_stringLocationExp)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIStringTypeAttr parameter 'stringLocationExp' which is to be a `DIExpressionAttr`"); return {}; } } else if (!_seen_encoding && _paramKey == "encoding") { _seen_encoding = true; // Parse variable 'encoding' _result_encoding = [&]() -> FailureOr { SMLoc tagLoc = odsParser.getCurrentLocation(); StringRef name; if (odsParser.parseKeyword(&name)) return failure(); unsigned tag = llvm::dwarf::getAttributeEncoding(name); if (tag == 0) return odsParser.emitError(tagLoc) << "invalid debug info debug info encoding name: " << name; return tag; }() ; if (::mlir::failed(_result_encoding)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DIStringTypeAttr parameter 'encoding' which is to be a `unsigned`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; return DIStringTypeAttr::get(odsParser.getContext(), unsigned((_result_tag.value_or(0))), StringAttr((_result_name.value_or(StringAttr()))), uint64_t((_result_sizeInBits.value_or(uint64_t()))), uint32_t((_result_alignInBits.value_or(uint32_t()))), DIVariableAttr((_result_stringLength.value_or(DIVariableAttr()))), DIExpressionAttr((_result_stringLengthExp.value_or(DIExpressionAttr()))), DIExpressionAttr((_result_stringLocationExp.value_or(DIExpressionAttr()))), unsigned((_result_encoding.value_or(0)))); } void DIStringTypeAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getTag() == 0)) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "tag = "; if (!(getTag() == 0)) { odsPrinter << llvm::dwarf::TagString(getTag()); } } if (!(getName() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "name = "; if (!(getName() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getName()); } } if (!(getSizeInBits() == uint64_t())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "sizeInBits = "; if (!(getSizeInBits() == uint64_t())) { odsPrinter.printStrippedAttrOrType(getSizeInBits()); } } if (!(getAlignInBits() == uint32_t())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "alignInBits = "; if (!(getAlignInBits() == uint32_t())) { odsPrinter.printStrippedAttrOrType(getAlignInBits()); } } if (!(getStringLength() == DIVariableAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "stringLength = "; if (!(getStringLength() == DIVariableAttr())) { odsPrinter.printStrippedAttrOrType(getStringLength()); } } if (!(getStringLengthExp() == DIExpressionAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "stringLengthExp = "; if (!(getStringLengthExp() == DIExpressionAttr())) { odsPrinter.printStrippedAttrOrType(getStringLengthExp()); } } if (!(getStringLocationExp() == DIExpressionAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "stringLocationExp = "; if (!(getStringLocationExp() == DIExpressionAttr())) { odsPrinter.printStrippedAttrOrType(getStringLocationExp()); } } if (!(getEncoding() == 0)) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "encoding = "; if (!(getEncoding() == 0)) { odsPrinter << llvm::dwarf::AttributeEncodingString(getEncoding()); } } } odsPrinter << ">"; } unsigned DIStringTypeAttr::getTag() const { return getImpl()->tag; } StringAttr DIStringTypeAttr::getName() const { return getImpl()->name; } uint64_t DIStringTypeAttr::getSizeInBits() const { return getImpl()->sizeInBits; } uint32_t DIStringTypeAttr::getAlignInBits() const { return getImpl()->alignInBits; } DIVariableAttr DIStringTypeAttr::getStringLength() const { return getImpl()->stringLength; } DIExpressionAttr DIStringTypeAttr::getStringLengthExp() const { return getImpl()->stringLengthExp; } DIExpressionAttr DIStringTypeAttr::getStringLocationExp() const { return getImpl()->stringLocationExp; } unsigned DIStringTypeAttr::getEncoding() const { return getImpl()->encoding; } ::mlir::OpAsmAliasResult DIStringTypeAttr::getAlias(::llvm::raw_ostream &os) const { os << "di_string_type"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DIStringTypeAttr) namespace mlir::LLVM { namespace detail { struct MemoryEffectsAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; MemoryEffectsAttrStorage(ModRefInfo other, ModRefInfo argMem, ModRefInfo inaccessibleMem, ModRefInfo errnoMem, ModRefInfo targetMem0, ModRefInfo targetMem1) : other(std::move(other)), argMem(std::move(argMem)), inaccessibleMem(std::move(inaccessibleMem)), errnoMem(std::move(errnoMem)), targetMem0(std::move(targetMem0)), targetMem1(std::move(targetMem1)) {} KeyTy getAsKey() const { return KeyTy(other, argMem, inaccessibleMem, errnoMem, targetMem0, targetMem1); } bool operator==(const KeyTy &tblgenKey) const { return (other == std::get<0>(tblgenKey)) && (argMem == std::get<1>(tblgenKey)) && (inaccessibleMem == std::get<2>(tblgenKey)) && (errnoMem == std::get<3>(tblgenKey)) && (targetMem0 == std::get<4>(tblgenKey)) && (targetMem1 == std::get<5>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey)); } static MemoryEffectsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto other = std::move(std::get<0>(tblgenKey)); auto argMem = std::move(std::get<1>(tblgenKey)); auto inaccessibleMem = std::move(std::get<2>(tblgenKey)); auto errnoMem = std::move(std::get<3>(tblgenKey)); auto targetMem0 = std::move(std::get<4>(tblgenKey)); auto targetMem1 = std::move(std::get<5>(tblgenKey)); return new (allocator.allocate()) MemoryEffectsAttrStorage(std::move(other), std::move(argMem), std::move(inaccessibleMem), std::move(errnoMem), std::move(targetMem0), std::move(targetMem1)); } ModRefInfo other; ModRefInfo argMem; ModRefInfo inaccessibleMem; ModRefInfo errnoMem; ModRefInfo targetMem0; ModRefInfo targetMem1; }; } // namespace detail MemoryEffectsAttr MemoryEffectsAttr::get(::mlir::MLIRContext *context, ModRefInfo other, ModRefInfo argMem, ModRefInfo inaccessibleMem, ModRefInfo errnoMem, ModRefInfo targetMem0, ModRefInfo targetMem1) { return Base::get(context, std::move(other), std::move(argMem), std::move(inaccessibleMem), std::move(errnoMem), std::move(targetMem0), std::move(targetMem1)); } ::mlir::Attribute MemoryEffectsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_other; ::mlir::FailureOr _result_argMem; ::mlir::FailureOr _result_inaccessibleMem; ::mlir::FailureOr _result_errnoMem; ::mlir::FailureOr _result_targetMem0; ::mlir::FailureOr _result_targetMem1; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_other = false; bool _seen_argMem = false; bool _seen_inaccessibleMem = false; bool _seen_errnoMem = false; bool _seen_targetMem0 = false; bool _seen_targetMem1 = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_other && _paramKey == "other") { _seen_other = true; // Parse variable 'other' _result_other = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_other)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MemoryEffectsAttr parameter 'other' which is to be a `ModRefInfo`"); return {}; } } else if (!_seen_argMem && _paramKey == "argMem") { _seen_argMem = true; // Parse variable 'argMem' _result_argMem = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_argMem)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MemoryEffectsAttr parameter 'argMem' which is to be a `ModRefInfo`"); return {}; } } else if (!_seen_inaccessibleMem && _paramKey == "inaccessibleMem") { _seen_inaccessibleMem = true; // Parse variable 'inaccessibleMem' _result_inaccessibleMem = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_inaccessibleMem)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MemoryEffectsAttr parameter 'inaccessibleMem' which is to be a `ModRefInfo`"); return {}; } } else if (!_seen_errnoMem && _paramKey == "errnoMem") { _seen_errnoMem = true; // Parse variable 'errnoMem' _result_errnoMem = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_errnoMem)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MemoryEffectsAttr parameter 'errnoMem' which is to be a `ModRefInfo`"); return {}; } } else if (!_seen_targetMem0 && _paramKey == "targetMem0") { _seen_targetMem0 = true; // Parse variable 'targetMem0' _result_targetMem0 = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_targetMem0)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MemoryEffectsAttr parameter 'targetMem0' which is to be a `ModRefInfo`"); return {}; } } else if (!_seen_targetMem1 && _paramKey == "targetMem1") { _seen_targetMem1 = true; // Parse variable 'targetMem1' _result_targetMem1 = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_targetMem1)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MemoryEffectsAttr parameter 'targetMem1' which is to be a `ModRefInfo`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; for (unsigned odsStructIndex = 0; odsStructIndex < 6; ++odsStructIndex) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; if ((odsStructIndex != 6 - 1) && odsParser.parseComma()) return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_other)); assert(::mlir::succeeded(_result_argMem)); assert(::mlir::succeeded(_result_inaccessibleMem)); assert(::mlir::succeeded(_result_errnoMem)); assert(::mlir::succeeded(_result_targetMem0)); assert(::mlir::succeeded(_result_targetMem1)); return MemoryEffectsAttr::get(odsParser.getContext(), ModRefInfo((*_result_other)), ModRefInfo((*_result_argMem)), ModRefInfo((*_result_inaccessibleMem)), ModRefInfo((*_result_errnoMem)), ModRefInfo((*_result_targetMem0)), ModRefInfo((*_result_targetMem1))); } void MemoryEffectsAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "other = "; odsPrinter.printStrippedAttrOrType(getOther()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "argMem = "; odsPrinter.printStrippedAttrOrType(getArgMem()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "inaccessibleMem = "; odsPrinter.printStrippedAttrOrType(getInaccessibleMem()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "errnoMem = "; odsPrinter.printStrippedAttrOrType(getErrnoMem()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "targetMem0 = "; odsPrinter.printStrippedAttrOrType(getTargetMem0()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "targetMem1 = "; odsPrinter.printStrippedAttrOrType(getTargetMem1()); } odsPrinter << ">"; } ModRefInfo MemoryEffectsAttr::getOther() const { return getImpl()->other; } ModRefInfo MemoryEffectsAttr::getArgMem() const { return getImpl()->argMem; } ModRefInfo MemoryEffectsAttr::getInaccessibleMem() const { return getImpl()->inaccessibleMem; } ModRefInfo MemoryEffectsAttr::getErrnoMem() const { return getImpl()->errnoMem; } ModRefInfo MemoryEffectsAttr::getTargetMem0() const { return getImpl()->targetMem0; } ModRefInfo MemoryEffectsAttr::getTargetMem1() const { return getImpl()->targetMem1; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MemoryEffectsAttr) namespace mlir::LLVM { namespace detail { struct DenormalFPEnvAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; DenormalFPEnvAttrStorage(DenormalModeKind default_output_mode, DenormalModeKind default_input_mode, DenormalModeKind float_output_mode, DenormalModeKind float_input_mode) : default_output_mode(std::move(default_output_mode)), default_input_mode(std::move(default_input_mode)), float_output_mode(std::move(float_output_mode)), float_input_mode(std::move(float_input_mode)) {} KeyTy getAsKey() const { return KeyTy(default_output_mode, default_input_mode, float_output_mode, float_input_mode); } bool operator==(const KeyTy &tblgenKey) const { return (default_output_mode == std::get<0>(tblgenKey)) && (default_input_mode == std::get<1>(tblgenKey)) && (float_output_mode == std::get<2>(tblgenKey)) && (float_input_mode == std::get<3>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); } static DenormalFPEnvAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto default_output_mode = std::move(std::get<0>(tblgenKey)); auto default_input_mode = std::move(std::get<1>(tblgenKey)); auto float_output_mode = std::move(std::get<2>(tblgenKey)); auto float_input_mode = std::move(std::get<3>(tblgenKey)); return new (allocator.allocate()) DenormalFPEnvAttrStorage(std::move(default_output_mode), std::move(default_input_mode), std::move(float_output_mode), std::move(float_input_mode)); } DenormalModeKind default_output_mode; DenormalModeKind default_input_mode; DenormalModeKind float_output_mode; DenormalModeKind float_input_mode; }; } // namespace detail DenormalFPEnvAttr DenormalFPEnvAttr::get(::mlir::MLIRContext *context, DenormalModeKind default_output_mode, DenormalModeKind default_input_mode, DenormalModeKind float_output_mode, DenormalModeKind float_input_mode) { return Base::get(context, std::move(default_output_mode), std::move(default_input_mode), std::move(float_output_mode), std::move(float_input_mode)); } ::mlir::Attribute DenormalFPEnvAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_default_output_mode; ::mlir::FailureOr _result_default_input_mode; ::mlir::FailureOr _result_float_output_mode; ::mlir::FailureOr _result_float_input_mode; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_default_output_mode = false; bool _seen_default_input_mode = false; bool _seen_float_output_mode = false; bool _seen_float_input_mode = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_default_output_mode && _paramKey == "default_output_mode") { _seen_default_output_mode = true; // Parse variable 'default_output_mode' _result_default_output_mode = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_default_output_mode)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DenormalFPEnvAttr parameter 'default_output_mode' which is to be a `DenormalModeKind`"); return {}; } } else if (!_seen_default_input_mode && _paramKey == "default_input_mode") { _seen_default_input_mode = true; // Parse variable 'default_input_mode' _result_default_input_mode = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_default_input_mode)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DenormalFPEnvAttr parameter 'default_input_mode' which is to be a `DenormalModeKind`"); return {}; } } else if (!_seen_float_output_mode && _paramKey == "float_output_mode") { _seen_float_output_mode = true; // Parse variable 'float_output_mode' _result_float_output_mode = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_float_output_mode)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DenormalFPEnvAttr parameter 'float_output_mode' which is to be a `DenormalModeKind`"); return {}; } } else if (!_seen_float_input_mode && _paramKey == "float_input_mode") { _seen_float_input_mode = true; // Parse variable 'float_input_mode' _result_float_input_mode = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_float_input_mode)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DenormalFPEnvAttr parameter 'float_input_mode' which is to be a `DenormalModeKind`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; for (unsigned odsStructIndex = 0; odsStructIndex < 4; ++odsStructIndex) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; if ((odsStructIndex != 4 - 1) && odsParser.parseComma()) return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_default_output_mode)); assert(::mlir::succeeded(_result_default_input_mode)); assert(::mlir::succeeded(_result_float_output_mode)); assert(::mlir::succeeded(_result_float_input_mode)); return DenormalFPEnvAttr::get(odsParser.getContext(), DenormalModeKind((*_result_default_output_mode)), DenormalModeKind((*_result_default_input_mode)), DenormalModeKind((*_result_float_output_mode)), DenormalModeKind((*_result_float_input_mode))); } void DenormalFPEnvAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "default_output_mode = "; odsPrinter.printStrippedAttrOrType(getDefaultOutputMode()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "default_input_mode = "; odsPrinter.printStrippedAttrOrType(getDefaultInputMode()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "float_output_mode = "; odsPrinter.printStrippedAttrOrType(getFloatOutputMode()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "float_input_mode = "; odsPrinter.printStrippedAttrOrType(getFloatInputMode()); } odsPrinter << ">"; } DenormalModeKind DenormalFPEnvAttr::getDefaultOutputMode() const { return getImpl()->default_output_mode; } DenormalModeKind DenormalFPEnvAttr::getDefaultInputMode() const { return getImpl()->default_input_mode; } DenormalModeKind DenormalFPEnvAttr::getFloatOutputMode() const { return getImpl()->float_output_mode; } DenormalModeKind DenormalFPEnvAttr::getFloatInputMode() const { return getImpl()->float_input_mode; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DenormalFPEnvAttr) namespace mlir::LLVM { namespace detail { struct AliasScopeDomainAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; AliasScopeDomainAttrStorage(Attribute id, StringAttr description) : id(std::move(id)), description(std::move(description)) {} KeyTy getAsKey() const { return KeyTy(id, description); } bool operator==(const KeyTy &tblgenKey) const { return (id == std::get<0>(tblgenKey)) && (description == std::get<1>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static AliasScopeDomainAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto id = std::move(std::get<0>(tblgenKey)); auto description = std::move(std::get<1>(tblgenKey)); return new (allocator.allocate()) AliasScopeDomainAttrStorage(std::move(id), std::move(description)); } Attribute id; StringAttr description; }; } // namespace detail AliasScopeDomainAttr AliasScopeDomainAttr::get(::mlir::MLIRContext *context, Attribute id, StringAttr description) { return Base::get(context, std::move(id), std::move(description)); } AliasScopeDomainAttr AliasScopeDomainAttr::get(::mlir::MLIRContext *context, StringAttr description) { return Base::get(context, DistinctAttr::create(UnitAttr::get(context)), description); } ::mlir::Attribute AliasScopeDomainAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_id; ::mlir::FailureOr _result_description; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_id = false; bool _seen_description = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_id && _paramKey == "id") { _seen_id = true; // Parse variable 'id' _result_id = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_id)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_AliasScopeDomainAttr parameter 'id' which is to be a `Attribute`"); return {}; } } else if (!_seen_description && _paramKey == "description") { _seen_description = true; // Parse variable 'description' _result_description = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_description)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_AliasScopeDomainAttr parameter 'description' which is to be a `StringAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_id) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "id"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_id)); return AliasScopeDomainAttr::get(odsParser.getContext(), Attribute((*_result_id)), StringAttr((_result_description.value_or(StringAttr())))); } void AliasScopeDomainAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "id = "; odsPrinter.printStrippedAttrOrType(getId()); if (!(getDescription() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "description = "; if (!(getDescription() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getDescription()); } } } odsPrinter << ">"; } Attribute AliasScopeDomainAttr::getId() const { return getImpl()->id; } StringAttr AliasScopeDomainAttr::getDescription() const { return getImpl()->description; } ::mlir::OpAsmAliasResult AliasScopeDomainAttr::getAlias(::llvm::raw_ostream &os) const { os << "alias_scope_domain"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AliasScopeDomainAttr) namespace mlir::LLVM { namespace detail { struct AliasScopeAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; AliasScopeAttrStorage(Attribute id, AliasScopeDomainAttr domain, StringAttr description) : id(std::move(id)), domain(std::move(domain)), description(std::move(description)) {} KeyTy getAsKey() const { return KeyTy(id, domain, description); } bool operator==(const KeyTy &tblgenKey) const { return (id == std::get<0>(tblgenKey)) && (domain == std::get<1>(tblgenKey)) && (description == std::get<2>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); } static AliasScopeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto id = std::move(std::get<0>(tblgenKey)); auto domain = std::move(std::get<1>(tblgenKey)); auto description = std::move(std::get<2>(tblgenKey)); return new (allocator.allocate()) AliasScopeAttrStorage(std::move(id), std::move(domain), std::move(description)); } Attribute id; AliasScopeDomainAttr domain; StringAttr description; }; } // namespace detail AliasScopeAttr AliasScopeAttr::get(::mlir::MLIRContext *context, Attribute id, AliasScopeDomainAttr domain, StringAttr description) { return Base::get(context, std::move(id), std::move(domain), std::move(description)); } AliasScopeAttr AliasScopeAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, Attribute id, AliasScopeDomainAttr domain, StringAttr description) { return Base::getChecked(emitError, context, std::move(id), std::move(domain), std::move(description)); } AliasScopeAttr AliasScopeAttr::get(AliasScopeDomainAttr domain, StringAttr description) { MLIRContext *ctx = domain.getContext(); return Base::get(ctx, DistinctAttr::create(UnitAttr::get(ctx)), domain, description); } AliasScopeAttr AliasScopeAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, AliasScopeDomainAttr domain, StringAttr description) { MLIRContext *ctx = domain.getContext(); return Base::getChecked(emitError, ctx, DistinctAttr::create(UnitAttr::get(ctx)), domain, description); } ::llvm::LogicalResult AliasScopeAttr::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, Attribute id, AliasScopeDomainAttr domain, StringAttr description) { if (::mlir::failed(verify(emitError, id, domain, description))) return ::mlir::failure(); return ::mlir::success(); } ::mlir::Attribute AliasScopeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_id; ::mlir::FailureOr _result_domain; ::mlir::FailureOr _result_description; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_id = false; bool _seen_domain = false; bool _seen_description = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_id && _paramKey == "id") { _seen_id = true; // Parse variable 'id' _result_id = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_id)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_AliasScopeAttr parameter 'id' which is to be a `Attribute`"); return {}; } } else if (!_seen_domain && _paramKey == "domain") { _seen_domain = true; // Parse variable 'domain' _result_domain = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_domain)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_AliasScopeAttr parameter 'domain' which is to be a `AliasScopeDomainAttr`"); return {}; } } else if (!_seen_description && _paramKey == "description") { _seen_description = true; // Parse variable 'description' _result_description = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_description)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_AliasScopeAttr parameter 'description' which is to be a `StringAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_id) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "id"; return {}; } if (!_seen_domain) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "domain"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_id)); assert(::mlir::succeeded(_result_domain)); return odsParser.getChecked(odsLoc, odsParser.getContext(), Attribute((*_result_id)), AliasScopeDomainAttr((*_result_domain)), StringAttr((_result_description.value_or(StringAttr())))); } void AliasScopeAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "id = "; odsPrinter.printStrippedAttrOrType(getId()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "domain = "; odsPrinter.printStrippedAttrOrType(getDomain()); if (!(getDescription() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "description = "; if (!(getDescription() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getDescription()); } } } odsPrinter << ">"; } Attribute AliasScopeAttr::getId() const { return getImpl()->id; } AliasScopeDomainAttr AliasScopeAttr::getDomain() const { return getImpl()->domain; } StringAttr AliasScopeAttr::getDescription() const { return getImpl()->description; } ::mlir::OpAsmAliasResult AliasScopeAttr::getAlias(::llvm::raw_ostream &os) const { os << "alias_scope"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AliasScopeAttr) namespace mlir::LLVM { namespace detail { struct AccessGroupAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; AccessGroupAttrStorage(DistinctAttr id) : id(std::move(id)) {} KeyTy getAsKey() const { return KeyTy(id); } bool operator==(const KeyTy &tblgenKey) const { return (id == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static AccessGroupAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto id = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) AccessGroupAttrStorage(std::move(id)); } DistinctAttr id; }; } // namespace detail AccessGroupAttr AccessGroupAttr::get(::mlir::MLIRContext *context, DistinctAttr id) { return Base::get(context, std::move(id)); } AccessGroupAttr AccessGroupAttr::get(::mlir::MLIRContext *context) { return Base::get(context, DistinctAttr::create(UnitAttr::get(context))); } ::mlir::Attribute AccessGroupAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_id; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_id = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_id && _paramKey == "id") { _seen_id = true; // Parse variable 'id' _result_id = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_id)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_AccessGroupAttr parameter 'id' which is to be a `DistinctAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; for (unsigned odsStructIndex = 0; odsStructIndex < 1; ++odsStructIndex) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; if ((odsStructIndex != 1 - 1) && odsParser.parseComma()) return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_id)); return AccessGroupAttr::get(odsParser.getContext(), DistinctAttr((*_result_id))); } void AccessGroupAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "id = "; odsPrinter.printStrippedAttrOrType(getId()); } odsPrinter << ">"; } DistinctAttr AccessGroupAttr::getId() const { return getImpl()->id; } ::mlir::OpAsmAliasResult AccessGroupAttr::getAlias(::llvm::raw_ostream &os) const { os << "access_group"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::AccessGroupAttr) namespace mlir::LLVM { namespace detail { struct TBAARootAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; TBAARootAttrStorage(StringAttr id) : id(std::move(id)) {} KeyTy getAsKey() const { return KeyTy(id); } bool operator==(const KeyTy &tblgenKey) const { return (id == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static TBAARootAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto id = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) TBAARootAttrStorage(std::move(id)); } StringAttr id; }; } // namespace detail TBAARootAttr TBAARootAttr::get(::mlir::MLIRContext *context, StringAttr id) { return Base::get(context, std::move(id)); } ::mlir::Attribute TBAARootAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_id; // Parse literal '<' if (odsParser.parseOptionalLess()) { } else { // Parse parameter struct bool _seen_id = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_id && _paramKey == "id") { _seen_id = true; // Parse variable 'id' _result_id = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_id)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAARootAttr parameter 'id' which is to be a `StringAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; ::llvm::StringRef _paramKey; if (!odsParser.parseOptionalKeyword(&_paramKey)) { if (!_loop_body(_paramKey)) return {}; while (!odsParser.parseOptionalComma()) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } } } // Parse literal '>' if (odsParser.parseGreater()) return {}; } return TBAARootAttr::get(odsParser.getContext(), StringAttr((_result_id.value_or(StringAttr())))); } void TBAARootAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); if (!(getId() == StringAttr())) { odsPrinter << "<"; { bool _firstPrinted = true; if (!(getId() == StringAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "id = "; if (!(getId() == StringAttr())) { odsPrinter.printStrippedAttrOrType(getId()); } } } odsPrinter << ">"; } else { } } StringAttr TBAARootAttr::getId() const { return getImpl()->id; } ::mlir::OpAsmAliasResult TBAARootAttr::getAlias(::llvm::raw_ostream &os) const { os << "tbaa_root"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::TBAARootAttr) namespace mlir::LLVM { namespace detail { struct TBAAMemberAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; TBAAMemberAttrStorage(TBAANodeAttr typeDesc, int64_t offset) : typeDesc(std::move(typeDesc)), offset(std::move(offset)) {} KeyTy getAsKey() const { return KeyTy(typeDesc, offset); } bool operator==(const KeyTy &tblgenKey) const { return (typeDesc == std::get<0>(tblgenKey)) && (offset == std::get<1>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static TBAAMemberAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto typeDesc = std::move(std::get<0>(tblgenKey)); auto offset = std::move(std::get<1>(tblgenKey)); return new (allocator.allocate()) TBAAMemberAttrStorage(std::move(typeDesc), std::move(offset)); } TBAANodeAttr typeDesc; int64_t offset; }; } // namespace detail TBAAMemberAttr TBAAMemberAttr::get(::mlir::MLIRContext *context, TBAANodeAttr typeDesc, int64_t offset) { return Base::get(context, std::move(typeDesc), std::move(offset)); } TBAAMemberAttr TBAAMemberAttr::get(TBAANodeAttr typeDesc, int64_t offset) { return Base::get(typeDesc.getContext(), typeDesc, offset); } ::mlir::Attribute TBAAMemberAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_typeDesc; ::mlir::FailureOr _result_offset; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter list // Parse variable 'typeDesc' _result_typeDesc = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_typeDesc)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAAMemberAttr parameter 'typeDesc' which is to be a `TBAANodeAttr`"); return {}; } // Parse literal ',' if (odsParser.parseComma()) return {}; // Parse variable 'offset' _result_offset = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_offset)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAAMemberAttr parameter 'offset' which is to be a `int64_t`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_typeDesc)); assert(::mlir::succeeded(_result_offset)); return TBAAMemberAttr::get(odsParser.getContext(), TBAANodeAttr((*_result_typeDesc)), int64_t((*_result_offset))); } void TBAAMemberAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter.printStrippedAttrOrType(getTypeDesc()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter.printStrippedAttrOrType(getOffset()); } odsPrinter << ">"; } TBAANodeAttr TBAAMemberAttr::getTypeDesc() const { return getImpl()->typeDesc; } int64_t TBAAMemberAttr::getOffset() const { return getImpl()->offset; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::TBAAMemberAttr) namespace mlir::LLVM { namespace detail { struct TBAATypeDescriptorAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::llvm::StringRef, ::llvm::ArrayRef>; TBAATypeDescriptorAttrStorage(::llvm::StringRef id, ::llvm::ArrayRef members) : id(std::move(id)), members(std::move(members)) {} KeyTy getAsKey() const { return KeyTy(id, members); } bool operator==(const KeyTy &tblgenKey) const { return (id == std::get<0>(tblgenKey)) && (members == std::get<1>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static TBAATypeDescriptorAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto id = std::move(std::get<0>(tblgenKey)); auto members = std::move(std::get<1>(tblgenKey)); id = allocator.copyInto(id); members = allocator.copyInto(members); return new (allocator.allocate()) TBAATypeDescriptorAttrStorage(std::move(id), std::move(members)); } ::llvm::StringRef id; ::llvm::ArrayRef members; }; } // namespace detail TBAATypeDescriptorAttr TBAATypeDescriptorAttr::get(::mlir::MLIRContext *context, ::llvm::StringRef id, ::llvm::ArrayRef members) { return Base::get(context, std::move(id), std::move(members)); } ::mlir::Attribute TBAATypeDescriptorAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_id; ::mlir::FailureOr<::llvm::SmallVector> _result_members; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_id = false; bool _seen_members = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_id && _paramKey == "id") { _seen_id = true; // Parse variable 'id' _result_id = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_id)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAATypeDescriptorAttr parameter 'id' which is to be a `::llvm::StringRef`"); return {}; } } else if (!_seen_members && _paramKey == "members") { _seen_members = true; // Parse variable 'members' _result_members = [&]() -> FailureOr> { using Result = SmallVector; if (odsParser.parseLBrace()) return failure(); FailureOr result = FieldParser::parse(odsParser); if (failed(result)) return failure(); if (odsParser.parseRBrace()) return failure(); return result; }() ; if (::mlir::failed(_result_members)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAATypeDescriptorAttr parameter 'members' which is to be a `::llvm::ArrayRef`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; for (unsigned odsStructIndex = 0; odsStructIndex < 2; ++odsStructIndex) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; if ((odsStructIndex != 2 - 1) && odsParser.parseComma()) return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_id)); assert(::mlir::succeeded(_result_members)); return TBAATypeDescriptorAttr::get(odsParser.getContext(), ::llvm::StringRef((*_result_id)), ::llvm::ArrayRef((*_result_members))); } void TBAATypeDescriptorAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "id = "; odsPrinter.printString(getId());; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "members = "; odsPrinter << '{'; llvm::interleaveComma(getMembers(), odsPrinter, [&](TBAAMemberAttr attr) { odsPrinter.printStrippedAttrOrType(attr); }); odsPrinter << '}'; ; } odsPrinter << ">"; } ::llvm::StringRef TBAATypeDescriptorAttr::getId() const { return getImpl()->id; } ::llvm::ArrayRef TBAATypeDescriptorAttr::getMembers() const { return getImpl()->members; } ::mlir::OpAsmAliasResult TBAATypeDescriptorAttr::getAlias(::llvm::raw_ostream &os) const { os << "tbaa_type_desc"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::TBAATypeDescriptorAttr) namespace mlir::LLVM { namespace detail { struct TBAATagAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; TBAATagAttrStorage(TBAATypeDescriptorAttr base_type, TBAATypeDescriptorAttr access_type, int64_t offset, bool constant) : base_type(std::move(base_type)), access_type(std::move(access_type)), offset(std::move(offset)), constant(std::move(constant)) {} KeyTy getAsKey() const { return KeyTy(base_type, access_type, offset, constant); } bool operator==(const KeyTy &tblgenKey) const { return (base_type == std::get<0>(tblgenKey)) && (access_type == std::get<1>(tblgenKey)) && (offset == std::get<2>(tblgenKey)) && (constant == std::get<3>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey)); } static TBAATagAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto base_type = std::move(std::get<0>(tblgenKey)); auto access_type = std::move(std::get<1>(tblgenKey)); auto offset = std::move(std::get<2>(tblgenKey)); auto constant = std::move(std::get<3>(tblgenKey)); return new (allocator.allocate()) TBAATagAttrStorage(std::move(base_type), std::move(access_type), std::move(offset), std::move(constant)); } TBAATypeDescriptorAttr base_type; TBAATypeDescriptorAttr access_type; int64_t offset; bool constant; }; } // namespace detail TBAATagAttr TBAATagAttr::get(::mlir::MLIRContext *context, TBAATypeDescriptorAttr base_type, TBAATypeDescriptorAttr access_type, int64_t offset, bool constant) { return Base::get(context, std::move(base_type), std::move(access_type), std::move(offset), std::move(constant)); } TBAATagAttr TBAATagAttr::get(TBAATypeDescriptorAttr baseType, TBAATypeDescriptorAttr accessType, int64_t offset) { return Base::get(baseType.getContext(), baseType, accessType, offset, /*constant=*/false); } ::mlir::Attribute TBAATagAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_base_type; ::mlir::FailureOr _result_access_type; ::mlir::FailureOr _result_offset; ::mlir::FailureOr _result_constant; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_base_type = false; bool _seen_access_type = false; bool _seen_offset = false; bool _seen_constant = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_base_type && _paramKey == "base_type") { _seen_base_type = true; // Parse variable 'base_type' _result_base_type = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_base_type)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAATagAttr parameter 'base_type' which is to be a `TBAATypeDescriptorAttr`"); return {}; } } else if (!_seen_access_type && _paramKey == "access_type") { _seen_access_type = true; // Parse variable 'access_type' _result_access_type = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_access_type)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAATagAttr parameter 'access_type' which is to be a `TBAATypeDescriptorAttr`"); return {}; } } else if (!_seen_offset && _paramKey == "offset") { _seen_offset = true; // Parse variable 'offset' _result_offset = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_offset)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAATagAttr parameter 'offset' which is to be a `int64_t`"); return {}; } } else if (!_seen_constant && _paramKey == "constant") { _seen_constant = true; // Parse variable 'constant' _result_constant = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_constant)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TBAATagAttr parameter 'constant' which is to be a `bool`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_base_type) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "base_type"; return {}; } if (!_seen_access_type) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "access_type"; return {}; } if (!_seen_offset) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "offset"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_base_type)); assert(::mlir::succeeded(_result_access_type)); assert(::mlir::succeeded(_result_offset)); return TBAATagAttr::get(odsParser.getContext(), TBAATypeDescriptorAttr((*_result_base_type)), TBAATypeDescriptorAttr((*_result_access_type)), int64_t((*_result_offset)), bool((_result_constant.value_or(false)))); } void TBAATagAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "base_type = "; odsPrinter.printStrippedAttrOrType(getBaseType()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "access_type = "; odsPrinter.printStrippedAttrOrType(getAccessType()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "offset = "; odsPrinter.printStrippedAttrOrType(getOffset()); if (!(getConstant() == false)) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "constant = "; if (!(getConstant() == false)) { odsPrinter.printStrippedAttrOrType(getConstant()); } } } odsPrinter << ">"; } TBAATypeDescriptorAttr TBAATagAttr::getBaseType() const { return getImpl()->base_type; } TBAATypeDescriptorAttr TBAATagAttr::getAccessType() const { return getImpl()->access_type; } int64_t TBAATagAttr::getOffset() const { return getImpl()->offset; } bool TBAATagAttr::getConstant() const { return getImpl()->constant; } ::mlir::OpAsmAliasResult TBAATagAttr::getAlias(::llvm::raw_ostream &os) const { os << "tbaa_tag"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::TBAATagAttr) namespace mlir::LLVM { namespace detail { struct MMRATagAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::llvm::StringRef, ::llvm::StringRef>; MMRATagAttrStorage(::llvm::StringRef prefix, ::llvm::StringRef suffix) : prefix(std::move(prefix)), suffix(std::move(suffix)) {} KeyTy getAsKey() const { return KeyTy(prefix, suffix); } bool operator==(const KeyTy &tblgenKey) const { return (prefix == std::get<0>(tblgenKey)) && (suffix == std::get<1>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static MMRATagAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto prefix = std::move(std::get<0>(tblgenKey)); auto suffix = std::move(std::get<1>(tblgenKey)); prefix = allocator.copyInto(prefix); suffix = allocator.copyInto(suffix); return new (allocator.allocate()) MMRATagAttrStorage(std::move(prefix), std::move(suffix)); } ::llvm::StringRef prefix; ::llvm::StringRef suffix; }; } // namespace detail MMRATagAttr MMRATagAttr::get(::mlir::MLIRContext *context, ::llvm::StringRef prefix, ::llvm::StringRef suffix) { return Base::get(context, std::move(prefix), std::move(suffix)); } ::mlir::Attribute MMRATagAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_prefix; ::mlir::FailureOr _result_suffix; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'prefix' _result_prefix = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_prefix)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MMRATagAttr parameter 'prefix' which is to be a `::llvm::StringRef`"); return {}; } // Parse literal ':' if (odsParser.parseColon()) return {}; // Parse variable 'suffix' _result_suffix = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_suffix)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MMRATagAttr parameter 'suffix' which is to be a `::llvm::StringRef`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_prefix)); assert(::mlir::succeeded(_result_suffix)); return MMRATagAttr::get(odsParser.getContext(), ::llvm::StringRef((*_result_prefix)), ::llvm::StringRef((*_result_suffix))); } void MMRATagAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printString(getPrefix());; odsPrinter << ":"; odsPrinter.printString(getSuffix());; odsPrinter << ">"; } ::llvm::StringRef MMRATagAttr::getPrefix() const { return getImpl()->prefix; } ::llvm::StringRef MMRATagAttr::getSuffix() const { return getImpl()->suffix; } ::mlir::OpAsmAliasResult MMRATagAttr::getAlias(::llvm::raw_ostream &os) const { os << "mmra_tag"; return ::mlir::OpAsmAliasResult::OverridableAlias; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MMRATagAttr) namespace mlir::LLVM { namespace detail { struct ConstantRangeAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::llvm::APInt, ::llvm::APInt>; ConstantRangeAttrStorage(::llvm::APInt lower, ::llvm::APInt upper) : lower(std::move(lower)), upper(std::move(upper)) {} KeyTy getAsKey() const { return KeyTy(lower, upper); } bool operator==(const KeyTy &tblgenKey) const { return (lower.getBitWidth() == std::get<0>(tblgenKey).getBitWidth() && lower == std::get<0>(tblgenKey)) && (upper.getBitWidth() == std::get<1>(tblgenKey).getBitWidth() && upper == std::get<1>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static ConstantRangeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto lower = std::move(std::get<0>(tblgenKey)); auto upper = std::move(std::get<1>(tblgenKey)); return new (allocator.allocate()) ConstantRangeAttrStorage(std::move(lower), std::move(upper)); } ::llvm::APInt lower; ::llvm::APInt upper; }; } // namespace detail ConstantRangeAttr ConstantRangeAttr::get(::mlir::MLIRContext *context, ::llvm::APInt lower, ::llvm::APInt upper) { return Base::get(context, std::move(lower), std::move(upper)); } ConstantRangeAttr ConstantRangeAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::llvm::APInt lower, ::llvm::APInt upper) { return Base::getChecked(emitError, context, std::move(lower), std::move(upper)); } ConstantRangeAttr ConstantRangeAttr::get(::mlir::MLIRContext *context, uint32_t bitWidth, int64_t lower, int64_t upper) { return Base::get(context, ::llvm::APInt(bitWidth, lower), ::llvm::APInt(bitWidth, upper)); } ConstantRangeAttr ConstantRangeAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, uint32_t bitWidth, int64_t lower, int64_t upper) { return Base::getChecked(emitError, context, ::llvm::APInt(bitWidth, lower), ::llvm::APInt(bitWidth, upper)); } ::llvm::LogicalResult ConstantRangeAttr::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::llvm::APInt lower, ::llvm::APInt upper) { if (::mlir::failed(verify(emitError, lower, upper))) return ::mlir::failure(); return ::mlir::success(); } const ::llvm::APInt &ConstantRangeAttr::getLower() const { return getImpl()->lower; } const ::llvm::APInt &ConstantRangeAttr::getUpper() const { return getImpl()->upper; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ConstantRangeAttr) namespace mlir::LLVM { namespace detail { struct VScaleRangeAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; VScaleRangeAttrStorage(IntegerAttr minRange, IntegerAttr maxRange) : minRange(std::move(minRange)), maxRange(std::move(maxRange)) {} KeyTy getAsKey() const { return KeyTy(minRange, maxRange); } bool operator==(const KeyTy &tblgenKey) const { return (minRange == std::get<0>(tblgenKey)) && (maxRange == std::get<1>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static VScaleRangeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto minRange = std::move(std::get<0>(tblgenKey)); auto maxRange = std::move(std::get<1>(tblgenKey)); return new (allocator.allocate()) VScaleRangeAttrStorage(std::move(minRange), std::move(maxRange)); } IntegerAttr minRange; IntegerAttr maxRange; }; } // namespace detail VScaleRangeAttr VScaleRangeAttr::get(::mlir::MLIRContext *context, IntegerAttr minRange, IntegerAttr maxRange) { return Base::get(context, std::move(minRange), std::move(maxRange)); } ::mlir::Attribute VScaleRangeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_minRange; ::mlir::FailureOr _result_maxRange; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_minRange = false; bool _seen_maxRange = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_minRange && _paramKey == "minRange") { _seen_minRange = true; // Parse variable 'minRange' _result_minRange = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_minRange)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_VScaleRangeAttr parameter 'minRange' which is to be a `IntegerAttr`"); return {}; } } else if (!_seen_maxRange && _paramKey == "maxRange") { _seen_maxRange = true; // Parse variable 'maxRange' _result_maxRange = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_maxRange)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_VScaleRangeAttr parameter 'maxRange' which is to be a `IntegerAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; for (unsigned odsStructIndex = 0; odsStructIndex < 2; ++odsStructIndex) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; if ((odsStructIndex != 2 - 1) && odsParser.parseComma()) return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_minRange)); assert(::mlir::succeeded(_result_maxRange)); return VScaleRangeAttr::get(odsParser.getContext(), IntegerAttr((*_result_minRange)), IntegerAttr((*_result_maxRange))); } void VScaleRangeAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "minRange = "; odsPrinter.printStrippedAttrOrType(getMinRange()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "maxRange = "; odsPrinter.printStrippedAttrOrType(getMaxRange()); } odsPrinter << ">"; } IntegerAttr VScaleRangeAttr::getMinRange() const { return getImpl()->minRange; } IntegerAttr VScaleRangeAttr::getMaxRange() const { return getImpl()->maxRange; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VScaleRangeAttr) namespace mlir::LLVM { namespace detail { struct TargetFeaturesAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::llvm::ArrayRef>; TargetFeaturesAttrStorage(::llvm::ArrayRef features) : features(std::move(features)) {} KeyTy getAsKey() const { return KeyTy(features); } bool operator==(const KeyTy &tblgenKey) const { return (::llvm::ArrayRef(features) == ::llvm::ArrayRef(std::get<0>(tblgenKey))); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static TargetFeaturesAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto features = std::move(std::get<0>(tblgenKey)); features = allocator.copyInto(features); return new (allocator.allocate()) TargetFeaturesAttrStorage(std::move(features)); } ::llvm::ArrayRef features; }; } // namespace detail TargetFeaturesAttr TargetFeaturesAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef features) { return Base::get(context, std::move(features)); } TargetFeaturesAttr TargetFeaturesAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ::llvm::ArrayRef features) { return Base::getChecked(emitError, context, std::move(features)); } ::llvm::LogicalResult TargetFeaturesAttr::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::llvm::ArrayRef features) { if (::mlir::failed(verify(emitError, features))) return ::mlir::failure(); return ::mlir::success(); } ::mlir::Attribute TargetFeaturesAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::llvm::SmallVector> _result_features; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse literal '[' if (odsParser.parseLSquare()) return {}; // Parse literal ']' if (odsParser.parseOptionalRSquare()) { // Parse variable 'features' _result_features = ::mlir::FieldParser<::llvm::SmallVector>::parse(odsParser); if (::mlir::failed(_result_features)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TargetFeaturesAttr parameter 'features' which is to be a `::llvm::ArrayRef`"); return {}; } // Parse literal ']' if (odsParser.parseRSquare()) return {}; } else { } // Parse literal '>' if (odsParser.parseGreater()) return {}; return odsParser.getChecked(odsLoc, odsParser.getContext(), ::llvm::ArrayRef((_result_features.value_or(::llvm::SmallVector())))); } void TargetFeaturesAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter << "["; if (!(!(::llvm::ArrayRef(getFeatures()) == ::llvm::ArrayRef(::llvm::SmallVector())))) { odsPrinter << "]"; } else { if (!(::llvm::ArrayRef(getFeatures()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { odsPrinter.printStrippedAttrOrType(getFeatures()); } odsPrinter << "]"; } odsPrinter << ">"; } ::llvm::ArrayRef TargetFeaturesAttr::getFeatures() const { return getImpl()->features; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::TargetFeaturesAttr) namespace mlir::LLVM { namespace detail { struct TargetAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; TargetAttrStorage(StringAttr triple, StringAttr chip, TargetFeaturesAttr features) : triple(std::move(triple)), chip(std::move(chip)), features(std::move(features)) {} KeyTy getAsKey() const { return KeyTy(triple, chip, features); } bool operator==(const KeyTy &tblgenKey) const { return (triple == std::get<0>(tblgenKey)) && (chip == std::get<1>(tblgenKey)) && (features == std::get<2>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); } static TargetAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto triple = std::move(std::get<0>(tblgenKey)); auto chip = std::move(std::get<1>(tblgenKey)); auto features = std::move(std::get<2>(tblgenKey)); return new (allocator.allocate()) TargetAttrStorage(std::move(triple), std::move(chip), std::move(features)); } StringAttr triple; StringAttr chip; TargetFeaturesAttr features; }; } // namespace detail TargetAttr TargetAttr::get(::mlir::MLIRContext *context, StringAttr triple, StringAttr chip, TargetFeaturesAttr features) { return Base::get(context, std::move(triple), std::move(chip), std::move(features)); } ::mlir::Attribute TargetAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_triple; ::mlir::FailureOr _result_chip; ::mlir::FailureOr _result_features; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_triple = false; bool _seen_chip = false; bool _seen_features = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_triple && _paramKey == "triple") { _seen_triple = true; // Parse variable 'triple' _result_triple = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_triple)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TargetAttr parameter 'triple' which is to be a `StringAttr`"); return {}; } } else if (!_seen_chip && _paramKey == "chip") { _seen_chip = true; // Parse variable 'chip' _result_chip = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_chip)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TargetAttr parameter 'chip' which is to be a `StringAttr`"); return {}; } } else if (!_seen_features && _paramKey == "features") { _seen_features = true; // Parse variable 'features' _result_features = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_features)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_TargetAttr parameter 'features' which is to be a `TargetFeaturesAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_triple) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "triple"; return {}; } if (!_seen_chip) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "chip"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_triple)); assert(::mlir::succeeded(_result_chip)); return TargetAttr::get(odsParser.getContext(), StringAttr((*_result_triple)), StringAttr((*_result_chip)), TargetFeaturesAttr((_result_features.value_or(TargetFeaturesAttr())))); } void TargetAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "triple = "; odsPrinter.printStrippedAttrOrType(getTriple()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "chip = "; odsPrinter.printStrippedAttrOrType(getChip()); if (!(getFeatures() == TargetFeaturesAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "features = "; if (!(getFeatures() == TargetFeaturesAttr())) { odsPrinter.printStrippedAttrOrType(getFeatures()); } } } odsPrinter << ">"; } StringAttr TargetAttr::getTriple() const { return getImpl()->triple; } StringAttr TargetAttr::getChip() const { return getImpl()->chip; } TargetFeaturesAttr TargetAttr::getFeatures() const { return getImpl()->features; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::TargetAttr) namespace mlir::LLVM { } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::UndefAttr) namespace mlir::LLVM { } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::PoisonAttr) namespace mlir::LLVM { namespace detail { struct DSOLocalEquivalentAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; DSOLocalEquivalentAttrStorage(FlatSymbolRefAttr sym) : sym(std::move(sym)) {} KeyTy getAsKey() const { return KeyTy(sym); } bool operator==(const KeyTy &tblgenKey) const { return (sym == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static DSOLocalEquivalentAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto sym = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) DSOLocalEquivalentAttrStorage(std::move(sym)); } FlatSymbolRefAttr sym; }; } // namespace detail DSOLocalEquivalentAttr DSOLocalEquivalentAttr::get(::mlir::MLIRContext *context, FlatSymbolRefAttr sym) { return Base::get(context, std::move(sym)); } ::mlir::Attribute DSOLocalEquivalentAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_sym; // Parse variable 'sym' _result_sym = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_sym)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DSOLocalEquivalentAttr parameter 'sym' which is to be a `FlatSymbolRefAttr`"); return {}; } assert(::mlir::succeeded(_result_sym)); return DSOLocalEquivalentAttr::get(odsParser.getContext(), FlatSymbolRefAttr((*_result_sym))); } void DSOLocalEquivalentAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter.printStrippedAttrOrType(getSym()); } FlatSymbolRefAttr DSOLocalEquivalentAttr::getSym() const { return getImpl()->sym; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DSOLocalEquivalentAttr) namespace mlir::LLVM { namespace detail { struct BlockTagAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; BlockTagAttrStorage(uint32_t id) : id(std::move(id)) {} KeyTy getAsKey() const { return KeyTy(id); } bool operator==(const KeyTy &tblgenKey) const { return (id == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static BlockTagAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto id = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) BlockTagAttrStorage(std::move(id)); } uint32_t id; }; } // namespace detail BlockTagAttr BlockTagAttr::get(::mlir::MLIRContext *context, uint32_t id) { return Base::get(context, std::move(id)); } ::mlir::Attribute BlockTagAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_id; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_id = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_id && _paramKey == "id") { _seen_id = true; // Parse variable 'id' _result_id = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_id)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_BlockTagAttr parameter 'id' which is to be a `uint32_t`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; for (unsigned odsStructIndex = 0; odsStructIndex < 1; ++odsStructIndex) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; if ((odsStructIndex != 1 - 1) && odsParser.parseComma()) return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_id)); return BlockTagAttr::get(odsParser.getContext(), uint32_t((*_result_id))); } void BlockTagAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "id = "; odsPrinter.printStrippedAttrOrType(getId()); } odsPrinter << ">"; } uint32_t BlockTagAttr::getId() const { return getImpl()->id; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::BlockTagAttr) namespace mlir::LLVM { namespace detail { struct BlockAddressAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; BlockAddressAttrStorage(FlatSymbolRefAttr function, BlockTagAttr tag) : function(std::move(function)), tag(std::move(tag)) {} KeyTy getAsKey() const { return KeyTy(function, tag); } bool operator==(const KeyTy &tblgenKey) const { return (function == std::get<0>(tblgenKey)) && (tag == std::get<1>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static BlockAddressAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto function = std::move(std::get<0>(tblgenKey)); auto tag = std::move(std::get<1>(tblgenKey)); return new (allocator.allocate()) BlockAddressAttrStorage(std::move(function), std::move(tag)); } FlatSymbolRefAttr function; BlockTagAttr tag; }; } // namespace detail BlockAddressAttr BlockAddressAttr::get(::mlir::MLIRContext *context, FlatSymbolRefAttr function, BlockTagAttr tag) { return Base::get(context, std::move(function), std::move(tag)); } ::mlir::Attribute BlockAddressAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_function; ::mlir::FailureOr _result_tag; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_function = false; bool _seen_tag = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_function && _paramKey == "function") { _seen_function = true; // Parse variable 'function' _result_function = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_function)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_BlockAddressAttr parameter 'function' which is to be a `FlatSymbolRefAttr`"); return {}; } } else if (!_seen_tag && _paramKey == "tag") { _seen_tag = true; // Parse variable 'tag' _result_tag = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_tag)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_BlockAddressAttr parameter 'tag' which is to be a `BlockTagAttr`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; for (unsigned odsStructIndex = 0; odsStructIndex < 2; ++odsStructIndex) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; if ((odsStructIndex != 2 - 1) && odsParser.parseComma()) return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_function)); assert(::mlir::succeeded(_result_tag)); return BlockAddressAttr::get(odsParser.getContext(), FlatSymbolRefAttr((*_result_function)), BlockTagAttr((*_result_tag))); } void BlockAddressAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "function = "; odsPrinter.printStrippedAttrOrType(getFunction()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "tag = "; odsPrinter.printStrippedAttrOrType(getTag()); } odsPrinter << ">"; } FlatSymbolRefAttr BlockAddressAttr::getFunction() const { return getImpl()->function; } BlockTagAttr BlockAddressAttr::getTag() const { return getImpl()->tag; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::BlockAddressAttr) namespace mlir::LLVM { namespace detail { struct VecTypeHintAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; VecTypeHintAttrStorage(TypeAttr hint, bool is_signed) : hint(std::move(hint)), is_signed(std::move(is_signed)) {} KeyTy getAsKey() const { return KeyTy(hint, is_signed); } bool operator==(const KeyTy &tblgenKey) const { return (hint == std::get<0>(tblgenKey)) && (is_signed == std::get<1>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static VecTypeHintAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto hint = std::move(std::get<0>(tblgenKey)); auto is_signed = std::move(std::get<1>(tblgenKey)); return new (allocator.allocate()) VecTypeHintAttrStorage(std::move(hint), std::move(is_signed)); } TypeAttr hint; bool is_signed; }; } // namespace detail VecTypeHintAttr VecTypeHintAttr::get(::mlir::MLIRContext *context, TypeAttr hint, bool is_signed) { return Base::get(context, std::move(hint), std::move(is_signed)); } ::mlir::Attribute VecTypeHintAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_hint; ::mlir::FailureOr _result_is_signed; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_hint = false; bool _seen_is_signed = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_hint && _paramKey == "hint") { _seen_hint = true; // Parse variable 'hint' _result_hint = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_hint)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_VecTypeHintAttr parameter 'hint' which is to be a `TypeAttr`"); return {}; } } else if (!_seen_is_signed && _paramKey == "is_signed") { _seen_is_signed = true; // Parse variable 'is_signed' _result_is_signed = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_is_signed)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_VecTypeHintAttr parameter 'is_signed' which is to be a `bool`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_hint) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "hint"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_hint)); return VecTypeHintAttr::get(odsParser.getContext(), TypeAttr((*_result_hint)), bool((_result_is_signed.value_or(false)))); } void VecTypeHintAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "hint = "; odsPrinter.printStrippedAttrOrType(getHint()); if (!(getIsSigned() == false)) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "is_signed = "; if (!(getIsSigned() == false)) { odsPrinter.printStrippedAttrOrType(getIsSigned()); } } } odsPrinter << ">"; } TypeAttr VecTypeHintAttr::getHint() const { return getImpl()->hint; } bool VecTypeHintAttr::getIsSigned() const { return getImpl()->is_signed; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::VecTypeHintAttr) namespace mlir::LLVM { } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ZeroAttr) namespace mlir::LLVM { namespace detail { struct TailCallKindAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; TailCallKindAttrStorage(TailCallKind tailCallKind) : tailCallKind(std::move(tailCallKind)) {} KeyTy getAsKey() const { return KeyTy(tailCallKind); } bool operator==(const KeyTy &tblgenKey) const { return (tailCallKind == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static TailCallKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto tailCallKind = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) TailCallKindAttrStorage(std::move(tailCallKind)); } TailCallKind tailCallKind; }; } // namespace detail TailCallKindAttr TailCallKindAttr::get(::mlir::MLIRContext *context, TailCallKind tailCallKind) { return Base::get(context, std::move(tailCallKind)); } ::mlir::Attribute TailCallKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_tailCallKind; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'tailCallKind' _result_tailCallKind = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_tailCallKind)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse TailCallKindAttr parameter 'tailCallKind' which is to be a `TailCallKind`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_tailCallKind)); return TailCallKindAttr::get(odsParser.getContext(), TailCallKind((*_result_tailCallKind))); } void TailCallKindAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printStrippedAttrOrType(getTailCallKind()); odsPrinter << ">"; } TailCallKind TailCallKindAttr::getTailCallKind() const { return getImpl()->tailCallKind; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::TailCallKindAttr) namespace mlir::LLVM { namespace detail { struct WorkgroupAttributionAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; WorkgroupAttributionAttrStorage(IntegerAttr num_elements, TypeAttr element_type) : num_elements(std::move(num_elements)), element_type(std::move(element_type)) {} KeyTy getAsKey() const { return KeyTy(num_elements, element_type); } bool operator==(const KeyTy &tblgenKey) const { return (num_elements == std::get<0>(tblgenKey)) && (element_type == std::get<1>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static WorkgroupAttributionAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto num_elements = std::move(std::get<0>(tblgenKey)); auto element_type = std::move(std::get<1>(tblgenKey)); return new (allocator.allocate()) WorkgroupAttributionAttrStorage(std::move(num_elements), std::move(element_type)); } IntegerAttr num_elements; TypeAttr element_type; }; } // namespace detail WorkgroupAttributionAttr WorkgroupAttributionAttr::get(::mlir::MLIRContext *context, IntegerAttr num_elements, TypeAttr element_type) { return Base::get(context, std::move(num_elements), std::move(element_type)); } ::mlir::Attribute WorkgroupAttributionAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_num_elements; ::mlir::FailureOr _result_element_type; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'num_elements' _result_num_elements = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_num_elements)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse WorkgroupAttributionAttr parameter 'num_elements' which is to be a `IntegerAttr`"); return {}; } // Parse literal ',' if (odsParser.parseComma()) return {}; // Parse variable 'element_type' _result_element_type = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_element_type)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse WorkgroupAttributionAttr parameter 'element_type' which is to be a `TypeAttr`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_num_elements)); assert(::mlir::succeeded(_result_element_type)); return WorkgroupAttributionAttr::get(odsParser.getContext(), IntegerAttr((*_result_num_elements)), TypeAttr((*_result_element_type))); } void WorkgroupAttributionAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printStrippedAttrOrType(getNumElements()); odsPrinter << ","; odsPrinter << ' '; odsPrinter.printStrippedAttrOrType(getElementType()); odsPrinter << ">"; } IntegerAttr WorkgroupAttributionAttr::getNumElements() const { return getImpl()->num_elements; } TypeAttr WorkgroupAttributionAttr::getElementType() const { return getImpl()->element_type; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::WorkgroupAttributionAttr) namespace mlir::LLVM { namespace detail { struct DereferenceableAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; DereferenceableAttrStorage(uint64_t bytes, bool mayBeNull) : bytes(std::move(bytes)), mayBeNull(std::move(mayBeNull)) {} KeyTy getAsKey() const { return KeyTy(bytes, mayBeNull); } bool operator==(const KeyTy &tblgenKey) const { return (bytes == std::get<0>(tblgenKey)) && (mayBeNull == std::get<1>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey)); } static DereferenceableAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto bytes = std::move(std::get<0>(tblgenKey)); auto mayBeNull = std::move(std::get<1>(tblgenKey)); return new (allocator.allocate()) DereferenceableAttrStorage(std::move(bytes), std::move(mayBeNull)); } uint64_t bytes; bool mayBeNull; }; } // namespace detail DereferenceableAttr DereferenceableAttr::get(::mlir::MLIRContext *context, uint64_t bytes, bool mayBeNull) { return Base::get(context, std::move(bytes), std::move(mayBeNull)); } ::mlir::Attribute DereferenceableAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_bytes; ::mlir::FailureOr _result_mayBeNull; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_bytes = false; bool _seen_mayBeNull = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_bytes && _paramKey == "bytes") { _seen_bytes = true; // Parse variable 'bytes' _result_bytes = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_bytes)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DereferenceableAttr parameter 'bytes' which is to be a `uint64_t`"); return {}; } } else if (!_seen_mayBeNull && _paramKey == "mayBeNull") { _seen_mayBeNull = true; // Parse variable 'mayBeNull' _result_mayBeNull = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_mayBeNull)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DereferenceableAttr parameter 'mayBeNull' which is to be a `bool`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_bytes) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "bytes"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_bytes)); return DereferenceableAttr::get(odsParser.getContext(), uint64_t((*_result_bytes)), bool((_result_mayBeNull.value_or(false)))); } void DereferenceableAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "bytes = "; odsPrinter.printStrippedAttrOrType(getBytes()); if (!(getMayBeNull() == false)) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "mayBeNull = "; if (!(getMayBeNull() == false)) { odsPrinter.printStrippedAttrOrType(getMayBeNull()); } } } odsPrinter << ">"; } uint64_t DereferenceableAttr::getBytes() const { return getImpl()->bytes; } bool DereferenceableAttr::getMayBeNull() const { return getImpl()->mayBeNull; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DereferenceableAttr) namespace mlir::LLVM { namespace detail { struct ModuleFlagAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; ModuleFlagAttrStorage(ModFlagBehavior behavior, StringAttr key, Attribute value) : behavior(std::move(behavior)), key(std::move(key)), value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(behavior, key, value); } bool operator==(const KeyTy &tblgenKey) const { return (behavior == std::get<0>(tblgenKey)) && (key == std::get<1>(tblgenKey)) && (value == std::get<2>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); } static ModuleFlagAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto behavior = std::move(std::get<0>(tblgenKey)); auto key = std::move(std::get<1>(tblgenKey)); auto value = std::move(std::get<2>(tblgenKey)); return new (allocator.allocate()) ModuleFlagAttrStorage(std::move(behavior), std::move(key), std::move(value)); } ModFlagBehavior behavior; StringAttr key; Attribute value; }; } // namespace detail ModuleFlagAttr ModuleFlagAttr::get(::mlir::MLIRContext *context, ModFlagBehavior behavior, StringAttr key, Attribute value) { return Base::get(context, std::move(behavior), std::move(key), std::move(value)); } ModuleFlagAttr ModuleFlagAttr::getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, ModFlagBehavior behavior, StringAttr key, Attribute value) { return Base::getChecked(emitError, context, std::move(behavior), std::move(key), std::move(value)); } ::llvm::LogicalResult ModuleFlagAttr::verifyInvariants(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ModFlagBehavior behavior, StringAttr key, Attribute value) { if (::mlir::failed(verify(emitError, behavior, key, value))) return ::mlir::failure(); return ::mlir::success(); } ::mlir::Attribute ModuleFlagAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_behavior; ::mlir::FailureOr _result_key; ::mlir::FailureOr _result_value; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'behavior' _result_behavior = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_behavior)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagAttr parameter 'behavior' which is to be a `ModFlagBehavior`"); return {}; } // Parse literal ',' if (odsParser.parseComma()) return {}; // Parse variable 'key' _result_key = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_key)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagAttr parameter 'key' which is to be a `StringAttr`"); return {}; } // Parse literal ',' if (odsParser.parseComma()) return {}; // Parse variable 'value' _result_value = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagAttr parameter 'value' which is to be a `Attribute`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_behavior)); assert(::mlir::succeeded(_result_key)); assert(::mlir::succeeded(_result_value)); return odsParser.getChecked(odsLoc, odsParser.getContext(), ModFlagBehavior((*_result_behavior)), StringAttr((*_result_key)), Attribute((*_result_value))); } void ModuleFlagAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printStrippedAttrOrType(getBehavior()); odsPrinter << ","; odsPrinter << ' '; odsPrinter.printStrippedAttrOrType(getKey()); odsPrinter << ","; odsPrinter << ' '; odsPrinter.printStrippedAttrOrType(getValue()); odsPrinter << ">"; } ModFlagBehavior ModuleFlagAttr::getBehavior() const { return getImpl()->behavior; } StringAttr ModuleFlagAttr::getKey() const { return getImpl()->key; } Attribute ModuleFlagAttr::getValue() const { return getImpl()->value; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ModuleFlagAttr) namespace mlir::LLVM { namespace detail { struct ModuleFlagCGProfileEntryAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; ModuleFlagCGProfileEntryAttrStorage(FlatSymbolRefAttr from, FlatSymbolRefAttr to, uint64_t count) : from(std::move(from)), to(std::move(to)), count(std::move(count)) {} KeyTy getAsKey() const { return KeyTy(from, to, count); } bool operator==(const KeyTy &tblgenKey) const { return (from == std::get<0>(tblgenKey)) && (to == std::get<1>(tblgenKey)) && (count == std::get<2>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); } static ModuleFlagCGProfileEntryAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto from = std::move(std::get<0>(tblgenKey)); auto to = std::move(std::get<1>(tblgenKey)); auto count = std::move(std::get<2>(tblgenKey)); return new (allocator.allocate()) ModuleFlagCGProfileEntryAttrStorage(std::move(from), std::move(to), std::move(count)); } FlatSymbolRefAttr from; FlatSymbolRefAttr to; uint64_t count; }; } // namespace detail ModuleFlagCGProfileEntryAttr ModuleFlagCGProfileEntryAttr::get(::mlir::MLIRContext *context, FlatSymbolRefAttr from, FlatSymbolRefAttr to, uint64_t count) { return Base::get(context, std::move(from), std::move(to), std::move(count)); } ::mlir::Attribute ModuleFlagCGProfileEntryAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_from; ::mlir::FailureOr _result_to; ::mlir::FailureOr _result_count; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_from = false; bool _seen_to = false; bool _seen_count = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_from && _paramKey == "from") { _seen_from = true; // Parse variable 'from' _result_from = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_from)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagCGProfileEntryAttr parameter 'from' which is to be a `FlatSymbolRefAttr`"); return {}; } } else if (!_seen_to && _paramKey == "to") { _seen_to = true; // Parse variable 'to' _result_to = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_to)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagCGProfileEntryAttr parameter 'to' which is to be a `FlatSymbolRefAttr`"); return {}; } } else if (!_seen_count && _paramKey == "count") { _seen_count = true; // Parse variable 'count' _result_count = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_count)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagCGProfileEntryAttr parameter 'count' which is to be a `uint64_t`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_count) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "count"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_count)); return ModuleFlagCGProfileEntryAttr::get(odsParser.getContext(), FlatSymbolRefAttr((_result_from.value_or(FlatSymbolRefAttr()))), FlatSymbolRefAttr((_result_to.value_or(FlatSymbolRefAttr()))), uint64_t((*_result_count))); } void ModuleFlagCGProfileEntryAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!(getFrom() == FlatSymbolRefAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "from = "; if (!(getFrom() == FlatSymbolRefAttr())) { odsPrinter.printStrippedAttrOrType(getFrom()); } } if (!(getTo() == FlatSymbolRefAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "to = "; if (!(getTo() == FlatSymbolRefAttr())) { odsPrinter.printStrippedAttrOrType(getTo()); } } if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "count = "; odsPrinter.printStrippedAttrOrType(getCount()); } odsPrinter << ">"; } FlatSymbolRefAttr ModuleFlagCGProfileEntryAttr::getFrom() const { return getImpl()->from; } FlatSymbolRefAttr ModuleFlagCGProfileEntryAttr::getTo() const { return getImpl()->to; } uint64_t ModuleFlagCGProfileEntryAttr::getCount() const { return getImpl()->count; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ModuleFlagCGProfileEntryAttr) namespace mlir::LLVM { namespace detail { struct ModuleFlagProfileSummaryDetailedAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; ModuleFlagProfileSummaryDetailedAttrStorage(uint32_t cut_off, uint64_t min_count, uint32_t num_counts) : cut_off(std::move(cut_off)), min_count(std::move(min_count)), num_counts(std::move(num_counts)) {} KeyTy getAsKey() const { return KeyTy(cut_off, min_count, num_counts); } bool operator==(const KeyTy &tblgenKey) const { return (cut_off == std::get<0>(tblgenKey)) && (min_count == std::get<1>(tblgenKey)) && (num_counts == std::get<2>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey)); } static ModuleFlagProfileSummaryDetailedAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto cut_off = std::move(std::get<0>(tblgenKey)); auto min_count = std::move(std::get<1>(tblgenKey)); auto num_counts = std::move(std::get<2>(tblgenKey)); return new (allocator.allocate()) ModuleFlagProfileSummaryDetailedAttrStorage(std::move(cut_off), std::move(min_count), std::move(num_counts)); } uint32_t cut_off; uint64_t min_count; uint32_t num_counts; }; } // namespace detail ModuleFlagProfileSummaryDetailedAttr ModuleFlagProfileSummaryDetailedAttr::get(::mlir::MLIRContext *context, uint32_t cut_off, uint64_t min_count, uint32_t num_counts) { return Base::get(context, std::move(cut_off), std::move(min_count), std::move(num_counts)); } ::mlir::Attribute ModuleFlagProfileSummaryDetailedAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_cut_off; ::mlir::FailureOr _result_min_count; ::mlir::FailureOr _result_num_counts; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_cut_off = false; bool _seen_min_count = false; bool _seen_num_counts = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_cut_off && _paramKey == "cut_off") { _seen_cut_off = true; // Parse variable 'cut_off' _result_cut_off = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_cut_off)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagProfileSummaryDetailedAttr parameter 'cut_off' which is to be a `uint32_t`"); return {}; } } else if (!_seen_min_count && _paramKey == "min_count") { _seen_min_count = true; // Parse variable 'min_count' _result_min_count = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_min_count)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagProfileSummaryDetailedAttr parameter 'min_count' which is to be a `uint64_t`"); return {}; } } else if (!_seen_num_counts && _paramKey == "num_counts") { _seen_num_counts = true; // Parse variable 'num_counts' _result_num_counts = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_num_counts)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagProfileSummaryDetailedAttr parameter 'num_counts' which is to be a `uint32_t`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; for (unsigned odsStructIndex = 0; odsStructIndex < 3; ++odsStructIndex) { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; if ((odsStructIndex != 3 - 1) && odsParser.parseComma()) return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_cut_off)); assert(::mlir::succeeded(_result_min_count)); assert(::mlir::succeeded(_result_num_counts)); return ModuleFlagProfileSummaryDetailedAttr::get(odsParser.getContext(), uint32_t((*_result_cut_off)), uint64_t((*_result_min_count)), uint32_t((*_result_num_counts))); } void ModuleFlagProfileSummaryDetailedAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "cut_off = "; odsPrinter.printStrippedAttrOrType(getCutOff()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "min_count = "; odsPrinter.printStrippedAttrOrType(getMinCount()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "num_counts = "; odsPrinter.printStrippedAttrOrType(getNumCounts()); } odsPrinter << ">"; } uint32_t ModuleFlagProfileSummaryDetailedAttr::getCutOff() const { return getImpl()->cut_off; } uint64_t ModuleFlagProfileSummaryDetailedAttr::getMinCount() const { return getImpl()->min_count; } uint32_t ModuleFlagProfileSummaryDetailedAttr::getNumCounts() const { return getImpl()->num_counts; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ModuleFlagProfileSummaryDetailedAttr) namespace mlir::LLVM { namespace detail { struct ModuleFlagProfileSummaryAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple, FloatAttr, ::llvm::ArrayRef>; ModuleFlagProfileSummaryAttrStorage(ProfileSummaryFormatKind format, uint64_t total_count, uint64_t max_count, uint64_t max_internal_count, uint64_t max_function_count, uint64_t num_counts, uint64_t num_functions, std::optional is_partial_profile, FloatAttr partial_profile_ratio, ::llvm::ArrayRef detailed_summary) : format(std::move(format)), total_count(std::move(total_count)), max_count(std::move(max_count)), max_internal_count(std::move(max_internal_count)), max_function_count(std::move(max_function_count)), num_counts(std::move(num_counts)), num_functions(std::move(num_functions)), is_partial_profile(std::move(is_partial_profile)), partial_profile_ratio(std::move(partial_profile_ratio)), detailed_summary(std::move(detailed_summary)) {} KeyTy getAsKey() const { return KeyTy(format, total_count, max_count, max_internal_count, max_function_count, num_counts, num_functions, is_partial_profile, partial_profile_ratio, detailed_summary); } bool operator==(const KeyTy &tblgenKey) const { return (format == std::get<0>(tblgenKey)) && (total_count == std::get<1>(tblgenKey)) && (max_count == std::get<2>(tblgenKey)) && (max_internal_count == std::get<3>(tblgenKey)) && (max_function_count == std::get<4>(tblgenKey)) && (num_counts == std::get<5>(tblgenKey)) && (num_functions == std::get<6>(tblgenKey)) && (is_partial_profile == std::get<7>(tblgenKey)) && (partial_profile_ratio == std::get<8>(tblgenKey)) && (detailed_summary == std::get<9>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey), std::get<1>(tblgenKey), std::get<2>(tblgenKey), std::get<3>(tblgenKey), std::get<4>(tblgenKey), std::get<5>(tblgenKey), std::get<6>(tblgenKey), std::get<7>(tblgenKey), std::get<8>(tblgenKey), std::get<9>(tblgenKey)); } static ModuleFlagProfileSummaryAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto format = std::move(std::get<0>(tblgenKey)); auto total_count = std::move(std::get<1>(tblgenKey)); auto max_count = std::move(std::get<2>(tblgenKey)); auto max_internal_count = std::move(std::get<3>(tblgenKey)); auto max_function_count = std::move(std::get<4>(tblgenKey)); auto num_counts = std::move(std::get<5>(tblgenKey)); auto num_functions = std::move(std::get<6>(tblgenKey)); auto is_partial_profile = std::move(std::get<7>(tblgenKey)); auto partial_profile_ratio = std::move(std::get<8>(tblgenKey)); auto detailed_summary = std::move(std::get<9>(tblgenKey)); detailed_summary = allocator.copyInto(detailed_summary); return new (allocator.allocate()) ModuleFlagProfileSummaryAttrStorage(std::move(format), std::move(total_count), std::move(max_count), std::move(max_internal_count), std::move(max_function_count), std::move(num_counts), std::move(num_functions), std::move(is_partial_profile), std::move(partial_profile_ratio), std::move(detailed_summary)); } ProfileSummaryFormatKind format; uint64_t total_count; uint64_t max_count; uint64_t max_internal_count; uint64_t max_function_count; uint64_t num_counts; uint64_t num_functions; std::optional is_partial_profile; FloatAttr partial_profile_ratio; ::llvm::ArrayRef detailed_summary; }; } // namespace detail ModuleFlagProfileSummaryAttr ModuleFlagProfileSummaryAttr::get(::mlir::MLIRContext *context, ProfileSummaryFormatKind format, uint64_t total_count, uint64_t max_count, uint64_t max_internal_count, uint64_t max_function_count, uint64_t num_counts, uint64_t num_functions, std::optional is_partial_profile, FloatAttr partial_profile_ratio, ::llvm::ArrayRef detailed_summary) { return Base::get(context, std::move(format), std::move(total_count), std::move(max_count), std::move(max_internal_count), std::move(max_function_count), std::move(num_counts), std::move(num_functions), std::move(is_partial_profile), std::move(partial_profile_ratio), std::move(detailed_summary)); } ::mlir::Attribute ModuleFlagProfileSummaryAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_format; ::mlir::FailureOr _result_total_count; ::mlir::FailureOr _result_max_count; ::mlir::FailureOr _result_max_internal_count; ::mlir::FailureOr _result_max_function_count; ::mlir::FailureOr _result_num_counts; ::mlir::FailureOr _result_num_functions; ::mlir::FailureOr> _result_is_partial_profile; ::mlir::FailureOr _result_partial_profile_ratio; ::mlir::FailureOr<::llvm::SmallVector> _result_detailed_summary; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse parameter struct bool _seen_format = false; bool _seen_total_count = false; bool _seen_max_count = false; bool _seen_max_internal_count = false; bool _seen_max_function_count = false; bool _seen_num_counts = false; bool _seen_num_functions = false; bool _seen_is_partial_profile = false; bool _seen_partial_profile_ratio = false; bool _seen_detailed_summary = false; { const auto _loop_body = [&](::llvm::StringRef _paramKey) -> bool { // Parse literal '=' if (odsParser.parseEqual()) return {}; if (!_seen_format && _paramKey == "format") { _seen_format = true; // Parse variable 'format' _result_format = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_format)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagProfileSummaryAttr parameter 'format' which is to be a `ProfileSummaryFormatKind`"); return {}; } } else if (!_seen_total_count && _paramKey == "total_count") { _seen_total_count = true; // Parse variable 'total_count' _result_total_count = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_total_count)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagProfileSummaryAttr parameter 'total_count' which is to be a `uint64_t`"); return {}; } } else if (!_seen_max_count && _paramKey == "max_count") { _seen_max_count = true; // Parse variable 'max_count' _result_max_count = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_max_count)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagProfileSummaryAttr parameter 'max_count' which is to be a `uint64_t`"); return {}; } } else if (!_seen_max_internal_count && _paramKey == "max_internal_count") { _seen_max_internal_count = true; // Parse variable 'max_internal_count' _result_max_internal_count = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_max_internal_count)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagProfileSummaryAttr parameter 'max_internal_count' which is to be a `uint64_t`"); return {}; } } else if (!_seen_max_function_count && _paramKey == "max_function_count") { _seen_max_function_count = true; // Parse variable 'max_function_count' _result_max_function_count = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_max_function_count)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagProfileSummaryAttr parameter 'max_function_count' which is to be a `uint64_t`"); return {}; } } else if (!_seen_num_counts && _paramKey == "num_counts") { _seen_num_counts = true; // Parse variable 'num_counts' _result_num_counts = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_num_counts)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagProfileSummaryAttr parameter 'num_counts' which is to be a `uint64_t`"); return {}; } } else if (!_seen_num_functions && _paramKey == "num_functions") { _seen_num_functions = true; // Parse variable 'num_functions' _result_num_functions = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_num_functions)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagProfileSummaryAttr parameter 'num_functions' which is to be a `uint64_t`"); return {}; } } else if (!_seen_is_partial_profile && _paramKey == "is_partial_profile") { _seen_is_partial_profile = true; // Parse variable 'is_partial_profile' _result_is_partial_profile = ::mlir::FieldParser>::parse(odsParser); if (::mlir::failed(_result_is_partial_profile)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagProfileSummaryAttr parameter 'is_partial_profile' which is to be a `std::optional`"); return {}; } } else if (!_seen_partial_profile_ratio && _paramKey == "partial_profile_ratio") { _seen_partial_profile_ratio = true; // Parse variable 'partial_profile_ratio' _result_partial_profile_ratio = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_partial_profile_ratio)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagProfileSummaryAttr parameter 'partial_profile_ratio' which is to be a `FloatAttr`"); return {}; } } else if (!_seen_detailed_summary && _paramKey == "detailed_summary") { _seen_detailed_summary = true; // Parse variable 'detailed_summary' _result_detailed_summary = ::mlir::FieldParser<::llvm::SmallVector>::parse(odsParser); if (::mlir::failed(_result_detailed_summary)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse ModuleFlagProfileSummaryAttr parameter 'detailed_summary' which is to be a `::llvm::ArrayRef`"); return {}; } } else { odsParser.emitError(odsParser.getCurrentLocation(), "duplicate or unknown struct parameter name: ") << _paramKey; return {}; } return true; }; do { ::llvm::StringRef _paramKey; if (odsParser.parseKeyword(&_paramKey)) { odsParser.emitError(odsParser.getCurrentLocation(), "expected a parameter name in struct"); return {}; } if (!_loop_body(_paramKey)) return {}; } while(!odsParser.parseOptionalComma()); if (!_seen_format) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "format"; return {}; } if (!_seen_total_count) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "total_count"; return {}; } if (!_seen_max_count) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "max_count"; return {}; } if (!_seen_max_internal_count) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "max_internal_count"; return {}; } if (!_seen_max_function_count) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "max_function_count"; return {}; } if (!_seen_num_counts) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "num_counts"; return {}; } if (!_seen_num_functions) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "num_functions"; return {}; } if (!_seen_detailed_summary) { odsParser.emitError(odsParser.getCurrentLocation(), "struct is missing required parameter: ") << "detailed_summary"; return {}; } } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_format)); assert(::mlir::succeeded(_result_total_count)); assert(::mlir::succeeded(_result_max_count)); assert(::mlir::succeeded(_result_max_internal_count)); assert(::mlir::succeeded(_result_max_function_count)); assert(::mlir::succeeded(_result_num_counts)); assert(::mlir::succeeded(_result_num_functions)); assert(::mlir::succeeded(_result_detailed_summary)); return ModuleFlagProfileSummaryAttr::get(odsParser.getContext(), ProfileSummaryFormatKind((*_result_format)), uint64_t((*_result_total_count)), uint64_t((*_result_max_count)), uint64_t((*_result_max_internal_count)), uint64_t((*_result_max_function_count)), uint64_t((*_result_num_counts)), uint64_t((*_result_num_functions)), std::optional((_result_is_partial_profile.value_or(std::optional()))), FloatAttr((_result_partial_profile_ratio.value_or(FloatAttr()))), ::llvm::ArrayRef((*_result_detailed_summary))); } void ModuleFlagProfileSummaryAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; { bool _firstPrinted = true; if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "format = "; odsPrinter.printStrippedAttrOrType(getFormat()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "total_count = "; odsPrinter.printStrippedAttrOrType(getTotalCount()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "max_count = "; odsPrinter.printStrippedAttrOrType(getMaxCount()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "max_internal_count = "; odsPrinter.printStrippedAttrOrType(getMaxInternalCount()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "max_function_count = "; odsPrinter.printStrippedAttrOrType(getMaxFunctionCount()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "num_counts = "; odsPrinter.printStrippedAttrOrType(getNumCounts()); if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "num_functions = "; odsPrinter.printStrippedAttrOrType(getNumFunctions()); if (!(getIsPartialProfile() == std::optional())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "is_partial_profile = "; if (!(getIsPartialProfile() == std::optional())) { odsPrinter.printStrippedAttrOrType(getIsPartialProfile()); } } if (!(getPartialProfileRatio() == FloatAttr())) { if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "partial_profile_ratio = "; if (!(getPartialProfileRatio() == FloatAttr())) { odsPrinter.printStrippedAttrOrType(getPartialProfileRatio()); } } if (!_firstPrinted) odsPrinter << ", "; _firstPrinted = false; odsPrinter << "detailed_summary = "; odsPrinter.printStrippedAttrOrType(getDetailedSummary()); } odsPrinter << ">"; } ProfileSummaryFormatKind ModuleFlagProfileSummaryAttr::getFormat() const { return getImpl()->format; } uint64_t ModuleFlagProfileSummaryAttr::getTotalCount() const { return getImpl()->total_count; } uint64_t ModuleFlagProfileSummaryAttr::getMaxCount() const { return getImpl()->max_count; } uint64_t ModuleFlagProfileSummaryAttr::getMaxInternalCount() const { return getImpl()->max_internal_count; } uint64_t ModuleFlagProfileSummaryAttr::getMaxFunctionCount() const { return getImpl()->max_function_count; } uint64_t ModuleFlagProfileSummaryAttr::getNumCounts() const { return getImpl()->num_counts; } uint64_t ModuleFlagProfileSummaryAttr::getNumFunctions() const { return getImpl()->num_functions; } std::optional ModuleFlagProfileSummaryAttr::getIsPartialProfile() const { return getImpl()->is_partial_profile; } FloatAttr ModuleFlagProfileSummaryAttr::getPartialProfileRatio() const { return getImpl()->partial_profile_ratio; } ::llvm::ArrayRef ModuleFlagProfileSummaryAttr::getDetailedSummary() const { return getImpl()->detailed_summary; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::ModuleFlagProfileSummaryAttr) namespace mlir::LLVM { namespace detail { struct DependentLibrariesAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::llvm::ArrayRef>; DependentLibrariesAttrStorage(::llvm::ArrayRef libs) : libs(std::move(libs)) {} KeyTy getAsKey() const { return KeyTy(libs); } bool operator==(const KeyTy &tblgenKey) const { return (::llvm::ArrayRef(libs) == ::llvm::ArrayRef(std::get<0>(tblgenKey))); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static DependentLibrariesAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto libs = std::move(std::get<0>(tblgenKey)); libs = allocator.copyInto(libs); return new (allocator.allocate()) DependentLibrariesAttrStorage(std::move(libs)); } ::llvm::ArrayRef libs; }; } // namespace detail DependentLibrariesAttr DependentLibrariesAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef libs) { return Base::get(context, std::move(libs)); } ::mlir::Attribute DependentLibrariesAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::llvm::SmallVector> _result_libs; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'libs' _result_libs = ::mlir::FieldParser<::llvm::SmallVector>::parse(odsParser); if (::mlir::failed(_result_libs)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_DependentLibrariesAttr parameter 'libs' which is to be a `::llvm::ArrayRef`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; return DependentLibrariesAttr::get(odsParser.getContext(), ::llvm::ArrayRef((_result_libs.value_or(::llvm::SmallVector())))); } void DependentLibrariesAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; if (!(::llvm::ArrayRef(getLibs()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { odsPrinter.printStrippedAttrOrType(getLibs()); } odsPrinter << ">"; } ::llvm::ArrayRef DependentLibrariesAttr::getLibs() const { return getImpl()->libs; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::DependentLibrariesAttr) namespace mlir::LLVM { namespace detail { struct UWTableKindAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; UWTableKindAttrStorage(uwtable::UWTableKind uwtableKind) : uwtableKind(std::move(uwtableKind)) {} KeyTy getAsKey() const { return KeyTy(uwtableKind); } bool operator==(const KeyTy &tblgenKey) const { return (uwtableKind == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static UWTableKindAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto uwtableKind = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) UWTableKindAttrStorage(std::move(uwtableKind)); } uwtable::UWTableKind uwtableKind; }; } // namespace detail UWTableKindAttr UWTableKindAttr::get(::mlir::MLIRContext *context, uwtable::UWTableKind uwtableKind) { return Base::get(context, std::move(uwtableKind)); } ::mlir::Attribute UWTableKindAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_uwtableKind; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'uwtableKind' _result_uwtableKind = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_uwtableKind)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse UWTableKindAttr parameter 'uwtableKind' which is to be a `uwtable::UWTableKind`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_uwtableKind)); return UWTableKindAttr::get(odsParser.getContext(), uwtable::UWTableKind((*_result_uwtableKind))); } void UWTableKindAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printStrippedAttrOrType(getUwtableKind()); odsPrinter << ">"; } uwtable::UWTableKind UWTableKindAttr::getUwtableKind() const { return getImpl()->uwtableKind; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::UWTableKindAttr) namespace mlir::LLVM { namespace detail { struct MDStringAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; MDStringAttrStorage(StringAttr value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static MDStringAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) MDStringAttrStorage(std::move(value)); } StringAttr value; }; } // namespace detail MDStringAttr MDStringAttr::get(::mlir::MLIRContext *context, StringAttr value) { return Base::get(context, std::move(value)); } ::mlir::Attribute MDStringAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_value; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'value' _result_value = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MDStringAttr parameter 'value' which is to be a `StringAttr`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_value)); return MDStringAttr::get(odsParser.getContext(), StringAttr((*_result_value))); } void MDStringAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printStrippedAttrOrType(getValue()); odsPrinter << ">"; } StringAttr MDStringAttr::getValue() const { return getImpl()->value; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MDStringAttr) namespace mlir::LLVM { namespace detail { struct MDConstantAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; MDConstantAttrStorage(Attribute value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static MDConstantAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) MDConstantAttrStorage(std::move(value)); } Attribute value; }; } // namespace detail MDConstantAttr MDConstantAttr::get(::mlir::MLIRContext *context, Attribute value) { return Base::get(context, std::move(value)); } ::mlir::Attribute MDConstantAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_value; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'value' _result_value = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MDConstantAttr parameter 'value' which is to be a `Attribute`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_value)); return MDConstantAttr::get(odsParser.getContext(), Attribute((*_result_value))); } void MDConstantAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printStrippedAttrOrType(getValue()); odsPrinter << ">"; } Attribute MDConstantAttr::getValue() const { return getImpl()->value; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MDConstantAttr) namespace mlir::LLVM { namespace detail { struct MDFuncAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple; MDFuncAttrStorage(FlatSymbolRefAttr name) : name(std::move(name)) {} KeyTy getAsKey() const { return KeyTy(name); } bool operator==(const KeyTy &tblgenKey) const { return (name == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static MDFuncAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto name = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) MDFuncAttrStorage(std::move(name)); } FlatSymbolRefAttr name; }; } // namespace detail MDFuncAttr MDFuncAttr::get(::mlir::MLIRContext *context, FlatSymbolRefAttr name) { return Base::get(context, std::move(name)); } ::mlir::Attribute MDFuncAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr _result_name; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'name' _result_name = ::mlir::FieldParser::parse(odsParser); if (::mlir::failed(_result_name)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MDFuncAttr parameter 'name' which is to be a `FlatSymbolRefAttr`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_name)); return MDFuncAttr::get(odsParser.getContext(), FlatSymbolRefAttr((*_result_name))); } void MDFuncAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printStrippedAttrOrType(getName()); odsPrinter << ">"; } FlatSymbolRefAttr MDFuncAttr::getName() const { return getImpl()->name; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MDFuncAttr) namespace mlir::LLVM { namespace detail { struct MDNodeAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::llvm::ArrayRef>; MDNodeAttrStorage(::llvm::ArrayRef operands) : operands(std::move(operands)) {} KeyTy getAsKey() const { return KeyTy(operands); } bool operator==(const KeyTy &tblgenKey) const { return (::llvm::ArrayRef(operands) == ::llvm::ArrayRef(std::get<0>(tblgenKey))); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static MDNodeAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto operands = std::move(std::get<0>(tblgenKey)); operands = allocator.copyInto(operands); return new (allocator.allocate()) MDNodeAttrStorage(std::move(operands)); } ::llvm::ArrayRef operands; }; } // namespace detail MDNodeAttr MDNodeAttr::get(::mlir::MLIRContext *context, ::llvm::ArrayRef operands) { return Base::get(context, std::move(operands)); } ::mlir::Attribute MDNodeAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::llvm::SmallVector> _result_operands; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse literal '>' if (odsParser.parseOptionalGreater()) { // Parse variable 'operands' _result_operands = ::mlir::FieldParser<::llvm::SmallVector>::parse(odsParser); if (::mlir::failed(_result_operands)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_MDNodeAttr parameter 'operands' which is to be a `::llvm::ArrayRef`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; } else { } return MDNodeAttr::get(odsParser.getContext(), ::llvm::ArrayRef((_result_operands.value_or(::llvm::SmallVector())))); } void MDNodeAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; if (!(!(::llvm::ArrayRef(getOperands()) == ::llvm::ArrayRef(::llvm::SmallVector())))) { odsPrinter << ">"; } else { if (!(::llvm::ArrayRef(getOperands()) == ::llvm::ArrayRef(::llvm::SmallVector()))) { odsPrinter.printStrippedAttrOrType(getOperands()); } odsPrinter << ">"; } } ::llvm::ArrayRef MDNodeAttr::getOperands() const { return getImpl()->operands; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::MDNodeAttr) namespace mlir::LLVM { namespace detail { struct IntegerOverflowFlagsAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::LLVM::IntegerOverflowFlags>; IntegerOverflowFlagsAttrStorage(::mlir::LLVM::IntegerOverflowFlags value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static IntegerOverflowFlagsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) IntegerOverflowFlagsAttrStorage(std::move(value)); } ::mlir::LLVM::IntegerOverflowFlags value; }; } // namespace detail IntegerOverflowFlagsAttr IntegerOverflowFlagsAttr::get(::mlir::MLIRContext *context, ::mlir::LLVM::IntegerOverflowFlags value) { return Base::get(context, std::move(value)); } ::mlir::Attribute IntegerOverflowFlagsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::LLVM::IntegerOverflowFlags> _result_value; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'value' _result_value = ::mlir::FieldParser<::mlir::LLVM::IntegerOverflowFlags>::parse(odsParser); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_IntegerOverflowFlagsAttr parameter 'value' which is to be a `::mlir::LLVM::IntegerOverflowFlags`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_value)); return IntegerOverflowFlagsAttr::get(odsParser.getContext(), ::mlir::LLVM::IntegerOverflowFlags((*_result_value))); } void IntegerOverflowFlagsAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter.printStrippedAttrOrType(getValue()); odsPrinter << ">"; } ::mlir::LLVM::IntegerOverflowFlags IntegerOverflowFlagsAttr::getValue() const { return getImpl()->value; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::IntegerOverflowFlagsAttr) namespace mlir::LLVM { namespace detail { struct FastmathFlagsAttrStorage : public ::mlir::AttributeStorage { using KeyTy = std::tuple<::mlir::LLVM::FastmathFlags>; FastmathFlagsAttrStorage(::mlir::LLVM::FastmathFlags value) : value(std::move(value)) {} KeyTy getAsKey() const { return KeyTy(value); } bool operator==(const KeyTy &tblgenKey) const { return (value == std::get<0>(tblgenKey)); } static ::llvm::hash_code hashKey(const KeyTy &tblgenKey) { return ::llvm::hash_combine(std::get<0>(tblgenKey)); } static FastmathFlagsAttrStorage *construct(::mlir::AttributeStorageAllocator &allocator, KeyTy &&tblgenKey) { auto value = std::move(std::get<0>(tblgenKey)); return new (allocator.allocate()) FastmathFlagsAttrStorage(std::move(value)); } ::mlir::LLVM::FastmathFlags value; }; } // namespace detail FastmathFlagsAttr FastmathFlagsAttr::get(::mlir::MLIRContext *context, ::mlir::LLVM::FastmathFlags value) { return Base::get(context, std::move(value)); } ::mlir::Attribute FastmathFlagsAttr::parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType) { ::mlir::Builder odsBuilder(odsParser.getContext()); ::llvm::SMLoc odsLoc = odsParser.getCurrentLocation(); (void) odsLoc; ::mlir::FailureOr<::mlir::LLVM::FastmathFlags> _result_value; // Parse literal '<' if (odsParser.parseLess()) return {}; // Parse variable 'value' _result_value = [&]() -> ::mlir::FailureOr<::mlir::LLVM::FastmathFlags> { ::mlir::LLVM::FastmathFlags flags = {}; auto loc = odsParser.getCurrentLocation(); std::string enumKeyword; do { if (::mlir::failed(odsParser.parseKeywordOrString(&enumKeyword))) return ::mlir::failure(); auto maybeEnum = ::mlir::LLVM::symbolizeFastmathFlags(enumKeyword); if (!maybeEnum) { return {(::llvm::LogicalResult)(odsParser.emitError(loc) << "expected " << "::mlir::LLVM::FastmathFlags" << " to be one of: " << "none" << ", " << "nnan" << ", " << "ninf" << ", " << "nsz" << ", " << "arcp" << ", " << "contract" << ", " << "afn" << ", " << "reassoc" << ", " << "fast")}; } flags = flags | *maybeEnum; } while(::mlir::succeeded(odsParser.parseOptionalComma())); return flags; }(); if (::mlir::failed(_result_value)) { odsParser.emitError(odsParser.getCurrentLocation(), "failed to parse LLVM_FastmathFlagsAttr parameter 'value' which is to be a `::mlir::LLVM::FastmathFlags`"); return {}; } // Parse literal '>' if (odsParser.parseGreater()) return {}; assert(::mlir::succeeded(_result_value)); return FastmathFlagsAttr::get(odsParser.getContext(), ::mlir::LLVM::FastmathFlags((*_result_value))); } void FastmathFlagsAttr::print(::mlir::AsmPrinter &odsPrinter) const { ::mlir::Builder odsBuilder(getContext()); odsPrinter << "<"; odsPrinter << stringifyFastmathFlags(getValue()); odsPrinter << ">"; } ::mlir::LLVM::FastmathFlags FastmathFlagsAttr::getValue() const { return getImpl()->value; } } // namespace mlir::LLVM MLIR_DEFINE_EXPLICIT_TYPE_ID(::mlir::LLVM::FastmathFlagsAttr) namespace mlir::LLVM { /// Parse an attribute registered to this dialect. ::mlir::Attribute LLVMDialect::parseAttribute(::mlir::DialectAsmParser &parser, ::mlir::Type type) const { ::llvm::SMLoc typeLoc = parser.getCurrentLocation(); ::llvm::StringRef attrTag; { ::mlir::Attribute attr; auto parseResult = generatedAttributeParser(parser, &attrTag, type, attr); if (parseResult.has_value()) return attr; } parser.emitError(typeLoc) << "unknown attribute `" << attrTag << "` in dialect `" << getNamespace() << "`"; return {}; } /// Print an attribute registered to this dialect. void LLVMDialect::printAttribute(::mlir::Attribute attr, ::mlir::DialectAsmPrinter &printer) const { if (::mlir::succeeded(generatedAttributePrinter(attr, printer))) return; } } // namespace mlir::LLVM #endif // GET_ATTRDEF_CLASSES