/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* Interface Declarations *| |* *| |* Automatically generated file, do not edit! *| |* *| \*===----------------------------------------------------------------------===*/ namespace mlir::wasmssa { /// Operation that defines one level of nesting for Wasm branching. /// /// These ops defines Wasm control flow nesting levels (Wasm Labels) that Wasm /// branching operations can target. /// The branching operations specify a number of nesting level they want to exit, /// and are redirected to the target of the corresponding nesting LabelLevelOp. /// /// As multiple level can be escaped at once, the level defining ops need themselves /// to be `Terminator` ops. class LabelLevelOpInterface; } // namespace mlir::wasmssa namespace mlir::wasmssa { /// Wasm operation that targets a label for a jump. class LabelBranchingOpInterface; } // namespace mlir::wasmssa namespace mlir::wasmssa { /// Operation that imports a symbol from an external Wasm module; class ImportOpInterface; } // namespace mlir::wasmssa namespace mlir::wasmssa { /// Operation that defines one level of nesting for Wasm branching. /// /// These ops defines Wasm control flow nesting levels (Wasm Labels) that Wasm /// branching operations can target. /// The branching operations specify a number of nesting level they want to exit, /// and are redirected to the target of the corresponding nesting LabelLevelOp. /// /// As multiple level can be escaped at once, the level defining ops need themselves /// to be `Terminator` ops. namespace detail { struct LabelLevelOpInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. ::mlir::Block*(*getLabelTarget)(const Concept *impl, ::mlir::Operation *); }; template class Model : public Concept { public: using Interface = ::mlir::wasmssa::LabelLevelOpInterface; Model() : Concept{getLabelTarget} {} static inline ::mlir::Block*getLabelTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::wasmssa::LabelLevelOpInterface; FallbackModel() : Concept{getLabelTarget} {} static inline ::mlir::Block*getLabelTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteOp; }; }; template struct LabelLevelOpInterfaceTrait; } // namespace detail class LabelLevelOpInterface : public ::mlir::OpInterface { public: using ::mlir::OpInterface::OpInterface; template struct Trait : public detail::LabelLevelOpInterfaceTrait {}; /// Returns the target block address ::mlir::Block*getLabelTarget(); }; } // namespace mlir::wasmssa namespace mlir::wasmssa { /// Wasm operation that targets a label for a jump. namespace detail { struct LabelBranchingOpInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. size_t (*getExitLevel)(const Concept *impl, ::mlir::Operation *); LabelLevelOpInterface (*getTargetOp)(const Concept *impl, ::mlir::Operation *); ::mlir::Block*(*getTarget)(const Concept *impl, ::mlir::Operation *); }; template class Model : public Concept { public: using Interface = ::mlir::wasmssa::LabelBranchingOpInterface; Model() : Concept{getExitLevel, getTargetOp, getTarget} {} static inline size_t getExitLevel(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline LabelLevelOpInterface getTargetOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::mlir::Block*getTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::wasmssa::LabelBranchingOpInterface; FallbackModel() : Concept{getExitLevel, getTargetOp, getTarget} {} static inline size_t getExitLevel(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline LabelLevelOpInterface getTargetOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::mlir::Block*getTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteOp; ::mlir::Block*getTarget(::mlir::Operation *tablegen_opaque_val) const; }; }; template struct LabelBranchingOpInterfaceTrait; } // namespace detail class LabelBranchingOpInterface : public ::mlir::OpInterface { public: using ::mlir::OpInterface::OpInterface; template struct Trait : public detail::LabelBranchingOpInterfaceTrait {}; /// Returns the number of context to break from size_t getExitLevel(); /// Returns the destination of this operation LabelLevelOpInterface getTargetOp(); /// Return the target control flow ops that defined the label of this operation ::mlir::Block*getTarget(); static ::llvm::FailureOr getTargetOpFromBlock(::mlir::Block *block, uint32_t level); }; } // namespace mlir::wasmssa namespace mlir::wasmssa { /// Operation that imports a symbol from an external Wasm module; namespace detail { struct ImportOpInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. ::llvm::StringRef (*getModuleName)(const Concept *impl, ::mlir::Operation *); ::llvm::StringRef (*getImportName)(const Concept *impl, ::mlir::Operation *); ::mlir::StringAttr (*getSymbolName)(const Concept *impl, ::mlir::Operation *); std::string (*getQualifiedImportName)(const Concept *impl, ::mlir::Operation *); }; template class Model : public Concept { public: using Interface = ::mlir::wasmssa::ImportOpInterface; Model() : Concept{getModuleName, getImportName, getSymbolName, getQualifiedImportName} {} static inline ::llvm::StringRef getModuleName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::llvm::StringRef getImportName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::mlir::StringAttr getSymbolName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline std::string getQualifiedImportName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::wasmssa::ImportOpInterface; FallbackModel() : Concept{getModuleName, getImportName, getSymbolName, getQualifiedImportName} {} static inline ::llvm::StringRef getModuleName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::llvm::StringRef getImportName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::mlir::StringAttr getSymbolName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline std::string getQualifiedImportName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteOp; ::mlir::StringAttr getSymbolName(::mlir::Operation *tablegen_opaque_val) const; }; }; template struct ImportOpInterfaceTrait; } // namespace detail class ImportOpInterface : public ::mlir::OpInterface { public: using ::mlir::OpInterface::OpInterface; template struct Trait : public detail::ImportOpInterfaceTrait {}; /// Returns the module name for the import ::llvm::StringRef getModuleName(); /// Returns the import name for the import ::llvm::StringRef getImportName(); /// Returns the Wasm index based symbol of the op ::mlir::StringAttr getSymbolName(); /// Returns the qualified name of the import std::string getQualifiedImportName(); }; } // namespace mlir::wasmssa namespace mlir::wasmssa::detail { template struct LabelLevelOpInterfaceTrait : public ::mlir::OpInterface::Trait { static ::llvm::LogicalResult verifyTrait(::mlir::Operation *op) { return success( succeeded(verifyLabelLevelInterfaceIsTerminator()) && succeeded(verifyLabelLevelInterface(op))); } }; } // namespace mlir::wasmssa::detail namespace mlir::wasmssa::detail { template struct LabelBranchingOpInterfaceTrait : public ::mlir::OpInterface::Trait { /// Return the target control flow ops that defined the label of this operation ::mlir::Block*getTarget() { auto op = mlir::cast(this->getOperation()); return op.getTargetOp().getLabelTarget(); } static ::llvm::LogicalResult verifyTrait(::mlir::Operation *op) { return verifyLabelBranchingOpInterface(op); } }; } // namespace mlir::wasmssa::detail namespace mlir::wasmssa::detail { template struct ImportOpInterfaceTrait : public ::mlir::OpInterface::Trait { /// Returns the Wasm index based symbol of the op ::mlir::StringAttr getSymbolName() { auto op = mlir::cast(this->getOperation()); return op.getSymNameAttr(); } }; } // namespace mlir::wasmssa::detail namespace mlir::wasmssa { template ::mlir::Block*detail::LabelLevelOpInterfaceInterfaceTraits::Model::getLabelTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getLabelTarget(); } template ::mlir::Block*detail::LabelLevelOpInterfaceInterfaceTraits::FallbackModel::getLabelTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getLabelTarget(tablegen_opaque_val); } } // namespace mlir::wasmssa namespace mlir::wasmssa { template size_t detail::LabelBranchingOpInterfaceInterfaceTraits::Model::getExitLevel(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getExitLevel(); } template LabelLevelOpInterface detail::LabelBranchingOpInterfaceInterfaceTraits::Model::getTargetOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return *LabelBranchingOpInterface::getTargetOpFromBlock((llvm::cast(tablegen_opaque_val)).getOperation()->getBlock(), (llvm::cast(tablegen_opaque_val)).getExitLevel()); } template ::mlir::Block*detail::LabelBranchingOpInterfaceInterfaceTraits::Model::getTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getTarget(); } template size_t detail::LabelBranchingOpInterfaceInterfaceTraits::FallbackModel::getExitLevel(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getExitLevel(tablegen_opaque_val); } template LabelLevelOpInterface detail::LabelBranchingOpInterfaceInterfaceTraits::FallbackModel::getTargetOp(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getTargetOp(tablegen_opaque_val); } template ::mlir::Block*detail::LabelBranchingOpInterfaceInterfaceTraits::FallbackModel::getTarget(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getTarget(tablegen_opaque_val); } template ::mlir::Block*detail::LabelBranchingOpInterfaceInterfaceTraits::ExternalModel::getTarget(::mlir::Operation *tablegen_opaque_val) const { auto op = mlir::cast(this->getOperation()); return op.getTargetOp().getLabelTarget(); } } // namespace mlir::wasmssa namespace mlir::wasmssa { template ::llvm::StringRef detail::ImportOpInterfaceInterfaceTraits::Model::getModuleName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getModuleName(); } template ::llvm::StringRef detail::ImportOpInterfaceInterfaceTraits::Model::getImportName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getImportName(); } template ::mlir::StringAttr detail::ImportOpInterfaceInterfaceTraits::Model::getSymbolName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getSymbolName(); } template std::string detail::ImportOpInterfaceInterfaceTraits::Model::getQualifiedImportName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return ((llvm::cast(tablegen_opaque_val)).getModuleName() + ::llvm::Twine{"::"} + (llvm::cast(tablegen_opaque_val)).getImportName()).str(); } template ::llvm::StringRef detail::ImportOpInterfaceInterfaceTraits::FallbackModel::getModuleName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getModuleName(tablegen_opaque_val); } template ::llvm::StringRef detail::ImportOpInterfaceInterfaceTraits::FallbackModel::getImportName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getImportName(tablegen_opaque_val); } template ::mlir::StringAttr detail::ImportOpInterfaceInterfaceTraits::FallbackModel::getSymbolName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getSymbolName(tablegen_opaque_val); } template std::string detail::ImportOpInterfaceInterfaceTraits::FallbackModel::getQualifiedImportName(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getQualifiedImportName(tablegen_opaque_val); } template ::mlir::StringAttr detail::ImportOpInterfaceInterfaceTraits::ExternalModel::getSymbolName(::mlir::Operation *tablegen_opaque_val) const { auto op = mlir::cast(this->getOperation()); return op.getSymNameAttr(); } } // namespace mlir::wasmssa