| 1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
| 2 | |* *| |
| 3 | |* Interface Declarations *| |
| 4 | |* *| |
| 5 | |* Automatically generated file, do not edit! *| |
| 6 | |* *| |
| 7 | \*===----------------------------------------------------------------------===*/ |
| 8 | |
| 9 | #include "mlir/IR/Attributes.h" |
| 10 | |
| 11 | namespace mlir { |
| 12 | |
| 13 | /// This interface describes an attribute that may use a `Symbol`. This |
| 14 | /// interface allows for users of symbols to hook into verification and other |
| 15 | /// symbol related utilities that are either costly or otherwise disallowed |
| 16 | /// within an operation (e.g., recreating symbol users per op verified rather |
| 17 | /// than per symbol table, or querying symbols usage of sibblings). |
| 18 | class SymbolUserAttrInterface; |
| 19 | |
| 20 | } // namespace mlir |
| 21 | namespace mlir { |
| 22 | |
| 23 | /// This interface describes an attribute that may use a `Symbol`. This |
| 24 | /// interface allows for users of symbols to hook into verification and other |
| 25 | /// symbol related utilities that are either costly or otherwise disallowed |
| 26 | /// within an operation (e.g., recreating symbol users per op verified rather |
| 27 | /// than per symbol table, or querying symbols usage of sibblings). |
| 28 | namespace detail { |
| 29 | struct SymbolUserAttrInterfaceInterfaceTraits { |
| 30 | struct Concept { |
| 31 | /// The methods defined by the interface. |
| 32 | ::llvm::LogicalResult (*verifySymbolUses)(const Concept *impl, ::mlir::Attribute , ::mlir::Operation *, ::mlir::SymbolTableCollection &); |
| 33 | }; |
| 34 | template<typename ConcreteAttr> |
| 35 | class Model : public Concept { |
| 36 | public: |
| 37 | using Interface = ::mlir::SymbolUserAttrInterface; |
| 38 | using GeneratedModel = Model; |
| 39 | constexpr Model() : Concept{.verifySymbolUses: verifySymbolUses} {} |
| 40 | |
| 41 | static inline ::llvm::LogicalResult verifySymbolUses(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation * op, ::mlir::SymbolTableCollection & symbolTable); |
| 42 | }; |
| 43 | template<typename ConcreteAttr> |
| 44 | class FallbackModel : public Concept { |
| 45 | public: |
| 46 | using Interface = ::mlir::SymbolUserAttrInterface; |
| 47 | FallbackModel() : Concept{.verifySymbolUses: verifySymbolUses} {} |
| 48 | |
| 49 | static inline ::llvm::LogicalResult verifySymbolUses(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation * op, ::mlir::SymbolTableCollection & symbolTable); |
| 50 | }; |
| 51 | template<typename ConcreteModel, typename ConcreteAttr> |
| 52 | class ExternalModel : public FallbackModel<ConcreteModel> { |
| 53 | public: |
| 54 | using ConcreteEntity = ConcreteAttr; |
| 55 | }; |
| 56 | }; |
| 57 | template <typename ConcreteAttr> |
| 58 | struct SymbolUserAttrInterfaceTrait; |
| 59 | |
| 60 | } // namespace detail |
| 61 | class SymbolUserAttrInterface : public ::mlir::AttributeInterface<SymbolUserAttrInterface, detail::SymbolUserAttrInterfaceInterfaceTraits> { |
| 62 | public: |
| 63 | using ::mlir::AttributeInterface<SymbolUserAttrInterface, detail::SymbolUserAttrInterfaceInterfaceTraits>::AttributeInterface; |
| 64 | template <typename ConcreteAttr> |
| 65 | struct Trait : public detail::SymbolUserAttrInterfaceTrait<ConcreteAttr> {}; |
| 66 | |
| 67 | /// Verify the symbol uses held by this attribute of this operation. |
| 68 | ::llvm::LogicalResult verifySymbolUses(::mlir::Operation * op, ::mlir::SymbolTableCollection & symbolTable) const; |
| 69 | }; |
| 70 | |
| 71 | } // namespace mlir |
| 72 | namespace mlir::detail { |
| 73 | |
| 74 | template <typename ConcreteAttr> |
| 75 | struct SymbolUserAttrInterfaceTrait : public ::mlir::AttributeInterface<SymbolUserAttrInterface, detail::SymbolUserAttrInterfaceInterfaceTraits>::Trait<ConcreteAttr> { |
| 76 | }; |
| 77 | |
| 78 | } // namespace mlir::detail |
| 79 | namespace mlir { |
| 80 | |
| 81 | template<typename ConcreteAttr> |
| 82 | ::llvm::LogicalResult detail::SymbolUserAttrInterfaceInterfaceTraits::Model<ConcreteAttr>::verifySymbolUses(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation * op, ::mlir::SymbolTableCollection & symbolTable) { |
| 83 | return (::llvm::cast<ConcreteAttr>(tablegen_opaque_val)).verifySymbolUses(op, symbolTable); |
| 84 | } |
| 85 | template<typename ConcreteAttr> |
| 86 | ::llvm::LogicalResult detail::SymbolUserAttrInterfaceInterfaceTraits::FallbackModel<ConcreteAttr>::verifySymbolUses(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation * op, ::mlir::SymbolTableCollection & symbolTable) { |
| 87 | return static_cast<const ConcreteAttr *>(impl)->verifySymbolUses(tablegen_opaque_val, op, symbolTable); |
| 88 | } |
| 89 | |
| 90 | } // namespace mlir |
| 91 | |