/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* Interface Declarations *| |* *| |* Automatically generated file, do not edit! *| |* *| \*===----------------------------------------------------------------------===*/ namespace mlir::LLVM { /// This attribute represents a DITypeAttr that is recursive. Only DITypeAttrs /// that translate to LLVM DITypes that support mutation should implement this /// interface. /// /// There are two modes for conforming attributes: /// /// 1. "rec-decl": /// - This attr is a recursive declaration identified by a recId. /// /// 2. "rec-self": /// - This attr is considered a recursive self reference. /// - This attr itself is a placeholder type that should be conceptually /// replaced with the closest parent attr of the same type with the same /// recId. /// /// For example, to represent a linked list struct: /// /// #rec_self = di_composite_type /// #ptr = di_derived_type /// #field = di_derived_type /// #rec = di_composite_type /// #var = di_local_variable /// /// Note that a rec-self without an outer rec-decl with the same recId is /// conceptually the same as an "unbound" variable. The context needs to provide /// meaning to the rec-self. class DIRecursiveTypeAttrInterface; } // namespace mlir::LLVM namespace mlir::LLVM { /// An interface for attributes that represent LLVM address spaces. /// Implementing attributes should provide access to the address space value /// as an unsigned integer. class LLVMAddrSpaceAttrInterface; } // namespace mlir::LLVM namespace mlir::LLVM { /// An interface for attributes that represent LLVM intrinsic integer immediate /// arguments while using a richer dialect-specific assembly form. /// /// The default implementation is intended for enum-style attributes whose /// `getValue()` returns an enum with a storage type that matches the LLVM /// immarg width. Attributes with non-enum storage or a different LLVM immarg /// width must override `getIntegerAttr`. class IntrinsicIntegerAttrInterface; } // namespace mlir::LLVM namespace mlir::LLVM { /// An interface for attributes that represent LLVM module flag metadata entries. /// /// Implementing attributes provide the module flag merge behavior, metadata key, /// and metadata value. This lets target dialects define richer, target-specific /// module flag attributes while still sharing `llvm.module_flags` as the common /// operation container. Values returned by this interface must use a shape that /// can be exported to LLVM IR: integer attributes (exported as i32 constants), /// string attributes, attributes implementing `IntrinsicIntegerAttrInterface`, /// supported array values, or `ModuleFlagProfileSummaryAttr`. class ModuleFlagAttrInterface; } // namespace mlir::LLVM namespace mlir::LLVM { /// Interface for attributes that describe LLVM targets. /// /// These attributes should be able to return the specified target `triple`, /// `chip` and `features`. /// /// Implementing attributes should provide a `DLTIQueryInterface::query()` /// implementation which responds to keys `"triple"`, `"chip"` and `"features"` /// by returning appropriate `StringAttr`s. class TargetAttrInterface; } // namespace mlir::LLVM namespace mlir::LLVM { /// This attribute represents a DITypeAttr that is recursive. Only DITypeAttrs /// that translate to LLVM DITypes that support mutation should implement this /// interface. /// /// There are two modes for conforming attributes: /// /// 1. "rec-decl": /// - This attr is a recursive declaration identified by a recId. /// /// 2. "rec-self": /// - This attr is considered a recursive self reference. /// - This attr itself is a placeholder type that should be conceptually /// replaced with the closest parent attr of the same type with the same /// recId. /// /// For example, to represent a linked list struct: /// /// #rec_self = di_composite_type /// #ptr = di_derived_type /// #field = di_derived_type /// #rec = di_composite_type /// #var = di_local_variable /// /// Note that a rec-self without an outer rec-decl with the same recId is /// conceptually the same as an "unbound" variable. The context needs to provide /// meaning to the rec-self. namespace detail { struct DIRecursiveTypeAttrInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. bool (*getIsRecSelf)(const Concept *impl, ::mlir::Attribute ); DistinctAttr (*getRecId)(const Concept *impl, ::mlir::Attribute ); DIRecursiveTypeAttrInterface (*withRecId)(const Concept *impl, ::mlir::Attribute , DistinctAttr); DIRecursiveTypeAttrInterface (*getRecSelf)(DistinctAttr); }; template class Model : public Concept { public: using Interface = ::mlir::LLVM::DIRecursiveTypeAttrInterface; Model() : Concept{getIsRecSelf, getRecId, withRecId, getRecSelf} {} static inline bool getIsRecSelf(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); static inline DistinctAttr getRecId(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); static inline DIRecursiveTypeAttrInterface withRecId(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, DistinctAttr recId); static inline DIRecursiveTypeAttrInterface getRecSelf(DistinctAttr recId); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::LLVM::DIRecursiveTypeAttrInterface; FallbackModel() : Concept{getIsRecSelf, getRecId, withRecId, getRecSelf} {} static inline bool getIsRecSelf(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); static inline DistinctAttr getRecId(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); static inline DIRecursiveTypeAttrInterface withRecId(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, DistinctAttr recId); static inline DIRecursiveTypeAttrInterface getRecSelf(DistinctAttr recId); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteAttr; }; }; template struct DIRecursiveTypeAttrInterfaceTrait; } // namespace detail class DIRecursiveTypeAttrInterface : public ::mlir::AttributeInterface { public: using ::mlir::AttributeInterface::AttributeInterface; template struct Trait : public detail::DIRecursiveTypeAttrInterfaceTrait {}; /// Get whether this attr describes a recursive self reference. bool getIsRecSelf() const; /// Get the recursive ID used for matching "rec-decl" with "rec-self". /// If this attr instance is not recursive, return a null attribute. DistinctAttr getRecId() const; /// Get a copy of this type attr but with the recursive ID set to `recId`. DIRecursiveTypeAttrInterface withRecId(DistinctAttr recId) const; /// Build a rec-self instance using the provided `recId`. DIRecursiveTypeAttrInterface getRecSelf(DistinctAttr recId) const; }; } // namespace mlir::LLVM namespace mlir::LLVM { /// An interface for attributes that represent LLVM address spaces. /// Implementing attributes should provide access to the address space value /// as an unsigned integer. namespace detail { struct LLVMAddrSpaceAttrInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. unsigned (*getAddressSpace)(const Concept *impl, ::mlir::Attribute ); }; template class Model : public Concept { public: using Interface = ::mlir::LLVM::LLVMAddrSpaceAttrInterface; Model() : Concept{getAddressSpace} {} static inline unsigned getAddressSpace(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::LLVM::LLVMAddrSpaceAttrInterface; FallbackModel() : Concept{getAddressSpace} {} static inline unsigned getAddressSpace(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteAttr; }; }; template struct LLVMAddrSpaceAttrInterfaceTrait; } // namespace detail class LLVMAddrSpaceAttrInterface : public ::mlir::AttributeInterface { public: using ::mlir::AttributeInterface::AttributeInterface; template struct Trait : public detail::LLVMAddrSpaceAttrInterfaceTrait {}; /// Returns the address space as an unsigned integer. unsigned getAddressSpace() const; }; } // namespace mlir::LLVM namespace mlir::LLVM { /// An interface for attributes that represent LLVM intrinsic integer immediate /// arguments while using a richer dialect-specific assembly form. /// /// The default implementation is intended for enum-style attributes whose /// `getValue()` returns an enum with a storage type that matches the LLVM /// immarg width. Attributes with non-enum storage or a different LLVM immarg /// width must override `getIntegerAttr`. namespace detail { struct IntrinsicIntegerAttrInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. ::mlir::IntegerAttr (*getIntegerAttr)(const Concept *impl, ::mlir::Attribute ); }; template class Model : public Concept { public: using Interface = ::mlir::LLVM::IntrinsicIntegerAttrInterface; Model() : Concept{getIntegerAttr} {} static inline ::mlir::IntegerAttr getIntegerAttr(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::LLVM::IntrinsicIntegerAttrInterface; FallbackModel() : Concept{getIntegerAttr} {} static inline ::mlir::IntegerAttr getIntegerAttr(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteAttr; ::mlir::IntegerAttr getIntegerAttr(::mlir::Attribute tablegen_opaque_val) const; }; }; template struct IntrinsicIntegerAttrInterfaceTrait; } // namespace detail class IntrinsicIntegerAttrInterface : public ::mlir::AttributeInterface { public: using ::mlir::AttributeInterface::AttributeInterface; template struct Trait : public detail::IntrinsicIntegerAttrInterfaceTrait {}; /// Returns the integer attribute to pass to LLVM. ::mlir::IntegerAttr getIntegerAttr() const; }; } // namespace mlir::LLVM namespace mlir::LLVM { /// An interface for attributes that represent LLVM module flag metadata entries. /// /// Implementing attributes provide the module flag merge behavior, metadata key, /// and metadata value. This lets target dialects define richer, target-specific /// module flag attributes while still sharing `llvm.module_flags` as the common /// operation container. Values returned by this interface must use a shape that /// can be exported to LLVM IR: integer attributes (exported as i32 constants), /// string attributes, attributes implementing `IntrinsicIntegerAttrInterface`, /// supported array values, or `ModuleFlagProfileSummaryAttr`. namespace detail { struct ModuleFlagAttrInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. ::mlir::LLVM::ModFlagBehavior (*getModuleFlagBehavior)(const Concept *impl, ::mlir::Attribute ); ::mlir::StringAttr (*getModuleFlagKey)(const Concept *impl, ::mlir::Attribute ); ::mlir::Attribute (*getModuleFlagValue)(const Concept *impl, ::mlir::Attribute ); }; template class Model : public Concept { public: using Interface = ::mlir::LLVM::ModuleFlagAttrInterface; Model() : Concept{getModuleFlagBehavior, getModuleFlagKey, getModuleFlagValue} {} static inline ::mlir::LLVM::ModFlagBehavior getModuleFlagBehavior(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); static inline ::mlir::StringAttr getModuleFlagKey(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); static inline ::mlir::Attribute getModuleFlagValue(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::LLVM::ModuleFlagAttrInterface; FallbackModel() : Concept{getModuleFlagBehavior, getModuleFlagKey, getModuleFlagValue} {} static inline ::mlir::LLVM::ModFlagBehavior getModuleFlagBehavior(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); static inline ::mlir::StringAttr getModuleFlagKey(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); static inline ::mlir::Attribute getModuleFlagValue(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteAttr; }; }; template struct ModuleFlagAttrInterfaceTrait; } // namespace detail class ModuleFlagAttrInterface : public ::mlir::AttributeInterface { public: using ::mlir::AttributeInterface::AttributeInterface; template struct Trait : public detail::ModuleFlagAttrInterfaceTrait {}; /// Returns the module flag merge behavior. ::mlir::LLVM::ModFlagBehavior getModuleFlagBehavior() const; /// Returns the module flag metadata key. ::mlir::StringAttr getModuleFlagKey() const; /// Returns the module flag metadata value. ::mlir::Attribute getModuleFlagValue() const; }; } // namespace mlir::LLVM namespace mlir::LLVM { /// Interface for attributes that describe LLVM targets. /// /// These attributes should be able to return the specified target `triple`, /// `chip` and `features`. /// /// Implementing attributes should provide a `DLTIQueryInterface::query()` /// implementation which responds to keys `"triple"`, `"chip"` and `"features"` /// by returning appropriate `StringAttr`s. namespace detail { struct TargetAttrInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. StringAttr (*getTriple)(const Concept *impl, ::mlir::Attribute ); StringAttr (*getChip)(const Concept *impl, ::mlir::Attribute ); Attribute (*getFeatures)(const Concept *impl, ::mlir::Attribute ); /// The base classes of this interface. const ::mlir::DLTIQueryInterface::Concept *implDLTIQueryInterface = nullptr; void initializeInterfaceConcept(::mlir::detail::InterfaceMap &interfaceMap) { implDLTIQueryInterface = interfaceMap.lookup<::mlir::DLTIQueryInterface>(); assert(implDLTIQueryInterface && "`::mlir::LLVM::TargetAttrInterface` expected its base interface `::mlir::DLTIQueryInterface` to be registered"); } }; template class Model : public Concept { public: using Interface = ::mlir::LLVM::TargetAttrInterface; Model() : Concept{getTriple, getChip, getFeatures} {} static inline StringAttr getTriple(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); static inline StringAttr getChip(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); static inline Attribute getFeatures(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::LLVM::TargetAttrInterface; FallbackModel() : Concept{getTriple, getChip, getFeatures} {} static inline StringAttr getTriple(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); static inline StringAttr getChip(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); static inline Attribute getFeatures(const Concept *impl, ::mlir::Attribute tablegen_opaque_val); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteAttr; }; }; template struct TargetAttrInterfaceTrait; } // namespace detail class TargetAttrInterface : public ::mlir::AttributeInterface { public: using ::mlir::AttributeInterface::AttributeInterface; template struct Trait : public detail::TargetAttrInterfaceTrait {}; /// Returns the target triple identifier. StringAttr getTriple() const; /// Returns the target chip (i.e. "cpu") identifier. StringAttr getChip() const; /// Returns the target features as a TargetFeaturesAttr. Attribute getFeatures() const; //===----------------------------------------------------------------===// // Inherited from ::mlir::DLTIQueryInterface //===----------------------------------------------------------------===// operator ::mlir::DLTIQueryInterface () const { if (!*this) return nullptr; return ::mlir::DLTIQueryInterface(*this, getImpl()->implDLTIQueryInterface); } /// Returns the attribute associated with the key. ::mlir::FailureOr<::mlir::Attribute> query(::mlir::DataLayoutEntryKey key) const; }; } // namespace mlir::LLVM namespace mlir::LLVM::detail { template struct DIRecursiveTypeAttrInterfaceTrait : public ::mlir::AttributeInterface::Trait { }; } // namespace mlir::LLVM::detail namespace mlir::LLVM::detail { template struct LLVMAddrSpaceAttrInterfaceTrait : public ::mlir::AttributeInterface::Trait { }; } // namespace mlir::LLVM::detail namespace mlir::LLVM::detail { template struct IntrinsicIntegerAttrInterfaceTrait : public ::mlir::AttributeInterface::Trait { /// Returns the integer attribute to pass to LLVM. ::mlir::IntegerAttr getIntegerAttr() const { using EnumType = decltype((*static_cast(this)).getValue()); using StorageType = std::underlying_type_t; auto type = ::mlir::IntegerType::get((*static_cast(this)).getContext(), sizeof(StorageType) * 8); return ::mlir::IntegerAttr::get( type, static_cast((*static_cast(this)).getValue())); } }; } // namespace mlir::LLVM::detail namespace mlir::LLVM::detail { template struct ModuleFlagAttrInterfaceTrait : public ::mlir::AttributeInterface::Trait { }; } // namespace mlir::LLVM::detail namespace mlir::LLVM::detail { template struct TargetAttrInterfaceTrait : public ::mlir::AttributeInterface::Trait { }; } // namespace mlir::LLVM::detail namespace mlir::LLVM { template bool detail::DIRecursiveTypeAttrInterfaceInterfaceTraits::Model::getIsRecSelf(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return (::llvm::cast(tablegen_opaque_val)).getIsRecSelf(); } template DistinctAttr detail::DIRecursiveTypeAttrInterfaceInterfaceTraits::Model::getRecId(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return (::llvm::cast(tablegen_opaque_val)).getRecId(); } template DIRecursiveTypeAttrInterface detail::DIRecursiveTypeAttrInterfaceInterfaceTraits::Model::withRecId(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, DistinctAttr recId) { return (::llvm::cast(tablegen_opaque_val)).withRecId(recId); } template DIRecursiveTypeAttrInterface detail::DIRecursiveTypeAttrInterfaceInterfaceTraits::Model::getRecSelf(DistinctAttr recId) { return ConcreteAttr::getRecSelf(recId); } template bool detail::DIRecursiveTypeAttrInterfaceInterfaceTraits::FallbackModel::getIsRecSelf(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return static_cast(impl)->getIsRecSelf(tablegen_opaque_val); } template DistinctAttr detail::DIRecursiveTypeAttrInterfaceInterfaceTraits::FallbackModel::getRecId(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return static_cast(impl)->getRecId(tablegen_opaque_val); } template DIRecursiveTypeAttrInterface detail::DIRecursiveTypeAttrInterfaceInterfaceTraits::FallbackModel::withRecId(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, DistinctAttr recId) { return static_cast(impl)->withRecId(tablegen_opaque_val, recId); } template DIRecursiveTypeAttrInterface detail::DIRecursiveTypeAttrInterfaceInterfaceTraits::FallbackModel::getRecSelf(DistinctAttr recId) { return ConcreteAttr::getRecSelf(recId); } } // namespace mlir::LLVM namespace mlir::LLVM { template unsigned detail::LLVMAddrSpaceAttrInterfaceInterfaceTraits::Model::getAddressSpace(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return (::llvm::cast(tablegen_opaque_val)).getAddressSpace(); } template unsigned detail::LLVMAddrSpaceAttrInterfaceInterfaceTraits::FallbackModel::getAddressSpace(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return static_cast(impl)->getAddressSpace(tablegen_opaque_val); } } // namespace mlir::LLVM namespace mlir::LLVM { template ::mlir::IntegerAttr detail::IntrinsicIntegerAttrInterfaceInterfaceTraits::Model::getIntegerAttr(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return (::llvm::cast(tablegen_opaque_val)).getIntegerAttr(); } template ::mlir::IntegerAttr detail::IntrinsicIntegerAttrInterfaceInterfaceTraits::FallbackModel::getIntegerAttr(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return static_cast(impl)->getIntegerAttr(tablegen_opaque_val); } template ::mlir::IntegerAttr detail::IntrinsicIntegerAttrInterfaceInterfaceTraits::ExternalModel::getIntegerAttr(::mlir::Attribute tablegen_opaque_val) const { using EnumType = decltype((::llvm::cast(tablegen_opaque_val)).getValue()); using StorageType = std::underlying_type_t; auto type = ::mlir::IntegerType::get((::llvm::cast(tablegen_opaque_val)).getContext(), sizeof(StorageType) * 8); return ::mlir::IntegerAttr::get( type, static_cast((::llvm::cast(tablegen_opaque_val)).getValue())); } } // namespace mlir::LLVM namespace mlir::LLVM { template ::mlir::LLVM::ModFlagBehavior detail::ModuleFlagAttrInterfaceInterfaceTraits::Model::getModuleFlagBehavior(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return (::llvm::cast(tablegen_opaque_val)).getModuleFlagBehavior(); } template ::mlir::StringAttr detail::ModuleFlagAttrInterfaceInterfaceTraits::Model::getModuleFlagKey(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return (::llvm::cast(tablegen_opaque_val)).getModuleFlagKey(); } template ::mlir::Attribute detail::ModuleFlagAttrInterfaceInterfaceTraits::Model::getModuleFlagValue(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return (::llvm::cast(tablegen_opaque_val)).getModuleFlagValue(); } template ::mlir::LLVM::ModFlagBehavior detail::ModuleFlagAttrInterfaceInterfaceTraits::FallbackModel::getModuleFlagBehavior(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return static_cast(impl)->getModuleFlagBehavior(tablegen_opaque_val); } template ::mlir::StringAttr detail::ModuleFlagAttrInterfaceInterfaceTraits::FallbackModel::getModuleFlagKey(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return static_cast(impl)->getModuleFlagKey(tablegen_opaque_val); } template ::mlir::Attribute detail::ModuleFlagAttrInterfaceInterfaceTraits::FallbackModel::getModuleFlagValue(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return static_cast(impl)->getModuleFlagValue(tablegen_opaque_val); } } // namespace mlir::LLVM namespace mlir::LLVM { template StringAttr detail::TargetAttrInterfaceInterfaceTraits::Model::getTriple(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return (::llvm::cast(tablegen_opaque_val)).getTriple(); } template StringAttr detail::TargetAttrInterfaceInterfaceTraits::Model::getChip(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return (::llvm::cast(tablegen_opaque_val)).getChip(); } template Attribute detail::TargetAttrInterfaceInterfaceTraits::Model::getFeatures(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return (::llvm::cast(tablegen_opaque_val)).getFeatures(); } template StringAttr detail::TargetAttrInterfaceInterfaceTraits::FallbackModel::getTriple(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return static_cast(impl)->getTriple(tablegen_opaque_val); } template StringAttr detail::TargetAttrInterfaceInterfaceTraits::FallbackModel::getChip(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return static_cast(impl)->getChip(tablegen_opaque_val); } template Attribute detail::TargetAttrInterfaceInterfaceTraits::FallbackModel::getFeatures(const Concept *impl, ::mlir::Attribute tablegen_opaque_val) { return static_cast(impl)->getFeatures(tablegen_opaque_val); } } // namespace mlir::LLVM