| 1 | /*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |
| 2 | |* *| |
| 3 | |* Op Declarations *| |
| 4 | |* *| |
| 5 | |* Automatically generated file, do not edit! *| |
| 6 | |* From: BuiltinOps.td *| |
| 7 | |* *| |
| 8 | \*===----------------------------------------------------------------------===*/ |
| 9 | |
| 10 | namespace mlir { |
| 11 | |
| 12 | /// A top level container operation |
| 13 | /// A `module` represents a top-level container operation. It contains a single |
| 14 | /// [graph region](../LangRef.md#control-flow-and-ssacfg-regions) containing a single block |
| 15 | /// which can contain any operations and does not have a terminator. Operations |
| 16 | /// within this region cannot implicitly capture values defined outside the module, |
| 17 | /// i.e. Modules are [IsolatedFromAbove](../Traits#isolatedfromabove). Modules have |
| 18 | /// an optional [symbol name](../SymbolsAndSymbolTables.md) which can be used to refer |
| 19 | /// to them in operations. |
| 20 | /// |
| 21 | /// Example: |
| 22 | /// |
| 23 | /// ```mlir |
| 24 | /// module { |
| 25 | /// func.func @foo() |
| 26 | /// } |
| 27 | /// ``` |
| 28 | /// |
| 29 | /// A module may have an inherent `dlti` attribute implementing |
| 30 | /// `DLTIQueryInterface`, for example |
| 31 | /// `module <{dlti = #dlti.map<"chip" = "sm_90">}> {}`. |
| 32 | /// When the DLTI dialect is loaded, the module implements |
| 33 | /// `DLTIQueryOpInterface` and provides values for scoped DLTI queries. |
| 34 | class ModuleOp; |
| 35 | |
| 36 | } // namespace mlir |
| 37 | namespace mlir { |
| 38 | |
| 39 | /// An unrealized conversion from one set of types to another |
| 40 | /// An `unrealized_conversion_cast` operation represents an unrealized |
| 41 | /// conversion from one set of types to another, that is used to enable the |
| 42 | /// inter-mixing of different type systems. This operation should not be |
| 43 | /// attributed any special representational or execution semantics, and is |
| 44 | /// generally only intended to be used to satisfy the temporary intermixing of |
| 45 | /// type systems during the conversion of one type system to another. |
| 46 | /// |
| 47 | /// This operation may produce results of arity 1-N, and accept as input |
| 48 | /// operands of arity 0-N. |
| 49 | /// |
| 50 | /// Example: |
| 51 | /// |
| 52 | /// ```mlir |
| 53 | /// // An unrealized 0-1 conversion. These types of conversions are useful in |
| 54 | /// // cases where a type is removed from the type system, but not all uses have |
| 55 | /// // been converted. For example, imagine we have a tuple type that is |
| 56 | /// // expanded to its element types. If only some uses of an empty tuple type |
| 57 | /// // instance are converted we still need an instance of the tuple type, but |
| 58 | /// // have no inputs to the unrealized conversion. |
| 59 | /// %result = unrealized_conversion_cast to !bar.tuple_type<> |
| 60 | /// |
| 61 | /// // An unrealized 1-1 conversion. |
| 62 | /// %result1 = unrealized_conversion_cast %operand : !foo.type to !bar.lowered_type |
| 63 | /// |
| 64 | /// // An unrealized 1-N conversion. |
| 65 | /// %results2:2 = unrealized_conversion_cast %tuple_operand : !foo.tuple_type<!foo.type, !foo.type> to !foo.type, !foo.type |
| 66 | /// |
| 67 | /// // An unrealized N-1 conversion. |
| 68 | /// %result3 = unrealized_conversion_cast %operand, %operand : !foo.type, !foo.type to !bar.tuple_type<!foo.type, !foo.type> |
| 69 | /// ``` |
| 70 | class UnrealizedConversionCastOp; |
| 71 | |
| 72 | } // namespace mlir |
| 73 | #ifdef GET_OP_CLASSES |
| 74 | #undef GET_OP_CLASSES |
| 75 | |
| 76 | #include "mlir/Bytecode/BytecodeOpInterface.h" |
| 77 | #include "mlir/IR/Attributes.h" |
| 78 | #include "mlir/IR/BuiltinAttributes.h" |
| 79 | #include "mlir/IR/OpDefinition.h" |
| 80 | #include "mlir/IR/OpImplementation.h" |
| 81 | #include "mlir/IR/RegionKindInterface.h" |
| 82 | #include "mlir/IR/SymbolTable.h" |
| 83 | #include "mlir/IR/Types.h" |
| 84 | #include "mlir/Interfaces/SideEffectInterfaces.h" |
| 85 | |
| 86 | namespace mlir { |
| 87 | |
| 88 | |
| 89 | //===----------------------------------------------------------------------===// |
| 90 | // ::mlir::ModuleOp declarations |
| 91 | //===----------------------------------------------------------------------===// |
| 92 | |
| 93 | namespace detail { |
| 94 | |
| 95 | class ModuleOpGenericAdaptorBase { |
| 96 | public: |
| 97 | struct Properties { |
| 98 | using dltiTy = ::mlir::Attribute; |
| 99 | dltiTy dlti; |
| 100 | |
| 101 | auto getDlti() const { |
| 102 | auto &propStorage = this->dlti; |
| 103 | return ::llvm::dyn_cast_or_null<::mlir::Attribute>(Val: propStorage); |
| 104 | } |
| 105 | void setDlti(const ::mlir::Attribute &propValue) { |
| 106 | this->dlti = propValue; |
| 107 | } |
| 108 | using sym_nameTy = ::mlir::StringAttr; |
| 109 | sym_nameTy sym_name; |
| 110 | |
| 111 | auto getSymName() const { |
| 112 | auto &propStorage = this->sym_name; |
| 113 | return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(Val: propStorage); |
| 114 | } |
| 115 | void setSymName(const ::mlir::StringAttr &propValue) { |
| 116 | this->sym_name = propValue; |
| 117 | } |
| 118 | using sym_visibilityTy = ::mlir::StringAttr; |
| 119 | sym_visibilityTy sym_visibility; |
| 120 | |
| 121 | auto getSymVisibility() const { |
| 122 | auto &propStorage = this->sym_visibility; |
| 123 | return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(Val: propStorage); |
| 124 | } |
| 125 | void setSymVisibility(const ::mlir::StringAttr &propValue) { |
| 126 | this->sym_visibility = propValue; |
| 127 | } |
| 128 | bool operator==(const Properties &rhs) const { |
| 129 | return |
| 130 | rhs.dlti == this->dlti && |
| 131 | rhs.sym_name == this->sym_name && |
| 132 | rhs.sym_visibility == this->sym_visibility && |
| 133 | true; |
| 134 | } |
| 135 | bool operator!=(const Properties &rhs) const { |
| 136 | return !(*this == rhs); |
| 137 | } |
| 138 | }; |
| 139 | protected: |
| 140 | ::mlir::DictionaryAttr odsAttrs; |
| 141 | ::std::optional<::mlir::OperationName> odsOpName; |
| 142 | Properties properties; |
| 143 | ::mlir::RegionRange odsRegions; |
| 144 | public: |
| 145 | ModuleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 146 | odsOpName.emplace(args: "builtin.module" , args: odsAttrs.getContext()); |
| 147 | } |
| 148 | |
| 149 | ModuleOpGenericAdaptorBase(ModuleOp op); |
| 150 | |
| 151 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { |
| 152 | return {index, 1}; |
| 153 | } |
| 154 | |
| 155 | const Properties &getProperties() { |
| 156 | return properties; |
| 157 | } |
| 158 | |
| 159 | ::mlir::DictionaryAttr getAttributes() { |
| 160 | return odsAttrs; |
| 161 | } |
| 162 | |
| 163 | ::mlir::StringAttr getSymNameAttr() { |
| 164 | auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(Val: getProperties().sym_name); |
| 165 | return attr; |
| 166 | } |
| 167 | |
| 168 | ::std::optional< ::llvm::StringRef > getSymName(); |
| 169 | ::mlir::StringAttr getSymVisibilityAttr() { |
| 170 | auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(Val: getProperties().sym_visibility); |
| 171 | return attr; |
| 172 | } |
| 173 | |
| 174 | ::std::optional< ::llvm::StringRef > getSymVisibility(); |
| 175 | ::mlir::Attribute getDltiAttr() { |
| 176 | auto attr = ::llvm::dyn_cast_or_null<::mlir::Attribute>(Val: getProperties().dlti); |
| 177 | return attr; |
| 178 | } |
| 179 | |
| 180 | ::std::optional<::mlir::Attribute> getDlti(); |
| 181 | ::mlir::Region &getBodyRegion() { |
| 182 | return *odsRegions[0]; |
| 183 | } |
| 184 | |
| 185 | ::mlir::RegionRange getRegions() { |
| 186 | return odsRegions; |
| 187 | } |
| 188 | |
| 189 | }; |
| 190 | |
| 191 | } // namespace detail |
| 192 | template <typename RangeT> |
| 193 | class ModuleOpGenericAdaptor : public detail::ModuleOpGenericAdaptorBase { |
| 194 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 195 | using Base = detail::ModuleOpGenericAdaptorBase; |
| 196 | public: |
| 197 | ModuleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 198 | |
| 199 | ModuleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ModuleOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 200 | |
| 201 | ModuleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ModuleOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 202 | |
| 203 | ModuleOpGenericAdaptor(RangeT values, const ModuleOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 204 | |
| 205 | template <typename LateInst = ModuleOp, typename = std::enable_if_t<std::is_same_v<LateInst, ModuleOp>>> |
| 206 | ModuleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 207 | |
| 208 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 209 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 210 | } |
| 211 | |
| 212 | RangeT getODSOperands(unsigned index) { |
| 213 | auto valueRange = getODSOperandIndexAndLength(index); |
| 214 | return {std::next(odsOperands.begin(), valueRange.first), |
| 215 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 216 | } |
| 217 | |
| 218 | RangeT getOperands() { |
| 219 | return odsOperands; |
| 220 | } |
| 221 | |
| 222 | private: |
| 223 | RangeT odsOperands; |
| 224 | }; |
| 225 | class ModuleOpAdaptor : public ModuleOpGenericAdaptor<::mlir::ValueRange> { |
| 226 | public: |
| 227 | using ModuleOpGenericAdaptor::ModuleOpGenericAdaptor; |
| 228 | ModuleOpAdaptor(ModuleOp op); |
| 229 | |
| 230 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 231 | }; |
| 232 | class ModuleOp : public ::mlir::Op<ModuleOp, ::mlir::OpTrait::OneRegion, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::NoRegionArguments, ::mlir::OpTrait::NoTerminator, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::AffineScope, ::mlir::OpTrait::IsIsolatedFromAbove, ::mlir::OpTrait::SymbolTable, ::mlir::OpTrait::SymbolName, ::mlir::OpTrait::SymbolVisibility, ::mlir::SymbolOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::RegionKindInterface::Trait, ::mlir::OpTrait::HasOnlyGraphRegion> { |
| 233 | public: |
| 234 | using Op::Op; |
| 235 | using Op::print; |
| 236 | using Adaptor = ModuleOpAdaptor; |
| 237 | template <typename RangeT> |
| 238 | using GenericAdaptor = ModuleOpGenericAdaptor<RangeT>; |
| 239 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 240 | using Properties = FoldAdaptor::Properties; |
| 241 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 242 | static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dlti" ), ::llvm::StringRef("sym_name" ), ::llvm::StringRef("sym_visibility" )}; |
| 243 | return ::llvm::ArrayRef(attrNames); |
| 244 | } |
| 245 | |
| 246 | ::mlir::StringAttr getDltiAttrName() { |
| 247 | return getAttributeNameForIndex(index: 0); |
| 248 | } |
| 249 | |
| 250 | static ::mlir::StringAttr getDltiAttrName(::mlir::OperationName name) { |
| 251 | return getAttributeNameForIndex(name, index: 0); |
| 252 | } |
| 253 | |
| 254 | ::mlir::StringAttr getSymNameAttrName() { |
| 255 | return getAttributeNameForIndex(index: 1); |
| 256 | } |
| 257 | |
| 258 | static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { |
| 259 | return getAttributeNameForIndex(name, index: 1); |
| 260 | } |
| 261 | |
| 262 | ::mlir::StringAttr getSymVisibilityAttrName() { |
| 263 | return getAttributeNameForIndex(index: 2); |
| 264 | } |
| 265 | |
| 266 | static ::mlir::StringAttr getSymVisibilityAttrName(::mlir::OperationName name) { |
| 267 | return getAttributeNameForIndex(name, index: 2); |
| 268 | } |
| 269 | |
| 270 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 271 | return ::llvm::StringLiteral("builtin.module" ); |
| 272 | } |
| 273 | |
| 274 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 275 | return {index, 1}; |
| 276 | } |
| 277 | |
| 278 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 279 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 280 | return getOperation()->getOperands().slice(n: start, m: length); |
| 281 | } |
| 282 | |
| 283 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index) { |
| 284 | return {index, 1}; |
| 285 | } |
| 286 | |
| 287 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 288 | auto valueRange = getODSResultIndexAndLength(index); |
| 289 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 290 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 291 | } |
| 292 | |
| 293 | ::mlir::Region &getBodyRegion() { |
| 294 | return (*this)->getRegion(index: 0); |
| 295 | } |
| 296 | |
| 297 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 298 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 299 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 300 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 301 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 302 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 303 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 304 | static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); |
| 305 | void writeProperties(::mlir::DialectBytecodeWriter &writer); |
| 306 | ::mlir::StringAttr getSymNameAttr() { |
| 307 | return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(Val&: getProperties().sym_name); |
| 308 | } |
| 309 | |
| 310 | ::std::optional< ::llvm::StringRef > getSymName(); |
| 311 | ::mlir::StringAttr getSymVisibilityAttr() { |
| 312 | return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(Val&: getProperties().sym_visibility); |
| 313 | } |
| 314 | |
| 315 | ::std::optional< ::llvm::StringRef > getSymVisibility(); |
| 316 | ::mlir::Attribute getDltiAttr() { |
| 317 | return ::llvm::dyn_cast_or_null<::mlir::Attribute>(Val&: getProperties().dlti); |
| 318 | } |
| 319 | |
| 320 | ::std::optional<::mlir::Attribute> getDlti(); |
| 321 | void setSymNameAttr(::mlir::StringAttr attr) { |
| 322 | getProperties().sym_name = attr; |
| 323 | } |
| 324 | |
| 325 | void setSymName(::std::optional<::llvm::StringRef> attrValue); |
| 326 | void setSymVisibilityAttr(::mlir::StringAttr attr) { |
| 327 | getProperties().sym_visibility = attr; |
| 328 | } |
| 329 | |
| 330 | void setSymVisibility(::std::optional<::llvm::StringRef> attrValue); |
| 331 | void setDltiAttr(::mlir::Attribute attr) { |
| 332 | getProperties().dlti = attr; |
| 333 | } |
| 334 | |
| 335 | ::mlir::Attribute removeSymNameAttr() { |
| 336 | auto attr = getProperties().sym_name; |
| 337 | getProperties().sym_name = {}; |
| 338 | return attr; |
| 339 | } |
| 340 | |
| 341 | ::mlir::Attribute removeSymVisibilityAttr() { |
| 342 | auto attr = getProperties().sym_visibility; |
| 343 | getProperties().sym_visibility = {}; |
| 344 | return attr; |
| 345 | } |
| 346 | |
| 347 | ::mlir::Attribute removeDltiAttr() { |
| 348 | auto attr = getProperties().dlti; |
| 349 | getProperties().dlti = {}; |
| 350 | return attr; |
| 351 | } |
| 352 | |
| 353 | static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, std::optional<StringRef> name = {}); |
| 354 | static ModuleOp create(::mlir::OpBuilder &builder, ::mlir::Location location, std::optional<StringRef> name = {}); |
| 355 | static ModuleOp create(::mlir::ImplicitLocOpBuilder &builder, std::optional<StringRef> name = {}); |
| 356 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 357 | ::llvm::LogicalResult verifyInvariants(); |
| 358 | ::llvm::LogicalResult verify(); |
| 359 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 360 | static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 361 | static ::mlir::ParseResult parsePropertiesFromKeyValueList(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 362 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 363 | static void _odsPrintPropertiesAsKeyValueList(::mlir::MLIRContext *_odsContext, ::mlir::OpAsmPrinter &_odsPrinter, const Properties &prop, ::mlir::ArrayRef<::llvm::StringRef> elidedProps); |
| 364 | private: |
| 365 | ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { |
| 366 | return getAttributeNameForIndex(name: (*this)->getName(), index); |
| 367 | } |
| 368 | |
| 369 | static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { |
| 370 | assert(index < 3 && "invalid attribute index" ); |
| 371 | assert(name.getStringRef() == getOperationName() && "invalid operation name" ); |
| 372 | assert(name.isRegistered() && "Operation isn't registered, missing a " |
| 373 | "dependent dialect loading?" ); |
| 374 | return name.getAttributeNames()[index]; |
| 375 | } |
| 376 | |
| 377 | public: |
| 378 | /// Construct a module from the given location with an optional name. |
| 379 | static ModuleOp create(Location loc, std::optional<StringRef> name = std::nullopt); |
| 380 | |
| 381 | /// Return the name of this module if present. |
| 382 | std::optional<StringRef> getName() { return getSymName(); } |
| 383 | |
| 384 | //===------------------------------------------------------------------===// |
| 385 | // SymbolOpInterface Methods |
| 386 | //===------------------------------------------------------------------===// |
| 387 | |
| 388 | /// A ModuleOp may optionally define a symbol. |
| 389 | bool isOptionalSymbol() { return true; } |
| 390 | |
| 391 | //===------------------------------------------------------------------===// |
| 392 | // DataLayoutOpInterface Methods |
| 393 | //===------------------------------------------------------------------===// |
| 394 | |
| 395 | DataLayoutSpecInterface getDataLayoutSpec(); |
| 396 | TargetSystemSpecInterface getTargetSystemSpec(); |
| 397 | |
| 398 | //===------------------------------------------------------------------===// |
| 399 | // OpAsmOpInterface Methods |
| 400 | //===------------------------------------------------------------------===// |
| 401 | |
| 402 | static ::llvm::StringRef getDefaultDialect() { |
| 403 | return "builtin" ; |
| 404 | } |
| 405 | }; |
| 406 | |
| 407 | } // namespace mlir |
| 408 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::ModuleOp) |
| 409 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::detail::ModuleOpGenericAdaptorBase::Properties) |
| 410 | |
| 411 | namespace mlir { |
| 412 | |
| 413 | |
| 414 | //===----------------------------------------------------------------------===// |
| 415 | // ::mlir::UnrealizedConversionCastOp declarations |
| 416 | //===----------------------------------------------------------------------===// |
| 417 | |
| 418 | namespace detail { |
| 419 | |
| 420 | class UnrealizedConversionCastOpGenericAdaptorBase { |
| 421 | public: |
| 422 | using Properties = ::mlir::EmptyProperties; |
| 423 | protected: |
| 424 | ::mlir::DictionaryAttr odsAttrs; |
| 425 | ::std::optional<::mlir::OperationName> odsOpName; |
| 426 | Properties properties; |
| 427 | ::mlir::RegionRange odsRegions; |
| 428 | public: |
| 429 | UnrealizedConversionCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) |
| 430 | odsOpName.emplace(args: "builtin.unrealized_conversion_cast" , args: odsAttrs.getContext()); |
| 431 | } |
| 432 | |
| 433 | UnrealizedConversionCastOpGenericAdaptorBase(UnrealizedConversionCastOp op); |
| 434 | |
| 435 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); |
| 436 | const Properties &getProperties() { |
| 437 | return properties; |
| 438 | } |
| 439 | |
| 440 | ::mlir::DictionaryAttr getAttributes() { |
| 441 | return odsAttrs; |
| 442 | } |
| 443 | |
| 444 | }; |
| 445 | |
| 446 | } // namespace detail |
| 447 | template <typename RangeT> |
| 448 | class UnrealizedConversionCastOpGenericAdaptor : public detail::UnrealizedConversionCastOpGenericAdaptorBase { |
| 449 | using ValueT = ::llvm::detail::ValueOfRange<RangeT>; |
| 450 | using Base = detail::UnrealizedConversionCastOpGenericAdaptorBase; |
| 451 | static constexpr int odsIndex_inputs = 0; |
| 452 | public: |
| 453 | UnrealizedConversionCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} |
| 454 | |
| 455 | UnrealizedConversionCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : UnrealizedConversionCastOpGenericAdaptor(values, attrs, (properties ? *properties.as<Properties *>() : Properties{}), regions) {} |
| 456 | |
| 457 | UnrealizedConversionCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : UnrealizedConversionCastOpGenericAdaptor(values, attrs, Properties{}, {}) {} |
| 458 | |
| 459 | UnrealizedConversionCastOpGenericAdaptor(RangeT values, const UnrealizedConversionCastOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} |
| 460 | |
| 461 | template <typename LateInst = UnrealizedConversionCastOp, typename = std::enable_if_t<std::is_same_v<LateInst, UnrealizedConversionCastOp>>> |
| 462 | UnrealizedConversionCastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} |
| 463 | |
| 464 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index) { |
| 465 | return Base::getODSOperandIndexAndLength(index, odsOperandsSize: odsOperands.size()); |
| 466 | } |
| 467 | |
| 468 | RangeT getODSOperands(unsigned index) { |
| 469 | auto valueRange = getODSOperandIndexAndLength(index); |
| 470 | return {std::next(odsOperands.begin(), valueRange.first), |
| 471 | std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; |
| 472 | } |
| 473 | |
| 474 | RangeT getInputs() { |
| 475 | return getODSOperands(index: 0); |
| 476 | } |
| 477 | |
| 478 | RangeT getOperands() { |
| 479 | return odsOperands; |
| 480 | } |
| 481 | |
| 482 | private: |
| 483 | RangeT odsOperands; |
| 484 | }; |
| 485 | class UnrealizedConversionCastOpAdaptor : public UnrealizedConversionCastOpGenericAdaptor<::mlir::ValueRange> { |
| 486 | public: |
| 487 | using UnrealizedConversionCastOpGenericAdaptor::UnrealizedConversionCastOpGenericAdaptor; |
| 488 | UnrealizedConversionCastOpAdaptor(UnrealizedConversionCastOp op); |
| 489 | |
| 490 | ::llvm::LogicalResult verify(::mlir::Location loc); |
| 491 | }; |
| 492 | class UnrealizedConversionCastOp : public ::mlir::Op<UnrealizedConversionCastOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { |
| 493 | public: |
| 494 | using Op::Op; |
| 495 | using Op::print; |
| 496 | using Adaptor = UnrealizedConversionCastOpAdaptor; |
| 497 | template <typename RangeT> |
| 498 | using GenericAdaptor = UnrealizedConversionCastOpGenericAdaptor<RangeT>; |
| 499 | using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; |
| 500 | static constexpr int odsIndex_inputs = 0; |
| 501 | static constexpr int odsIndex_outputs = 0; |
| 502 | using Properties = FoldAdaptor::Properties; |
| 503 | static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { |
| 504 | return {}; |
| 505 | } |
| 506 | |
| 507 | static constexpr ::llvm::StringLiteral getOperationName() { |
| 508 | return ::llvm::StringLiteral("builtin.unrealized_conversion_cast" ); |
| 509 | } |
| 510 | |
| 511 | std::pair<unsigned, unsigned> getODSOperandIndexAndLength(unsigned index); |
| 512 | ::mlir::Operation::operand_range getODSOperands(unsigned index) { |
| 513 | auto [start, length] = getODSOperandIndexAndLength(index); |
| 514 | return getOperation()->getOperands().slice(n: start, m: length); |
| 515 | } |
| 516 | |
| 517 | ::mlir::Operation::operand_range getInputs() { |
| 518 | return getODSOperands(index: 0); |
| 519 | } |
| 520 | |
| 521 | ::mlir::MutableOperandRange getInputsMutable(); |
| 522 | std::pair<unsigned, unsigned> getODSResultIndexAndLength(unsigned index); |
| 523 | ::mlir::Operation::result_range getODSResults(unsigned index) { |
| 524 | auto valueRange = getODSResultIndexAndLength(index); |
| 525 | return {std::next(x: getOperation()->result_begin(), n: valueRange.first), |
| 526 | std::next(x: getOperation()->result_begin(), n: valueRange.first + valueRange.second)}; |
| 527 | } |
| 528 | |
| 529 | ::mlir::Operation::result_range getOutputs() { |
| 530 | return getODSResults(index: 0); |
| 531 | } |
| 532 | |
| 533 | static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 534 | static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); |
| 535 | static llvm::hash_code computePropertiesHash(const Properties &prop); |
| 536 | static std::optional<mlir::Attribute> getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); |
| 537 | static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); |
| 538 | static void walkInherentAttrs(::mlir::MLIRContext *ctx, Properties &prop, ::llvm::function_ref<void(::llvm::StringRef, ::mlir::Attribute &)> visitor); |
| 539 | static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); |
| 540 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 541 | static UnrealizedConversionCastOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 542 | static UnrealizedConversionCastOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); |
| 543 | static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 544 | static UnrealizedConversionCastOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 545 | static UnrealizedConversionCastOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); |
| 546 | ::llvm::LogicalResult verifyInvariantsImpl(); |
| 547 | ::llvm::LogicalResult verifyInvariants(); |
| 548 | ::llvm::LogicalResult verify(); |
| 549 | ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); |
| 550 | static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); |
| 551 | LLVM_ATTRIBUTE_MINSIZE void print(::mlir::OpAsmPrinter &_odsPrinter); |
| 552 | void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); |
| 553 | public: |
| 554 | }; |
| 555 | |
| 556 | } // namespace mlir |
| 557 | MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::UnrealizedConversionCastOp) |
| 558 | |
| 559 | |
| 560 | #endif // GET_OP_CLASSES |
| 561 | |
| 562 | |