/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* Interface Declarations *| |* *| |* Automatically generated file, do not edit! *| |* *| \*===----------------------------------------------------------------------===*/ namespace mlir { /// This interface describes an operation that may define a `Symbol`. A `Symbol` /// operation resides immediately within a region that defines a `SymbolTable`. /// See [Symbols and SymbolTables](../SymbolsAndSymbolTables.md) for more details /// and constraints on `Symbol` operations. class SymbolOpInterface; } // namespace mlir namespace mlir { /// This interface describes an operation that may use a `Symbol`. This /// interface allows for users of symbols to hook into verification and other /// symbol related utilities that are either costly or otherwise disallowed /// within an operation. class SymbolUserOpInterface; } // namespace mlir namespace mlir { /// This interface describes an operation that may define a `Symbol`. A `Symbol` /// operation resides immediately within a region that defines a `SymbolTable`. /// See [Symbols and SymbolTables](../SymbolsAndSymbolTables.md) for more details /// and constraints on `Symbol` operations. namespace detail { struct SymbolOpInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. ::mlir::StringAttr (*getNameAttr)(const Concept *impl, ::mlir::Operation *); void (*setName)(const Concept *impl, ::mlir::Operation *, ::mlir::StringAttr); mlir::SymbolTable::Visibility (*getVisibility)(const Concept *impl, ::mlir::Operation *); bool (*isNested)(const Concept *impl, ::mlir::Operation *); bool (*isPrivate)(const Concept *impl, ::mlir::Operation *); bool (*isPublic)(const Concept *impl, ::mlir::Operation *); void (*setVisibility)(const Concept *impl, ::mlir::Operation *, mlir::SymbolTable::Visibility); void (*setNested)(const Concept *impl, ::mlir::Operation *); void (*setPrivate)(const Concept *impl, ::mlir::Operation *); void (*setPublic)(const Concept *impl, ::mlir::Operation *); ::std::optional<::mlir::SymbolTable::UseRange> (*getSymbolUses)(const Concept *impl, ::mlir::Operation *, ::mlir::Operation *); bool (*symbolKnownUseEmpty)(const Concept *impl, ::mlir::Operation *, ::mlir::Operation *); ::llvm::LogicalResult (*replaceAllSymbolUses)(const Concept *impl, ::mlir::Operation *, ::mlir::StringAttr, ::mlir::Operation *); bool (*isOptionalSymbol)(const Concept *impl, ::mlir::Operation *); bool (*canDiscardOnUseEmpty)(const Concept *impl, ::mlir::Operation *); bool (*isDeclaration)(const Concept *impl, ::mlir::Operation *); }; template class Model : public Concept { public: using Interface = ::mlir::SymbolOpInterface; Model() : Concept{getNameAttr, setName, getVisibility, isNested, isPrivate, isPublic, setVisibility, setNested, setPrivate, setPublic, getSymbolUses, symbolKnownUseEmpty, replaceAllSymbolUses, isOptionalSymbol, canDiscardOnUseEmpty, isDeclaration} {} static inline ::mlir::StringAttr getNameAttr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline void setName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::StringAttr name); static inline mlir::SymbolTable::Visibility getVisibility(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline bool isNested(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline bool isPrivate(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline bool isPublic(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline void setVisibility(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, mlir::SymbolTable::Visibility vis); static inline void setNested(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline void setPrivate(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline void setPublic(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::std::optional<::mlir::SymbolTable::UseRange> getSymbolUses(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Operation * from); static inline bool symbolKnownUseEmpty(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Operation * from); static inline ::llvm::LogicalResult replaceAllSymbolUses(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::StringAttr newSymbol, ::mlir::Operation * from); static inline bool isOptionalSymbol(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline bool canDiscardOnUseEmpty(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline bool isDeclaration(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::SymbolOpInterface; FallbackModel() : Concept{getNameAttr, setName, getVisibility, isNested, isPrivate, isPublic, setVisibility, setNested, setPrivate, setPublic, getSymbolUses, symbolKnownUseEmpty, replaceAllSymbolUses, isOptionalSymbol, canDiscardOnUseEmpty, isDeclaration} {} static inline ::mlir::StringAttr getNameAttr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline void setName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::StringAttr name); static inline mlir::SymbolTable::Visibility getVisibility(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline bool isNested(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline bool isPrivate(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline bool isPublic(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline void setVisibility(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, mlir::SymbolTable::Visibility vis); static inline void setNested(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline void setPrivate(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline void setPublic(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::std::optional<::mlir::SymbolTable::UseRange> getSymbolUses(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Operation * from); static inline bool symbolKnownUseEmpty(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Operation * from); static inline ::llvm::LogicalResult replaceAllSymbolUses(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::StringAttr newSymbol, ::mlir::Operation * from); static inline bool isOptionalSymbol(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline bool canDiscardOnUseEmpty(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline bool isDeclaration(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteOp; ::mlir::StringAttr getNameAttr(::mlir::Operation *tablegen_opaque_val) const; void setName(::mlir::Operation *tablegen_opaque_val, ::mlir::StringAttr name) const; mlir::SymbolTable::Visibility getVisibility(::mlir::Operation *tablegen_opaque_val) const; bool isNested(::mlir::Operation *tablegen_opaque_val) const; bool isPrivate(::mlir::Operation *tablegen_opaque_val) const; bool isPublic(::mlir::Operation *tablegen_opaque_val) const; void setVisibility(::mlir::Operation *tablegen_opaque_val, mlir::SymbolTable::Visibility vis) const; void setNested(::mlir::Operation *tablegen_opaque_val) const; void setPrivate(::mlir::Operation *tablegen_opaque_val) const; void setPublic(::mlir::Operation *tablegen_opaque_val) const; ::std::optional<::mlir::SymbolTable::UseRange> getSymbolUses(::mlir::Operation *tablegen_opaque_val, ::mlir::Operation *from) const; bool symbolKnownUseEmpty(::mlir::Operation *tablegen_opaque_val, ::mlir::Operation *from) const; ::llvm::LogicalResult replaceAllSymbolUses(::mlir::Operation *tablegen_opaque_val, ::mlir::StringAttr newSymbol, ::mlir::Operation *from) const; bool isOptionalSymbol(::mlir::Operation *tablegen_opaque_val) const; bool canDiscardOnUseEmpty(::mlir::Operation *tablegen_opaque_val) const; bool isDeclaration(::mlir::Operation *tablegen_opaque_val) const; }; }; template struct SymbolOpInterfaceTrait; } // namespace detail class SymbolOpInterface : public ::mlir::OpInterface { public: using ::mlir::OpInterface::OpInterface; template struct Trait : public detail::SymbolOpInterfaceTrait {}; /// Returns the name of this symbol. ::mlir::StringAttr getNameAttr(); /// Sets the name of this symbol. void setName(::mlir::StringAttr name); /// Gets the visibility of this symbol. mlir::SymbolTable::Visibility getVisibility(); /// Returns true if this symbol has nested visibility. bool isNested(); /// Returns true if this symbol has private visibility. bool isPrivate(); /// Returns true if this symbol has public visibility. bool isPublic(); /// Sets the visibility of this symbol. void setVisibility(mlir::SymbolTable::Visibility vis); /// Sets the visibility of this symbol to be nested. void setNested(); /// Sets the visibility of this symbol to be private. void setPrivate(); /// Sets the visibility of this symbol to be public. void setPublic(); /// Get all of the uses of the current symbol that are nested within the /// given operation 'from'. /// Note: See mlir::SymbolTable::getSymbolUses for more details. ::std::optional<::mlir::SymbolTable::UseRange> getSymbolUses(::mlir::Operation * from); /// Return if the current symbol is known to have no uses that are nested /// within the given operation 'from'. /// Note: See mlir::SymbolTable::symbolKnownUseEmpty for more details. bool symbolKnownUseEmpty(::mlir::Operation * from); /// Attempt to replace all uses of the current symbol with the provided /// symbol 'newSymbol' that are nested within the given operation 'from'. /// Note: See mlir::SymbolTable::replaceAllSymbolUses for more details. ::llvm::LogicalResult replaceAllSymbolUses(::mlir::StringAttr newSymbol, ::mlir::Operation * from); /// Returns true if this operation optionally defines a symbol based on the /// presence of the symbol name. bool isOptionalSymbol(); /// Returns true if this operation can be discarded if it has no remaining /// symbol uses. bool canDiscardOnUseEmpty(); /// Returns true if this operation is a declaration of a symbol (as opposed /// to a definition). bool isDeclaration(); using Visibility = mlir::SymbolTable::Visibility; /// Convenience version of `getNameAttr` that returns a StringRef. ::mlir::StringRef getName() { return getNameAttr().getValue(); } /// Convenience version of `setName` that take a StringRef. void setName(::mlir::StringRef name) { setName(::mlir::StringAttr::get((*this)->getContext(), name)); } static bool classof(::mlir::Operation * base) { auto* interface = getInterfaceFor(base); if (!interface) return false; SymbolOpInterface odsInterfaceInstance(base, interface); return odsInterfaceInstance->hasAttr(::mlir::SymbolTable::getSymbolAttrName()); } }; } // namespace mlir namespace mlir { /// This interface describes an operation that may use a `Symbol`. This /// interface allows for users of symbols to hook into verification and other /// symbol related utilities that are either costly or otherwise disallowed /// within an operation. namespace detail { struct SymbolUserOpInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. ::llvm::LogicalResult (*verifySymbolUses)(const Concept *impl, ::mlir::Operation *, ::mlir::SymbolTableCollection &); }; template class Model : public Concept { public: using Interface = ::mlir::SymbolUserOpInterface; Model() : Concept{verifySymbolUses} {} static inline ::llvm::LogicalResult verifySymbolUses(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::SymbolTableCollection & symbolTable); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::SymbolUserOpInterface; FallbackModel() : Concept{verifySymbolUses} {} static inline ::llvm::LogicalResult verifySymbolUses(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::SymbolTableCollection & symbolTable); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteOp; }; }; template struct SymbolUserOpInterfaceTrait; } // namespace detail class SymbolUserOpInterface : public ::mlir::OpInterface { public: using ::mlir::OpInterface::OpInterface; template struct Trait : public detail::SymbolUserOpInterfaceTrait {}; /// Verify the symbol uses held by this operation. ::llvm::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection & symbolTable); }; } // namespace mlir namespace mlir::detail { template struct SymbolOpInterfaceTrait : public ::mlir::OpInterface::Trait { /// Returns the name of this symbol. ::mlir::StringAttr getNameAttr() { return mlir::SymbolTable::getSymbolName(this->getOperation()); } /// Sets the name of this symbol. void setName(::mlir::StringAttr name) { this->getOperation()->setAttr( mlir::SymbolTable::getSymbolAttrName(), name); } /// Gets the visibility of this symbol. mlir::SymbolTable::Visibility getVisibility() { return mlir::SymbolTable::getSymbolVisibility(this->getOperation()); } /// Returns true if this symbol has nested visibility. bool isNested() { return (*static_cast(this)).getVisibility() == mlir::SymbolTable::Visibility::Nested; } /// Returns true if this symbol has private visibility. bool isPrivate() { return (*static_cast(this)).getVisibility() == mlir::SymbolTable::Visibility::Private; } /// Returns true if this symbol has public visibility. bool isPublic() { return (*static_cast(this)).getVisibility() == mlir::SymbolTable::Visibility::Public; } /// Sets the visibility of this symbol. void setVisibility(mlir::SymbolTable::Visibility vis) { mlir::SymbolTable::setSymbolVisibility(this->getOperation(), vis); } /// Sets the visibility of this symbol to be nested. void setNested() { (*static_cast(this)).setVisibility(mlir::SymbolTable::Visibility::Nested); } /// Sets the visibility of this symbol to be private. void setPrivate() { (*static_cast(this)).setVisibility(mlir::SymbolTable::Visibility::Private); } /// Sets the visibility of this symbol to be public. void setPublic() { (*static_cast(this)).setVisibility(mlir::SymbolTable::Visibility::Public); } /// Get all of the uses of the current symbol that are nested within the /// given operation 'from'. /// Note: See mlir::SymbolTable::getSymbolUses for more details. ::std::optional<::mlir::SymbolTable::UseRange> getSymbolUses(::mlir::Operation * from) { return ::mlir::SymbolTable::getSymbolUses(this->getOperation(), from); } /// Return if the current symbol is known to have no uses that are nested /// within the given operation 'from'. /// Note: See mlir::SymbolTable::symbolKnownUseEmpty for more details. bool symbolKnownUseEmpty(::mlir::Operation * from) { return ::mlir::SymbolTable::symbolKnownUseEmpty(this->getOperation(), from); } /// Attempt to replace all uses of the current symbol with the provided /// symbol 'newSymbol' that are nested within the given operation 'from'. /// Note: See mlir::SymbolTable::replaceAllSymbolUses for more details. ::llvm::LogicalResult replaceAllSymbolUses(::mlir::StringAttr newSymbol, ::mlir::Operation * from) { return ::mlir::SymbolTable::replaceAllSymbolUses(this->getOperation(), newSymbol, from); } /// Returns true if this operation optionally defines a symbol based on the /// presence of the symbol name. bool isOptionalSymbol() { return false; } /// Returns true if this operation can be discarded if it has no remaining /// symbol uses. bool canDiscardOnUseEmpty() { // By default, base this on the visibility alone. A symbol can be // discarded as long as it is not public. Only public symbols may be // visible from outside of the IR. return (*static_cast(this)).getVisibility() != ::mlir::SymbolTable::Visibility::Public; } /// Returns true if this operation is a declaration of a symbol (as opposed /// to a definition). bool isDeclaration() { // By default, assume that the operation defines a symbol. return false; } static ::llvm::LogicalResult verifyTrait(::mlir::Operation *op) { // If this is an optional symbol, bail out early if possible. auto concreteOp = cast(op); if (concreteOp.isOptionalSymbol()) { if(!concreteOp->getInherentAttr(::mlir::SymbolTable::getSymbolAttrName()).value_or(Attribute{})) return success(); } if (::mlir::failed(::mlir::detail::verifySymbol(op))) return ::mlir::failure(); if (concreteOp.isDeclaration() && concreteOp.isPublic()) return concreteOp.emitOpError("symbol declaration cannot have public " "visibility"); if (op->getNumResults() != 0) return concreteOp.emitOpError("symbols must not have results"); auto parent = op->getParentOp(); if (parent && !parent->hasTrait() && parent->isRegistered()) { return concreteOp.emitOpError("symbol's parent must have the SymbolTable " "trait"); } return success(); } using Visibility = mlir::SymbolTable::Visibility; /// Convenience version of `getNameAttr` that returns a StringRef. ::mlir::StringRef getName() { return getNameAttr().getValue(); } /// Convenience version of `setName` that take a StringRef. void setName(::mlir::StringRef name) { setName(::mlir::StringAttr::get((*static_cast(this))->getContext(), name)); } }; } // namespace mlir::detail namespace mlir::detail { template struct SymbolUserOpInterfaceTrait : public ::mlir::OpInterface::Trait { }; } // namespace mlir::detail namespace mlir { template ::mlir::StringAttr detail::SymbolOpInterfaceInterfaceTraits::Model::getNameAttr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { // Don't rely on the trait implementation as optional symbol operations // may override this. return mlir::SymbolTable::getSymbolName((llvm::cast(tablegen_opaque_val))); } template void detail::SymbolOpInterfaceInterfaceTraits::Model::setName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::StringAttr name) { return (llvm::cast(tablegen_opaque_val)).setName(name); } template mlir::SymbolTable::Visibility detail::SymbolOpInterfaceInterfaceTraits::Model::getVisibility(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getVisibility(); } template bool detail::SymbolOpInterfaceInterfaceTraits::Model::isNested(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).isNested(); } template bool detail::SymbolOpInterfaceInterfaceTraits::Model::isPrivate(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).isPrivate(); } template bool detail::SymbolOpInterfaceInterfaceTraits::Model::isPublic(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).isPublic(); } template void detail::SymbolOpInterfaceInterfaceTraits::Model::setVisibility(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, mlir::SymbolTable::Visibility vis) { return (llvm::cast(tablegen_opaque_val)).setVisibility(vis); } template void detail::SymbolOpInterfaceInterfaceTraits::Model::setNested(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).setNested(); } template void detail::SymbolOpInterfaceInterfaceTraits::Model::setPrivate(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).setPrivate(); } template void detail::SymbolOpInterfaceInterfaceTraits::Model::setPublic(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).setPublic(); } template ::std::optional<::mlir::SymbolTable::UseRange> detail::SymbolOpInterfaceInterfaceTraits::Model::getSymbolUses(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Operation * from) { return (llvm::cast(tablegen_opaque_val)).getSymbolUses(from); } template bool detail::SymbolOpInterfaceInterfaceTraits::Model::symbolKnownUseEmpty(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Operation * from) { return (llvm::cast(tablegen_opaque_val)).symbolKnownUseEmpty(from); } template ::llvm::LogicalResult detail::SymbolOpInterfaceInterfaceTraits::Model::replaceAllSymbolUses(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::StringAttr newSymbol, ::mlir::Operation * from) { return (llvm::cast(tablegen_opaque_val)).replaceAllSymbolUses(newSymbol, from); } template bool detail::SymbolOpInterfaceInterfaceTraits::Model::isOptionalSymbol(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).isOptionalSymbol(); } template bool detail::SymbolOpInterfaceInterfaceTraits::Model::canDiscardOnUseEmpty(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).canDiscardOnUseEmpty(); } template bool detail::SymbolOpInterfaceInterfaceTraits::Model::isDeclaration(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).isDeclaration(); } template ::mlir::StringAttr detail::SymbolOpInterfaceInterfaceTraits::FallbackModel::getNameAttr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getNameAttr(tablegen_opaque_val); } template void detail::SymbolOpInterfaceInterfaceTraits::FallbackModel::setName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::StringAttr name) { return static_cast(impl)->setName(tablegen_opaque_val, name); } template mlir::SymbolTable::Visibility detail::SymbolOpInterfaceInterfaceTraits::FallbackModel::getVisibility(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getVisibility(tablegen_opaque_val); } template bool detail::SymbolOpInterfaceInterfaceTraits::FallbackModel::isNested(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->isNested(tablegen_opaque_val); } template bool detail::SymbolOpInterfaceInterfaceTraits::FallbackModel::isPrivate(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->isPrivate(tablegen_opaque_val); } template bool detail::SymbolOpInterfaceInterfaceTraits::FallbackModel::isPublic(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->isPublic(tablegen_opaque_val); } template void detail::SymbolOpInterfaceInterfaceTraits::FallbackModel::setVisibility(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, mlir::SymbolTable::Visibility vis) { return static_cast(impl)->setVisibility(tablegen_opaque_val, vis); } template void detail::SymbolOpInterfaceInterfaceTraits::FallbackModel::setNested(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->setNested(tablegen_opaque_val); } template void detail::SymbolOpInterfaceInterfaceTraits::FallbackModel::setPrivate(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->setPrivate(tablegen_opaque_val); } template void detail::SymbolOpInterfaceInterfaceTraits::FallbackModel::setPublic(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->setPublic(tablegen_opaque_val); } template ::std::optional<::mlir::SymbolTable::UseRange> detail::SymbolOpInterfaceInterfaceTraits::FallbackModel::getSymbolUses(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Operation * from) { return static_cast(impl)->getSymbolUses(tablegen_opaque_val, from); } template bool detail::SymbolOpInterfaceInterfaceTraits::FallbackModel::symbolKnownUseEmpty(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::Operation * from) { return static_cast(impl)->symbolKnownUseEmpty(tablegen_opaque_val, from); } template ::llvm::LogicalResult detail::SymbolOpInterfaceInterfaceTraits::FallbackModel::replaceAllSymbolUses(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::StringAttr newSymbol, ::mlir::Operation * from) { return static_cast(impl)->replaceAllSymbolUses(tablegen_opaque_val, newSymbol, from); } template bool detail::SymbolOpInterfaceInterfaceTraits::FallbackModel::isOptionalSymbol(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->isOptionalSymbol(tablegen_opaque_val); } template bool detail::SymbolOpInterfaceInterfaceTraits::FallbackModel::canDiscardOnUseEmpty(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->canDiscardOnUseEmpty(tablegen_opaque_val); } template bool detail::SymbolOpInterfaceInterfaceTraits::FallbackModel::isDeclaration(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->isDeclaration(tablegen_opaque_val); } template ::mlir::StringAttr detail::SymbolOpInterfaceInterfaceTraits::ExternalModel::getNameAttr(::mlir::Operation *tablegen_opaque_val) const { return mlir::SymbolTable::getSymbolName(this->getOperation()); } template void detail::SymbolOpInterfaceInterfaceTraits::ExternalModel::setName(::mlir::Operation *tablegen_opaque_val, ::mlir::StringAttr name) const { this->getOperation()->setAttr( mlir::SymbolTable::getSymbolAttrName(), name); } template mlir::SymbolTable::Visibility detail::SymbolOpInterfaceInterfaceTraits::ExternalModel::getVisibility(::mlir::Operation *tablegen_opaque_val) const { return mlir::SymbolTable::getSymbolVisibility(this->getOperation()); } template bool detail::SymbolOpInterfaceInterfaceTraits::ExternalModel::isNested(::mlir::Operation *tablegen_opaque_val) const { return (llvm::cast(tablegen_opaque_val)).getVisibility() == mlir::SymbolTable::Visibility::Nested; } template bool detail::SymbolOpInterfaceInterfaceTraits::ExternalModel::isPrivate(::mlir::Operation *tablegen_opaque_val) const { return (llvm::cast(tablegen_opaque_val)).getVisibility() == mlir::SymbolTable::Visibility::Private; } template bool detail::SymbolOpInterfaceInterfaceTraits::ExternalModel::isPublic(::mlir::Operation *tablegen_opaque_val) const { return (llvm::cast(tablegen_opaque_val)).getVisibility() == mlir::SymbolTable::Visibility::Public; } template void detail::SymbolOpInterfaceInterfaceTraits::ExternalModel::setVisibility(::mlir::Operation *tablegen_opaque_val, mlir::SymbolTable::Visibility vis) const { mlir::SymbolTable::setSymbolVisibility(this->getOperation(), vis); } template void detail::SymbolOpInterfaceInterfaceTraits::ExternalModel::setNested(::mlir::Operation *tablegen_opaque_val) const { (llvm::cast(tablegen_opaque_val)).setVisibility(mlir::SymbolTable::Visibility::Nested); } template void detail::SymbolOpInterfaceInterfaceTraits::ExternalModel::setPrivate(::mlir::Operation *tablegen_opaque_val) const { (llvm::cast(tablegen_opaque_val)).setVisibility(mlir::SymbolTable::Visibility::Private); } template void detail::SymbolOpInterfaceInterfaceTraits::ExternalModel::setPublic(::mlir::Operation *tablegen_opaque_val) const { (llvm::cast(tablegen_opaque_val)).setVisibility(mlir::SymbolTable::Visibility::Public); } template ::std::optional<::mlir::SymbolTable::UseRange> detail::SymbolOpInterfaceInterfaceTraits::ExternalModel::getSymbolUses(::mlir::Operation *tablegen_opaque_val, ::mlir::Operation *from) const { return ::mlir::SymbolTable::getSymbolUses(this->getOperation(), from); } template bool detail::SymbolOpInterfaceInterfaceTraits::ExternalModel::symbolKnownUseEmpty(::mlir::Operation *tablegen_opaque_val, ::mlir::Operation *from) const { return ::mlir::SymbolTable::symbolKnownUseEmpty(this->getOperation(), from); } template ::llvm::LogicalResult detail::SymbolOpInterfaceInterfaceTraits::ExternalModel::replaceAllSymbolUses(::mlir::Operation *tablegen_opaque_val, ::mlir::StringAttr newSymbol, ::mlir::Operation *from) const { return ::mlir::SymbolTable::replaceAllSymbolUses(this->getOperation(), newSymbol, from); } template bool detail::SymbolOpInterfaceInterfaceTraits::ExternalModel::isOptionalSymbol(::mlir::Operation *tablegen_opaque_val) const { return false; } template bool detail::SymbolOpInterfaceInterfaceTraits::ExternalModel::canDiscardOnUseEmpty(::mlir::Operation *tablegen_opaque_val) const { // By default, base this on the visibility alone. A symbol can be // discarded as long as it is not public. Only public symbols may be // visible from outside of the IR. return (llvm::cast(tablegen_opaque_val)).getVisibility() != ::mlir::SymbolTable::Visibility::Public; } template bool detail::SymbolOpInterfaceInterfaceTraits::ExternalModel::isDeclaration(::mlir::Operation *tablegen_opaque_val) const { // By default, assume that the operation defines a symbol. return false; } } // namespace mlir namespace mlir { template ::llvm::LogicalResult detail::SymbolUserOpInterfaceInterfaceTraits::Model::verifySymbolUses(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::SymbolTableCollection & symbolTable) { return (llvm::cast(tablegen_opaque_val)).verifySymbolUses(symbolTable); } template ::llvm::LogicalResult detail::SymbolUserOpInterfaceInterfaceTraits::FallbackModel::verifySymbolUses(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::SymbolTableCollection & symbolTable) { return static_cast(impl)->verifySymbolUses(tablegen_opaque_val, symbolTable); } } // namespace mlir