| 1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
| 2 | |* *| |
| 3 | |* Interface Declarations *| |
| 4 | |* *| |
| 5 | |* Automatically generated file, do not edit! *| |
| 6 | |* *| |
| 7 | \*===----------------------------------------------------------------------===*/ |
| 8 | |
| 9 | namespace mlir { |
| 10 | /// An interface used to query information about the memory effects applied by |
| 11 | /// an operation. |
| 12 | class MemoryEffectOpInterface; |
| 13 | namespace detail { |
| 14 | struct MemoryEffectOpInterfaceInterfaceTraits { |
| 15 | struct Concept { |
| 16 | /// The methods defined by the interface. |
| 17 | void (*getEffects)(const Concept *impl, ::mlir::Operation *, ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &); |
| 18 | }; |
| 19 | template<typename ConcreteOp> |
| 20 | class Model : public Concept { |
| 21 | public: |
| 22 | using Interface = ::mlir::MemoryEffectOpInterface; |
| 23 | Model() : Concept{.getEffects: getEffects} {} |
| 24 | |
| 25 | static inline void getEffects(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> & effects); |
| 26 | }; |
| 27 | template<typename ConcreteOp> |
| 28 | class FallbackModel : public Concept { |
| 29 | public: |
| 30 | using Interface = ::mlir::MemoryEffectOpInterface; |
| 31 | FallbackModel() : Concept{.getEffects: getEffects} {} |
| 32 | |
| 33 | static inline void getEffects(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> & effects); |
| 34 | }; |
| 35 | template<typename ConcreteModel, typename ConcreteOp> |
| 36 | class ExternalModel : public FallbackModel<ConcreteModel> { |
| 37 | public: |
| 38 | using ConcreteEntity = ConcreteOp; |
| 39 | }; |
| 40 | }; |
| 41 | template <typename ConcreteOp> |
| 42 | struct MemoryEffectOpInterfaceTrait; |
| 43 | |
| 44 | } // namespace detail |
| 45 | class MemoryEffectOpInterface : public ::mlir::OpInterface<MemoryEffectOpInterface, detail::MemoryEffectOpInterfaceInterfaceTraits> { |
| 46 | public: |
| 47 | using ::mlir::OpInterface<MemoryEffectOpInterface, detail::MemoryEffectOpInterfaceInterfaceTraits>::OpInterface; |
| 48 | template <typename ConcreteOp> |
| 49 | struct Trait : public detail::MemoryEffectOpInterfaceTrait<ConcreteOp> {}; |
| 50 | |
| 51 | /// Collects all of the operation's effects into `effects`. |
| 52 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> & effects); |
| 53 | |
| 54 | /// Collect all of the effect instances that correspond to the given |
| 55 | /// `Effect` and place them in 'effects'. |
| 56 | template <typename Effect> void getEffects( |
| 57 | ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance< |
| 58 | ::mlir::MemoryEffects::Effect>> &effects) { |
| 59 | getEffects(effects); |
| 60 | ::llvm::erase_if(effects, [&](auto &it) { |
| 61 | return !::llvm::isa<Effect>(it.getEffect()); |
| 62 | }); |
| 63 | } |
| 64 | |
| 65 | /// Returns true if this operation exhibits the given effect. |
| 66 | template <typename Effect> bool hasEffect() { |
| 67 | ::llvm::SmallVector<::mlir::SideEffects::EffectInstance< |
| 68 | ::mlir::MemoryEffects::Effect>, 4> effects; |
| 69 | getEffects(effects); |
| 70 | return ::llvm::any_of(effects, [](const auto &it) { |
| 71 | return ::llvm::isa<Effect>(it.getEffect()); |
| 72 | }); |
| 73 | } |
| 74 | |
| 75 | /// Returns true if this operation only has the given effect. |
| 76 | template <typename Effect> bool onlyHasEffect() { |
| 77 | ::llvm::SmallVector<::mlir::SideEffects::EffectInstance< |
| 78 | ::mlir::MemoryEffects::Effect>, 4> effects; |
| 79 | getEffects(effects); |
| 80 | return !effects.empty() && ::llvm::all_of(effects, [](const auto &it) { |
| 81 | return ::llvm::isa<Effect>(it.getEffect()); |
| 82 | }); |
| 83 | } |
| 84 | |
| 85 | /// Returns true if this operation has no effects. |
| 86 | bool hasNoEffect() { |
| 87 | ::llvm::SmallVector<::mlir::SideEffects::EffectInstance< |
| 88 | ::mlir::MemoryEffects::Effect>, 4> effects; |
| 89 | getEffects(effects); |
| 90 | return effects.empty(); |
| 91 | } |
| 92 | |
| 93 | /// Collect all of the effect instances that operate on the provided value |
| 94 | /// and place them in 'effects'. |
| 95 | void getEffectsOnValue(::mlir::Value value, |
| 96 | ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance< |
| 97 | ::mlir::MemoryEffects::Effect>> & effects) { |
| 98 | getEffects(effects); |
| 99 | ::llvm::erase_if(C&: effects, P: [&](auto &it) { return it.getValue() != value; }); |
| 100 | } |
| 101 | |
| 102 | /// Return the effect of the given type `Effect` that is applied to the |
| 103 | /// given value, or std::nullopt if no effect exists. |
| 104 | template <typename Effect> |
| 105 | ::std::optional<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> |
| 106 | getEffectOnValue(::mlir::Value value) { |
| 107 | ::llvm::SmallVector<::mlir::SideEffects::EffectInstance< |
| 108 | ::mlir::MemoryEffects::Effect>, 4> effects; |
| 109 | getEffects(effects); |
| 110 | auto it = ::llvm::find_if(effects, [&](auto &it) { |
| 111 | return ::llvm::isa<Effect>(it.getEffect()) && it.getValue() == value; |
| 112 | }); |
| 113 | if (it == effects.end()) |
| 114 | return std::nullopt; |
| 115 | return *it; |
| 116 | } |
| 117 | |
| 118 | /// Collect all of the effect instances that operate on the provided symbol |
| 119 | /// reference and place them in 'effects'. |
| 120 | void getEffectsOnSymbol(::mlir::SymbolRefAttr value, |
| 121 | ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance< |
| 122 | ::mlir::MemoryEffects::Effect>> & effects) { |
| 123 | getEffects(effects); |
| 124 | ::llvm::erase_if(C&: effects, P: [&](auto &it) { |
| 125 | return it.getSymbolRef() != value; |
| 126 | }); |
| 127 | } |
| 128 | |
| 129 | /// Collect all of the effect instances that operate on the provided |
| 130 | /// resource and place them in 'effects'. |
| 131 | void getEffectsOnResource(::mlir::SideEffects::Resource *resource, |
| 132 | ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance< |
| 133 | ::mlir::MemoryEffects::Effect>> & effects) { |
| 134 | getEffects(effects); |
| 135 | ::llvm::erase_if(C&: effects, P: [&](auto &it) { |
| 136 | return it.getResource()->getResourceID() != resource->getResourceID(); |
| 137 | }); |
| 138 | } |
| 139 | }; |
| 140 | namespace detail { |
| 141 | template <typename ConcreteOp> |
| 142 | struct MemoryEffectOpInterfaceTrait : public ::mlir::OpInterface<MemoryEffectOpInterface, detail::MemoryEffectOpInterfaceInterfaceTraits>::Trait<ConcreteOp> { |
| 143 | }; |
| 144 | }// namespace detail |
| 145 | } // namespace mlir |
| 146 | namespace mlir { |
| 147 | /// An interface used to query information about the speculability of an |
| 148 | /// operation. |
| 149 | class ConditionallySpeculatable; |
| 150 | namespace detail { |
| 151 | struct ConditionallySpeculatableInterfaceTraits { |
| 152 | struct Concept { |
| 153 | /// The methods defined by the interface. |
| 154 | ::mlir::Speculation::Speculatability (*getSpeculatability)(const Concept *impl, ::mlir::Operation *); |
| 155 | }; |
| 156 | template<typename ConcreteOp> |
| 157 | class Model : public Concept { |
| 158 | public: |
| 159 | using Interface = ::mlir::ConditionallySpeculatable; |
| 160 | Model() : Concept{.getSpeculatability: getSpeculatability} {} |
| 161 | |
| 162 | static inline ::mlir::Speculation::Speculatability getSpeculatability(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); |
| 163 | }; |
| 164 | template<typename ConcreteOp> |
| 165 | class FallbackModel : public Concept { |
| 166 | public: |
| 167 | using Interface = ::mlir::ConditionallySpeculatable; |
| 168 | FallbackModel() : Concept{.getSpeculatability: getSpeculatability} {} |
| 169 | |
| 170 | static inline ::mlir::Speculation::Speculatability getSpeculatability(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); |
| 171 | }; |
| 172 | template<typename ConcreteModel, typename ConcreteOp> |
| 173 | class ExternalModel : public FallbackModel<ConcreteModel> { |
| 174 | public: |
| 175 | using ConcreteEntity = ConcreteOp; |
| 176 | }; |
| 177 | }; |
| 178 | template <typename ConcreteOp> |
| 179 | struct ConditionallySpeculatableTrait; |
| 180 | |
| 181 | } // namespace detail |
| 182 | class ConditionallySpeculatable : public ::mlir::OpInterface<ConditionallySpeculatable, detail::ConditionallySpeculatableInterfaceTraits> { |
| 183 | public: |
| 184 | using ::mlir::OpInterface<ConditionallySpeculatable, detail::ConditionallySpeculatableInterfaceTraits>::OpInterface; |
| 185 | template <typename ConcreteOp> |
| 186 | struct Trait : public detail::ConditionallySpeculatableTrait<ConcreteOp> {}; |
| 187 | |
| 188 | /// Returns value indicating whether the specific operation in question can |
| 189 | /// be speculatively executed. Please see the documentation on the |
| 190 | /// Speculatability enum to know how to interpret the return value. |
| 191 | ::mlir::Speculation::Speculatability getSpeculatability(); |
| 192 | }; |
| 193 | namespace detail { |
| 194 | template <typename ConcreteOp> |
| 195 | struct ConditionallySpeculatableTrait : public ::mlir::OpInterface<ConditionallySpeculatable, detail::ConditionallySpeculatableInterfaceTraits>::Trait<ConcreteOp> { |
| 196 | }; |
| 197 | }// namespace detail |
| 198 | } // namespace mlir |
| 199 | namespace mlir { |
| 200 | template<typename ConcreteOp> |
| 201 | void detail::MemoryEffectOpInterfaceInterfaceTraits::Model<ConcreteOp>::getEffects(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> & effects) { |
| 202 | return (llvm::cast<ConcreteOp>(tablegen_opaque_val)).getEffects(effects); |
| 203 | } |
| 204 | template<typename ConcreteOp> |
| 205 | void detail::MemoryEffectOpInterfaceInterfaceTraits::FallbackModel<ConcreteOp>::getEffects(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> & effects) { |
| 206 | return static_cast<const ConcreteOp *>(impl)->getEffects(tablegen_opaque_val, effects); |
| 207 | } |
| 208 | } // namespace mlir |
| 209 | namespace mlir { |
| 210 | template<typename ConcreteOp> |
| 211 | ::mlir::Speculation::Speculatability detail::ConditionallySpeculatableInterfaceTraits::Model<ConcreteOp>::getSpeculatability(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { |
| 212 | return (llvm::cast<ConcreteOp>(tablegen_opaque_val)).getSpeculatability(); |
| 213 | } |
| 214 | template<typename ConcreteOp> |
| 215 | ::mlir::Speculation::Speculatability detail::ConditionallySpeculatableInterfaceTraits::FallbackModel<ConcreteOp>::getSpeculatability(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { |
| 216 | return static_cast<const ConcreteOp *>(impl)->getSpeculatability(tablegen_opaque_val); |
| 217 | } |
| 218 | } // namespace mlir |
| 219 | |