/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* Interface Declarations *| |* *| |* Automatically generated file, do not edit! *| |* *| \*===----------------------------------------------------------------------===*/ namespace mlir { /// An interface used to query information about the memory effects applied by /// an operation. class MemoryEffectOpInterface; } // namespace mlir namespace mlir { /// An interface used to query information about the speculability of an /// operation. class ConditionallySpeculatable; } // namespace mlir namespace mlir { /// An interface used to query information about the memory effects applied by /// an operation. namespace detail { struct MemoryEffectOpInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. void (*getEffects)(const Concept *impl, ::mlir::Operation *, ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &); }; template class Model : public Concept { public: using Interface = ::mlir::MemoryEffectOpInterface; Model() : Concept{getEffects} {} static inline void getEffects(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> & effects); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::MemoryEffectOpInterface; FallbackModel() : Concept{getEffects} {} static inline void getEffects(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> & effects); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteOp; }; }; template struct MemoryEffectOpInterfaceTrait; } // namespace detail class MemoryEffectOpInterface : public ::mlir::OpInterface { public: using ::mlir::OpInterface::OpInterface; template struct Trait : public detail::MemoryEffectOpInterfaceTrait {}; /// Collects all of the operation's effects into `effects`. void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> & effects); /// Collect all of the effect instances that correspond to the given /// `Effect` and place them in 'effects'. template void getEffects( ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance< ::mlir::MemoryEffects::Effect>> &effects) { getEffects(effects); ::llvm::erase_if(effects, [&](auto &it) { return !::llvm::isa(it.getEffect()); }); } /// Returns true if this operation exhibits the given effect. template bool hasEffect() { ::llvm::SmallVector<::mlir::SideEffects::EffectInstance< ::mlir::MemoryEffects::Effect>, 4> effects; getEffects(effects); return ::llvm::any_of(effects, [](const auto &it) { return ::llvm::isa(it.getEffect()); }); } /// Returns true if this operation only has the given effect. template bool onlyHasEffect() { ::llvm::SmallVector<::mlir::SideEffects::EffectInstance< ::mlir::MemoryEffects::Effect>, 4> effects; getEffects(effects); return !effects.empty() && ::llvm::all_of(effects, [](const auto &it) { return ::llvm::isa(it.getEffect()); }); } /// Returns true if this operation has no effects. bool hasNoEffect() { ::llvm::SmallVector<::mlir::SideEffects::EffectInstance< ::mlir::MemoryEffects::Effect>, 4> effects; getEffects(effects); return effects.empty(); } /// Collect all of the effect instances that operate on the provided value /// and place them in 'effects'. void getEffectsOnValue(::mlir::Value value, ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance< ::mlir::MemoryEffects::Effect>> & effects) { getEffects(effects); ::llvm::erase_if(effects, [&](auto &it) { return it.getValue() != value; }); } /// Return the effect of the given type `Effect` that is applied to the /// given value, or std::nullopt if no effect exists. template ::std::optional<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> getEffectOnValue(::mlir::Value value) { ::llvm::SmallVector<::mlir::SideEffects::EffectInstance< ::mlir::MemoryEffects::Effect>, 4> effects; getEffects(effects); auto it = ::llvm::find_if(effects, [&](auto &it) { return ::llvm::isa(it.getEffect()) && it.getValue() == value; }); if (it == effects.end()) return std::nullopt; return *it; } /// Collect all of the effect instances that operate on the provided symbol /// reference and place them in 'effects'. void getEffectsOnSymbol(::mlir::SymbolRefAttr value, ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance< ::mlir::MemoryEffects::Effect>> & effects) { getEffects(effects); ::llvm::erase_if(effects, [&](auto &it) { return it.getSymbolRef() != value; }); } /// Collect all of the effect instances that operate on the provided /// resource and place them in 'effects'. void getEffectsOnResource(::mlir::SideEffects::Resource *resource, ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance< ::mlir::MemoryEffects::Effect>> & effects) { getEffects(effects); ::llvm::erase_if(effects, [&](auto &it) { return it.getResource()->getResourceID() != resource->getResourceID(); }); } }; } // namespace mlir namespace mlir { /// An interface used to query information about the speculability of an /// operation. namespace detail { struct ConditionallySpeculatableInterfaceTraits { struct Concept { /// The methods defined by the interface. ::mlir::Speculation::Speculatability (*getSpeculatability)(const Concept *impl, ::mlir::Operation *); }; template class Model : public Concept { public: using Interface = ::mlir::ConditionallySpeculatable; Model() : Concept{getSpeculatability} {} static inline ::mlir::Speculation::Speculatability getSpeculatability(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::ConditionallySpeculatable; FallbackModel() : Concept{getSpeculatability} {} static inline ::mlir::Speculation::Speculatability getSpeculatability(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteOp; }; }; template struct ConditionallySpeculatableTrait; } // namespace detail class ConditionallySpeculatable : public ::mlir::OpInterface { public: using ::mlir::OpInterface::OpInterface; template struct Trait : public detail::ConditionallySpeculatableTrait {}; /// Returns value indicating whether the specific operation in question can /// be speculatively executed. Please see the documentation on the /// Speculatability enum to know how to interpret the return value. ::mlir::Speculation::Speculatability getSpeculatability(); }; } // namespace mlir namespace mlir::detail { template struct MemoryEffectOpInterfaceTrait : public ::mlir::OpInterface::Trait { }; } // namespace mlir::detail namespace mlir::detail { template struct ConditionallySpeculatableTrait : public ::mlir::OpInterface::Trait { }; } // namespace mlir::detail namespace mlir { template void detail::MemoryEffectOpInterfaceInterfaceTraits::Model::getEffects(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> & effects) { return (llvm::cast(tablegen_opaque_val)).getEffects(effects); } template void detail::MemoryEffectOpInterfaceInterfaceTraits::FallbackModel::getEffects(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> & effects) { return static_cast(impl)->getEffects(tablegen_opaque_val, effects); } } // namespace mlir namespace mlir { template ::mlir::Speculation::Speculatability detail::ConditionallySpeculatableInterfaceTraits::Model::getSpeculatability(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getSpeculatability(); } template ::mlir::Speculation::Speculatability detail::ConditionallySpeculatableInterfaceTraits::FallbackModel::getSpeculatability(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getSpeculatability(tablegen_opaque_val); } } // namespace mlir