/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* Op Declarations *| |* *| |* Automatically generated file, do not edit! *| |* From: IRDLOps.td *| |* *| \*===----------------------------------------------------------------------===*/ namespace mlir::irdl { /// Constraints to the intersection of the provided constraints /// `irdl.all_of` defines a constraint that accepts any type or attribute that /// satisfies all of its provided constraints. /// /// Example: /// /// ```mlir /// irdl.dialect @cmath { /// irdl.type @complex_f32 { /// %0 = irdl.is i32 /// %1 = irdl.is f32 /// %2 = irdl.any_of(%0, %1) // is 32-bit /// /// %3 = irdl.is f32 /// %4 = irdl.is f64 /// %5 = irdl.any_of(%3, %4) // is a float /// /// %6 = irdl.all_of(%2, %5) // is a 32-bit float /// irdl.parameters(%6) /// } /// } /// ``` /// /// The above program defines a type `complex` inside the dialect `cmath` that /// has one parameter that must be 32-bit long and a float (in other /// words, that must be `f32`). class AllOfOp; } // namespace mlir::irdl namespace mlir::irdl { /// Constraints to the union of the provided constraints /// `irdl.any_of` defines a constraint that accepts any type or attribute that /// satisfies at least one of its provided type constraints. /// /// Example: /// /// ```mlir /// irdl.dialect @cmath { /// irdl.type @complex { /// %0 = irdl.is i32 /// %1 = irdl.is i64 /// %2 = irdl.is f32 /// %3 = irdl.is f64 /// %4 = irdl.any_of(%0, %1, %2, %3) /// irdl.parameters(%4) /// } /// } /// ``` /// /// The above program defines a type `complex` inside the dialect `cmath` that /// has a single type parameter that can be either `i32`, `i64`, `f32` or /// `f64`. class AnyOfOp; } // namespace mlir::irdl namespace mlir::irdl { /// Accept any type or attribute /// `irdl.any` defines a constraint that accepts any type or attribute. /// /// Example: /// /// ```mlir /// irdl.dialect @cmath { /// irdl.type @complex_flexible { /// %0 = irdl.any /// irdl.parameters(%0) /// } /// } /// ``` /// /// The above program defines a type `complex_flexible` inside the dialect /// `cmath` that has a single parameter that can be any attribute. class AnyOp; } // namespace mlir::irdl namespace mlir::irdl { /// Define a new attribute /// `irdl.attribute` defines a new attribute belonging to the `irdl.dialect` /// parent. /// /// The attribute parameters can be defined with an `irdl.parameters` operation /// in the optional region. /// /// Example: /// /// ```mlir /// irdl.dialect @testd { /// irdl.attribute @enum_attr { /// %0 = irdl.is "foo" /// %1 = irdl.is "bar" /// %2 = irdl.any_of(%0, %1) /// irdl.parameters(%2) /// } /// } /// ``` /// /// The above program defines an `enum_attr` attribute inside the `testd` /// dialect. The attribute has one `StringAttr` parameter that should be /// either a `"foo"` or a `"bar"`. class AttributeOp; } // namespace mlir::irdl namespace mlir::irdl { /// Define the attributes of an operation /// `irdl.attributes` defines the attributes of the `irdl.operation` parent /// operation definition. /// /// In the following example, `irdl.attributes` defines the attributes of the /// `attr_op` operation: /// /// ```mlir /// irdl.dialect @example { /// /// irdl.operation @attr_op { /// %0 = irdl.any /// %1 = irdl.is i64 /// irdl.attibutes { /// "attr1" = %0, /// "attr2" = %1 /// } /// } /// } /// ``` /// /// The operation will expect an arbitrary attribute "attr1" and an /// attribute "attr2" with value `i64`. class AttributesOp; } // namespace mlir::irdl namespace mlir::irdl { /// Constraints an attribute/type base /// `irdl.base` defines a constraint that only accepts a single type /// or attribute base, e.g. an `IntegerType`. The attribute base is defined /// either by a symbolic reference to the corresponding IRDL definition, /// or by the name of the base. Named bases are prefixed with `!` or `#` /// respectively for types and attributes. /// /// Example: /// /// ```mlir /// irdl.dialect @cmath { /// irdl.type @complex { /// %0 = irdl.base "!builtin.integer" /// irdl.parameters(%0) /// } /// /// irdl.type @complex_wrapper { /// %0 = irdl.base @cmath::@complex /// irdl.parameters(%0) /// } /// } /// ``` /// /// The above program defines a `cmath.complex` type that expects a single /// parameter, which is a type with base name `builtin.integer`, which is the /// name of an `IntegerType` type. /// It also defines a `cmath.complex_wrapper` type that expects a single /// parameter, which is a type of base type `cmath.complex`. class BaseOp; } // namespace mlir::irdl namespace mlir::irdl { /// Constraints an attribute using a C++ predicate /// `irdl.c_pred` defines a constraint that is written in C++. /// /// Dialects using this operation cannot be registered at runtime, as it relies /// on C++ code. /// /// Special placeholders can be used to refer to entities in the context where /// this predicate is used. They serve as "hooks" to the enclosing environment. /// The following special placeholders are supported in constraints for an op: /// /// * `$_builder` will be replaced by a mlir::Builder instance. /// * `$_op` will be replaced by the current operation. /// * `$_self` will be replaced with the entity this predicate is attached to. /// Compared to ODS, `$_self` is always of type `mlir::Attribute`, and types /// are manipulated as `TypeAttr` attributes. /// /// Example: /// ```mlir /// irdl.type @op_with_attr { /// %0 = irdl.c_pred "::llvm::isa<::mlir::IntegerAttr>($_self)" /// irdl.parameters(%0) /// } /// ``` /// /// In this example, @op_with_attr is defined as a type with a single /// parameter, which is an `IntegerAttr`, as constrained by the C++ predicate. class CPredOp; } // namespace mlir::irdl namespace mlir::irdl { /// Define a new dialect /// The `irdl.dialect` operation defines a dialect. All operations, attributes, /// and types defined inside its region will be part of the dialect. /// /// Example: /// /// ```mlir /// irdl.dialect @cmath { /// ... /// } /// ``` /// /// The above program defines a `cmath` dialect. class DialectOp; } // namespace mlir::irdl namespace mlir::irdl { /// Constraints an attribute/type to be a specific attribute instance /// `irdl.is` defines a constraint that only accepts a specific instance of a /// type or attribute. /// /// Example: /// /// ```mlir /// irdl.dialect @cmath { /// irdl.type @complex_i32 { /// %0 = irdl.is i32 /// irdl.parameters(%0) /// } /// } /// ``` /// /// The above program defines a `complex_i32` type inside the dialect `cmath` /// that can only have a `i32` as its parameter. class IsOp; } // namespace mlir::irdl namespace mlir::irdl { /// Define the operands of an operation /// `irdl.operands` define the operands of the `irdl.operation` parent operation /// definition. Each operand is named after an identifier. /// /// In the following example, `irdl.operands` defines the operands of the /// `mul` operation: /// /// ```mlir /// irdl.dialect @cmath { /// /// irdl.type @complex { /* ... */ } /// /// irdl.operation @mul { /// %0 = irdl.any /// %1 = irdl.parametric @cmath::@complex<%0> /// irdl.results(res: %1) /// irdl.operands(lhs: %1, rhs: %1) /// } /// } /// ``` /// /// The `mul` operation will expect two operands of type `cmath.complex`, that /// have the same type, and return a result of the same type. /// /// The operands can also be marked as variadic or optional: /// ```mlir /// irdl.operands(foo: %0, bar: single %1, baz: optional %2, qux: variadic %3) /// ``` /// /// Here, foo and bar are required single operands, baz is an optional operand, /// and qux is a variadic operand. /// /// When more than one operand is marked as optional or variadic, the operation /// will expect a 'operandSegmentSizes' attribute that defines the number of /// operands in each segment. class OperandsOp; } // namespace mlir::irdl namespace mlir::irdl { /// Define a new operation /// `irdl.operation` defines a new operation belonging to the `irdl.dialect` /// parent. /// /// Operations can define constraints on their operands and results with the /// `irdl.results` and `irdl.operands` operations. If these operations are not /// present in the region, the results or operands are expected to be empty. /// /// Example: /// /// ```mlir /// irdl.dialect @cmath { /// /// irdl.type @complex { /* ... */ } /// /// irdl.operation @norm { /// %0 = irdl.any /// %1 = irdl.parametric @cmath::@complex<%0> /// irdl.results(%0) /// irdl.operands(%1) /// } /// } /// ``` /// /// The above program defines an operation `norm` inside the dialect `cmath`. /// The operation expects a single operand of base type `cmath.complex`, and /// returns a single result of the element type of the operand. class OperationOp; } // namespace mlir::irdl namespace mlir::irdl { /// Define the constraints on parameters of a type/attribute definition /// `irdl.parameters` defines the constraints on parameters of a type or /// attribute definition. Each parameter is named after an identifier. /// /// Example: /// /// ```mlir /// irdl.dialect @cmath { /// irdl.type @complex { /// %0 = irdl.is i32 /// %1 = irdl.is i64 /// %2 = irdl.any_of(%0, %1) /// irdl.parameters(elem: %2) /// } /// } /// ``` /// /// The above program defines a type `complex` inside the dialect `cmath`. The /// type has a single parameter `elem` that should be either `i32` or `i64`. class ParametersOp; } // namespace mlir::irdl namespace mlir::irdl { /// Constraints an attribute/type base and its parameters /// `irdl.parametric` defines a constraint that accepts only a single type /// or attribute base. The attribute base is defined by a symbolic reference /// to the corresponding definition. It will additionally constraint the /// parameters of the type/attribute. /// /// Example: /// /// ```mlir /// irdl.dialect @cmath { /// /// irdl.type @complex { /* ... */ } /// /// irdl.operation @norm { /// %0 = irdl.any /// %1 = irdl.parametric @cmath::@complex<%0> /// irdl.operands(%1) /// irdl.results(%0) /// } /// } /// ``` /// /// The above program defines an operation `norm` inside the dialect `cmath` that /// for any `T` takes a `cmath.complex` with parameter `T` and returns a `T`. class ParametricOp; } // namespace mlir::irdl namespace mlir::irdl { /// Define a region of an operation /// The irdl.region construct defines a set of characteristics /// that a region of an operation should satify. Each region is named after /// an identifier. /// /// These characteristics include constraints for the entry block arguments /// of the region and the total number of blocks it contains. /// The number of blocks must be a non-zero and non-negative integer, /// and it is optional by default. /// The set of constraints for the entry block arguments may be optional or /// empty. If no parentheses are provided, the set is assumed to be optional, /// and the arguments are not constrained in any way. If parentheses are /// provided with no arguments, it means that the region must have /// no entry block arguments /// /// /// Example: /// /// ```mlir /// irdl.dialect @example { /// irdl.operation @op_with_regions { /// %r0 = irdl.region /// %r1 = irdl.region() /// %v0 = irdl.is i32 /// %v1 = irdl.is i64 /// %r2 = irdl.region(%v0, %v1) /// %r3 = irdl.region with size 3 /// /// irdl.regions(foo: %r0, bar: %r1, baz: %r2, qux: %r3) /// } /// } /// ``` /// /// The above snippet demonstrates an operation named `@op_with_regions`, /// which is constrained to have four regions. /// /// * Region `foo` doesn't have any constraints on the arguments /// or the number of blocks. /// * Region `bar` should have an empty set of arguments. /// * Region `baz` should have two arguments of types `i32` and `i64`. /// * Region `qux` should contain exactly three blocks. class RegionOp; } // namespace mlir::irdl namespace mlir::irdl { /// Define the regions of an operation /// `irdl.regions` defines the regions of an operation by accepting /// values produced by `irdl.region` operation as arguments. Each /// region has an identifier as name. /// /// Example: /// /// ```mlir /// irdl.dialect @example { /// irdl.operation @op_with_regions { /// %r1 = irdl.region with size 3 /// %0 = irdl.any /// %r2 = irdl.region(%0) /// irdl.regions(foo: %r1, bar: %r2) /// } /// } /// ``` /// /// In the snippet above the operation is constrained to have two regions. /// The first region (`foo`) should contain three blocks. /// The second region (`bar`) should have one region with one argument. class RegionsOp; } // namespace mlir::irdl namespace mlir::irdl { /// Define the results of an operation /// `irdl.results` define the results of the `irdl.operation` parent operation /// definition. Each result is named after an identifier. /// /// In the following example, `irdl.results` defines the results of the /// `get_values` operation: /// /// ```mlir /// irdl.dialect @cmath { /// /// irdl.type @complex { /* ... */ } /// /// /// Returns the real and imaginary parts of a complex number. /// irdl.operation @get_values { /// %0 = irdl.any /// %1 = irdl.parametric @cmath::@complex<%0> /// irdl.results(re: %0, im: %0) /// irdl.operands(complex: %1) /// } /// } /// ``` /// /// The operation will expect one operand of the `cmath.complex` type, and two /// results that have the underlying type of the `cmath.complex`. /// /// The results can also be marked as variadic or optional: /// ```mlir /// irdl.results(foo: %0, bar: single %1, baz: optional %2, qux: variadic %3) /// ``` /// /// Here, foo and bar are required single results, baz is an optional result, /// and qux is a variadic result. /// /// When more than one result is marked as optional or variadic, the operation /// will expect a 'resultSegmentSizes' attribute that defines the number of /// results in each segment. class ResultsOp; } // namespace mlir::irdl namespace mlir::irdl { /// Define a new type /// `irdl.type` defines a new type belonging to the `irdl.dialect` parent. /// /// The type parameters can be defined with an `irdl.parameters` operation in /// the optional region. /// /// Example: /// /// ```mlir /// irdl.dialect @cmath { /// irdl.type @complex { /// %0 = irdl.is i32 /// %1 = irdl.is i64 /// %2 = irdl.any_of(%0, %1) /// irdl.parameters(%2) /// } /// } /// ``` /// /// The above program defines a type `complex` inside the dialect `cmath`. The /// type has a single parameter that should be either `i32` or `i64`. class TypeOp; } // namespace mlir::irdl #ifdef GET_OP_CLASSES #undef GET_OP_CLASSES namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::AllOfOp declarations //===----------------------------------------------------------------------===// namespace detail { class AllOfOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: AllOfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.all_of", odsAttrs.getContext()); } AllOfOpGenericAdaptorBase(AllOfOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class AllOfOpGenericAdaptor : public detail::AllOfOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::AllOfOpGenericAdaptorBase; static constexpr int odsIndex_args = 0; public: AllOfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} AllOfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AllOfOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} AllOfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AllOfOpGenericAdaptor(values, attrs, Properties{}, {}) {} AllOfOpGenericAdaptor(RangeT values, const AllOfOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> AllOfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getArgs() { return getODSOperands(0); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class AllOfOpAdaptor : public AllOfOpGenericAdaptor<::mlir::ValueRange> { public: using AllOfOpGenericAdaptor::AllOfOpGenericAdaptor; AllOfOpAdaptor(AllOfOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class AllOfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::irdl::VerifyConstraintInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType> { public: using Op::Op; using Op::print; using Adaptor = AllOfOpAdaptor; template using GenericAdaptor = AllOfOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_args = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.all_of"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getArgs() { return getODSOperands(0); } ::mlir::MutableOperandRange getArgsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::TypedValue<::mlir::irdl::AttributeType> getOutput() { return ::llvm::cast<::mlir::TypedValue<::mlir::irdl::AttributeType>>(*getODSResults(0).begin()); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange args); static AllOfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::ValueRange args); static AllOfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::ValueRange args); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AllOfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AllOfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AllOfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AllOfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AllOfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AllOfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AllOfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AllOfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); std::unique_ptr<::mlir::irdl::Constraint> getVerifier(::mlir::ArrayRef valueToConstr, ::mlir::DenseMap<::mlir::irdl::TypeOp, std::unique_ptr<::mlir::DynamicTypeDefinition>> const&types, ::mlir::DenseMap<::mlir::irdl::AttributeOp, std::unique_ptr<::mlir::DynamicAttrDefinition>> const&attrs); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::AllOfOp) namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::AnyOfOp declarations //===----------------------------------------------------------------------===// namespace detail { class AnyOfOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: AnyOfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.any_of", odsAttrs.getContext()); } AnyOfOpGenericAdaptorBase(AnyOfOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class AnyOfOpGenericAdaptor : public detail::AnyOfOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::AnyOfOpGenericAdaptorBase; static constexpr int odsIndex_args = 0; public: AnyOfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} AnyOfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AnyOfOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} AnyOfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AnyOfOpGenericAdaptor(values, attrs, Properties{}, {}) {} AnyOfOpGenericAdaptor(RangeT values, const AnyOfOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> AnyOfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getArgs() { return getODSOperands(0); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class AnyOfOpAdaptor : public AnyOfOpGenericAdaptor<::mlir::ValueRange> { public: using AnyOfOpGenericAdaptor::AnyOfOpGenericAdaptor; AnyOfOpAdaptor(AnyOfOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class AnyOfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::irdl::VerifyConstraintInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType> { public: using Op::Op; using Op::print; using Adaptor = AnyOfOpAdaptor; template using GenericAdaptor = AnyOfOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_args = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.any_of"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getArgs() { return getODSOperands(0); } ::mlir::MutableOperandRange getArgsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::TypedValue<::mlir::irdl::AttributeType> getOutput() { return ::llvm::cast<::mlir::TypedValue<::mlir::irdl::AttributeType>>(*getODSResults(0).begin()); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange args); static AnyOfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::ValueRange args); static AnyOfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::ValueRange args); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AnyOfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AnyOfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AnyOfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AnyOfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AnyOfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AnyOfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AnyOfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AnyOfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); std::unique_ptr<::mlir::irdl::Constraint> getVerifier(::mlir::ArrayRef valueToConstr, ::mlir::DenseMap<::mlir::irdl::TypeOp, std::unique_ptr<::mlir::DynamicTypeDefinition>> const&types, ::mlir::DenseMap<::mlir::irdl::AttributeOp, std::unique_ptr<::mlir::DynamicAttrDefinition>> const&attrs); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::AnyOfOp) namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::AnyOp declarations //===----------------------------------------------------------------------===// namespace detail { class AnyOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: AnyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.any", odsAttrs.getContext()); } AnyOpGenericAdaptorBase(AnyOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class AnyOpGenericAdaptor : public detail::AnyOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::AnyOpGenericAdaptorBase; public: AnyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} AnyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AnyOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} AnyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AnyOpGenericAdaptor(values, attrs, Properties{}, {}) {} AnyOpGenericAdaptor(RangeT values, const AnyOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> AnyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class AnyOpAdaptor : public AnyOpGenericAdaptor<::mlir::ValueRange> { public: using AnyOpGenericAdaptor::AnyOpGenericAdaptor; AnyOpAdaptor(AnyOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class AnyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::irdl::VerifyConstraintInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = AnyOpAdaptor; template using GenericAdaptor = AnyOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.any"); } std::pair getODSOperandIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::TypedValue<::mlir::irdl::AttributeType> getOutput() { return ::llvm::cast<::mlir::TypedValue<::mlir::irdl::AttributeType>>(*getODSResults(0).begin()); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output); static AnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output); static AnyOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); static AnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location); static AnyOp create(::mlir::ImplicitLocOpBuilder &builder); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); static AnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes); static AnyOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AnyOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AnyOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AnyOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AnyOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AnyOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); std::unique_ptr<::mlir::irdl::Constraint> getVerifier(::mlir::ArrayRef valueToConstr, ::mlir::DenseMap<::mlir::irdl::TypeOp, std::unique_ptr<::mlir::DynamicTypeDefinition>> const&types, ::mlir::DenseMap<::mlir::irdl::AttributeOp, std::unique_ptr<::mlir::DynamicAttrDefinition>> const&attrs); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::AnyOp) namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::AttributeOp declarations //===----------------------------------------------------------------------===// namespace detail { class AttributeOpGenericAdaptorBase { public: struct Properties { using sym_nameTy = ::mlir::StringAttr; sym_nameTy sym_name; auto getSymName() const { auto &propStorage = this->sym_name; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setSymName(const ::mlir::StringAttr &propValue) { this->sym_name = propValue; } bool operator==(const Properties &rhs) const { return rhs.sym_name == this->sym_name && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: AttributeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.attribute", odsAttrs.getContext()); } AttributeOpGenericAdaptorBase(AttributeOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getSymNameAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); return attr; } ::llvm::StringRef getSymName(); ::mlir::Region &getBody() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class AttributeOpGenericAdaptor : public detail::AttributeOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::AttributeOpGenericAdaptorBase; public: AttributeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} AttributeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AttributeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} AttributeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AttributeOpGenericAdaptor(values, attrs, Properties{}, {}) {} AttributeOpGenericAdaptor(RangeT values, const AttributeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> AttributeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class AttributeOpAdaptor : public AttributeOpGenericAdaptor<::mlir::ValueRange> { public: using AttributeOpGenericAdaptor::AttributeOpGenericAdaptor; AttributeOpAdaptor(AttributeOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class AttributeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::NoTerminator, ::mlir::OpTrait::NoRegionArguments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::AtMostOneChildOf::Impl, ::mlir::SymbolOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove> { public: using Op::Op; using Op::print; using Adaptor = AttributeOpAdaptor; template using GenericAdaptor = AttributeOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("sym_name")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getSymNameAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.attribute"); } std::pair getODSOperandIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Region &getBody() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::StringAttr getSymNameAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); } ::llvm::StringRef getSymName(); void setSymNameAttr(::mlir::StringAttr attr) { getProperties().sym_name = attr; } void setSymName(::llvm::StringRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name); static AttributeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name); static AttributeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static AttributeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static AttributeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name); static AttributeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name); static AttributeOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static AttributeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static AttributeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AttributeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AttributeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AttributeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AttributeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 1 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::AttributeOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::detail::AttributeOpGenericAdaptorBase::Properties) namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::AttributesOp declarations //===----------------------------------------------------------------------===// namespace detail { class AttributesOpGenericAdaptorBase { public: struct Properties { using attributeValueNamesTy = ::mlir::ArrayAttr; attributeValueNamesTy attributeValueNames; auto getAttributeValueNames() const { auto &propStorage = this->attributeValueNames; return ::llvm::cast<::mlir::ArrayAttr>(propStorage); } void setAttributeValueNames(const ::mlir::ArrayAttr &propValue) { this->attributeValueNames = propValue; } bool operator==(const Properties &rhs) const { return rhs.attributeValueNames == this->attributeValueNames && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: AttributesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.attributes", odsAttrs.getContext()); } AttributesOpGenericAdaptorBase(AttributesOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getAttributeValueNamesAttr() { auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().attributeValueNames); return attr; } ::mlir::ArrayAttr getAttributeValueNames(); }; } // namespace detail template class AttributesOpGenericAdaptor : public detail::AttributesOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::AttributesOpGenericAdaptorBase; static constexpr int odsIndex_attributeValues = 0; public: AttributesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} AttributesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AttributesOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} AttributesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AttributesOpGenericAdaptor(values, attrs, Properties{}, {}) {} AttributesOpGenericAdaptor(RangeT values, const AttributesOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> AttributesOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getAttributeValues() { return getODSOperands(0); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class AttributesOpAdaptor : public AttributesOpGenericAdaptor<::mlir::ValueRange> { public: using AttributesOpGenericAdaptor::AttributesOpGenericAdaptor; AttributesOpAdaptor(AttributesOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class AttributesOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = AttributesOpAdaptor; template using GenericAdaptor = AttributesOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_attributeValues = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("attributeValueNames")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getAttributeValueNamesAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getAttributeValueNamesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.attributes"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getAttributeValues() { return getODSOperands(0); } ::mlir::MutableOperandRange getAttributeValuesMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::ArrayAttr getAttributeValueNamesAttr() { return ::llvm::cast<::mlir::ArrayAttr>(getProperties().attributeValueNames); } ::mlir::ArrayAttr getAttributeValueNames(); void setAttributeValueNamesAttr(::mlir::ArrayAttr attr) { getProperties().attributeValueNames = attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange attributeValues, ::mlir::ArrayAttr attributeValueNames); static AttributesOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange attributeValues, ::mlir::ArrayAttr attributeValueNames); static AttributesOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange attributeValues, ::mlir::ArrayAttr attributeValueNames); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange attributeValues, ::mlir::ArrayAttr attributeValueNames); static AttributesOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange attributeValues, ::mlir::ArrayAttr attributeValueNames); static AttributesOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange attributeValues, ::mlir::ArrayAttr attributeValueNames); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AttributesOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AttributesOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AttributesOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AttributesOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 1 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::AttributesOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::detail::AttributesOpGenericAdaptorBase::Properties) namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::BaseOp declarations //===----------------------------------------------------------------------===// namespace detail { class BaseOpGenericAdaptorBase { public: struct Properties { using base_nameTy = ::mlir::StringAttr; base_nameTy base_name; auto getBaseName() const { auto &propStorage = this->base_name; return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(propStorage); } void setBaseName(const ::mlir::StringAttr &propValue) { this->base_name = propValue; } using base_refTy = ::mlir::SymbolRefAttr; base_refTy base_ref; auto getBaseRef() const { auto &propStorage = this->base_ref; return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(propStorage); } void setBaseRef(const ::mlir::SymbolRefAttr &propValue) { this->base_ref = propValue; } bool operator==(const Properties &rhs) const { return rhs.base_name == this->base_name && rhs.base_ref == this->base_ref && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: BaseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.base", odsAttrs.getContext()); } BaseOpGenericAdaptorBase(BaseOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::SymbolRefAttr getBaseRefAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().base_ref); return attr; } ::std::optional< ::mlir::SymbolRefAttr > getBaseRef(); ::mlir::StringAttr getBaseNameAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().base_name); return attr; } ::std::optional< ::llvm::StringRef > getBaseName(); }; } // namespace detail template class BaseOpGenericAdaptor : public detail::BaseOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::BaseOpGenericAdaptorBase; public: BaseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} BaseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BaseOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} BaseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : BaseOpGenericAdaptor(values, attrs, Properties{}, {}) {} BaseOpGenericAdaptor(RangeT values, const BaseOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> BaseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class BaseOpAdaptor : public BaseOpGenericAdaptor<::mlir::ValueRange> { public: using BaseOpGenericAdaptor::BaseOpGenericAdaptor; BaseOpAdaptor(BaseOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class BaseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::irdl::VerifyConstraintInterface::Trait, ::mlir::SymbolUserOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = BaseOpAdaptor; template using GenericAdaptor = BaseOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("base_name"), ::llvm::StringRef("base_ref")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getBaseNameAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getBaseNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getBaseRefAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getBaseRefAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.base"); } std::pair getODSOperandIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::TypedValue<::mlir::irdl::AttributeType> getOutput() { return ::llvm::cast<::mlir::TypedValue<::mlir::irdl::AttributeType>>(*getODSResults(0).begin()); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::SymbolRefAttr getBaseRefAttr() { return ::llvm::dyn_cast_or_null<::mlir::SymbolRefAttr>(getProperties().base_ref); } ::std::optional< ::mlir::SymbolRefAttr > getBaseRef(); ::mlir::StringAttr getBaseNameAttr() { return ::llvm::dyn_cast_or_null<::mlir::StringAttr>(getProperties().base_name); } ::std::optional< ::llvm::StringRef > getBaseName(); void setBaseRefAttr(::mlir::SymbolRefAttr attr) { getProperties().base_ref = attr; } void setBaseNameAttr(::mlir::StringAttr attr) { getProperties().base_name = attr; } void setBaseName(::std::optional<::llvm::StringRef> attrValue); ::mlir::Attribute removeBaseRefAttr() { auto attr = getProperties().base_ref; getProperties().base_ref = {}; return attr; } ::mlir::Attribute removeBaseNameAttr() { auto attr = getProperties().base_name; getProperties().base_name = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, SymbolRefAttr base_ref); static BaseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, SymbolRefAttr base_ref); static BaseOp create(::mlir::ImplicitLocOpBuilder &builder, SymbolRefAttr base_ref); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringAttr base_name); static BaseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, StringAttr base_name); static BaseOp create(::mlir::ImplicitLocOpBuilder &builder, StringAttr base_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, /*optional*/::mlir::SymbolRefAttr base_ref, /*optional*/::mlir::StringAttr base_name); static BaseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, /*optional*/::mlir::SymbolRefAttr base_ref, /*optional*/::mlir::StringAttr base_name); static BaseOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, /*optional*/::mlir::SymbolRefAttr base_ref, /*optional*/::mlir::StringAttr base_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::SymbolRefAttr base_ref, /*optional*/::mlir::StringAttr base_name); static BaseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::SymbolRefAttr base_ref, /*optional*/::mlir::StringAttr base_name); static BaseOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::SymbolRefAttr base_ref, /*optional*/::mlir::StringAttr base_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::SymbolRefAttr base_ref, /*optional*/::mlir::StringAttr base_name); static BaseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::SymbolRefAttr base_ref, /*optional*/::mlir::StringAttr base_name); static BaseOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::SymbolRefAttr base_ref, /*optional*/::mlir::StringAttr base_name); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static BaseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static BaseOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static BaseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static BaseOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static BaseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static BaseOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static BaseOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static BaseOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); std::unique_ptr<::mlir::irdl::Constraint> getVerifier(::mlir::ArrayRef valueToConstr, ::mlir::DenseMap<::mlir::irdl::TypeOp, std::unique_ptr<::mlir::DynamicTypeDefinition>> const&types, ::mlir::DenseMap<::mlir::irdl::AttributeOp, std::unique_ptr<::mlir::DynamicAttrDefinition>> const&attrs); ::llvm::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::BaseOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::detail::BaseOpGenericAdaptorBase::Properties) namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::CPredOp declarations //===----------------------------------------------------------------------===// namespace detail { class CPredOpGenericAdaptorBase { public: struct Properties { using predTy = ::mlir::StringAttr; predTy pred; auto getPred() const { auto &propStorage = this->pred; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setPred(const ::mlir::StringAttr &propValue) { this->pred = propValue; } bool operator==(const Properties &rhs) const { return rhs.pred == this->pred && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: CPredOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.c_pred", odsAttrs.getContext()); } CPredOpGenericAdaptorBase(CPredOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getPredAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().pred); return attr; } ::llvm::StringRef getPred(); }; } // namespace detail template class CPredOpGenericAdaptor : public detail::CPredOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::CPredOpGenericAdaptorBase; public: CPredOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} CPredOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CPredOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} CPredOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CPredOpGenericAdaptor(values, attrs, Properties{}, {}) {} CPredOpGenericAdaptor(RangeT values, const CPredOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> CPredOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class CPredOpAdaptor : public CPredOpGenericAdaptor<::mlir::ValueRange> { public: using CPredOpGenericAdaptor::CPredOpGenericAdaptor; CPredOpAdaptor(CPredOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class CPredOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = CPredOpAdaptor; template using GenericAdaptor = CPredOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("pred")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getPredAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getPredAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.c_pred"); } std::pair getODSOperandIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::TypedValue<::mlir::irdl::AttributeType> getOutput() { return ::llvm::cast<::mlir::TypedValue<::mlir::irdl::AttributeType>>(*getODSResults(0).begin()); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::StringAttr getPredAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().pred); } ::llvm::StringRef getPred(); void setPredAttr(::mlir::StringAttr attr) { getProperties().pred = attr; } void setPred(::llvm::StringRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::StringAttr pred); static CPredOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::StringAttr pred); static CPredOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::StringAttr pred); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr pred); static CPredOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr pred); static CPredOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr pred); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr pred); static CPredOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr pred); static CPredOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr pred); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::llvm::StringRef pred); static CPredOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::llvm::StringRef pred); static CPredOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::llvm::StringRef pred); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef pred); static CPredOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef pred); static CPredOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef pred); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef pred); static CPredOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef pred); static CPredOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef pred); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CPredOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CPredOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CPredOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CPredOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static CPredOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static CPredOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static CPredOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static CPredOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 1 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::CPredOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::detail::CPredOpGenericAdaptorBase::Properties) namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::DialectOp declarations //===----------------------------------------------------------------------===// namespace detail { class DialectOpGenericAdaptorBase { public: struct Properties { using sym_nameTy = ::mlir::StringAttr; sym_nameTy sym_name; auto getSymName() const { auto &propStorage = this->sym_name; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setSymName(const ::mlir::StringAttr &propValue) { this->sym_name = propValue; } bool operator==(const Properties &rhs) const { return rhs.sym_name == this->sym_name && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DialectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.dialect", odsAttrs.getContext()); } DialectOpGenericAdaptorBase(DialectOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getSymNameAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); return attr; } ::llvm::StringRef getSymName(); ::mlir::Region &getBody() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DialectOpGenericAdaptor : public detail::DialectOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DialectOpGenericAdaptorBase; public: DialectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DialectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DialectOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DialectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : DialectOpGenericAdaptor(values, attrs, Properties{}, {}) {} DialectOpGenericAdaptor(RangeT values, const DialectOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DialectOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DialectOpAdaptor : public DialectOpGenericAdaptor<::mlir::ValueRange> { public: using DialectOpGenericAdaptor::DialectOpGenericAdaptor; DialectOpAdaptor(DialectOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DialectOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = DialectOpAdaptor; template using GenericAdaptor = DialectOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("sym_name")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getSymNameAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.dialect"); } std::pair getODSOperandIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Region &getBody() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::StringAttr getSymNameAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); } ::llvm::StringRef getSymName(); void setSymNameAttr(::mlir::StringAttr attr) { getProperties().sym_name = attr; } void setSymName(::llvm::StringRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name); static DialectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name); static DialectOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static DialectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static DialectOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name); static DialectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name); static DialectOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static DialectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static DialectOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DialectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DialectOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DialectOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DialectOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 1 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::DialectOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::detail::DialectOpGenericAdaptorBase::Properties) namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::IsOp declarations //===----------------------------------------------------------------------===// namespace detail { class IsOpGenericAdaptorBase { public: struct Properties { using expectedTy = ::mlir::Attribute; expectedTy expected; auto getExpected() const { auto &propStorage = this->expected; return ::llvm::cast<::mlir::Attribute>(propStorage); } void setExpected(const ::mlir::Attribute &propValue) { this->expected = propValue; } bool operator==(const Properties &rhs) const { return rhs.expected == this->expected && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: IsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.is", odsAttrs.getContext()); } IsOpGenericAdaptorBase(IsOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Attribute getExpectedAttr() { auto attr = ::llvm::cast<::mlir::Attribute>(getProperties().expected); return attr; } ::mlir::Attribute getExpected(); }; } // namespace detail template class IsOpGenericAdaptor : public detail::IsOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::IsOpGenericAdaptorBase; public: IsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} IsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : IsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} IsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : IsOpGenericAdaptor(values, attrs, Properties{}, {}) {} IsOpGenericAdaptor(RangeT values, const IsOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> IsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class IsOpAdaptor : public IsOpGenericAdaptor<::mlir::ValueRange> { public: using IsOpGenericAdaptor::IsOpGenericAdaptor; IsOpAdaptor(IsOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class IsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::irdl::VerifyConstraintInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = IsOpAdaptor; template using GenericAdaptor = IsOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("expected")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getExpectedAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getExpectedAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.is"); } std::pair getODSOperandIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::TypedValue<::mlir::irdl::AttributeType> getOutput() { return ::llvm::cast<::mlir::TypedValue<::mlir::irdl::AttributeType>>(*getODSResults(0).begin()); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::Attribute getExpectedAttr() { return ::llvm::cast<::mlir::Attribute>(getProperties().expected); } ::mlir::Attribute getExpected(); void setExpectedAttr(::mlir::Attribute attr) { getProperties().expected = attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Attribute expected); static IsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::Attribute expected); static IsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::Attribute expected); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Attribute expected); static IsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Attribute expected); static IsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Attribute expected); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute expected); static IsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Attribute expected); static IsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Attribute expected); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static IsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static IsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static IsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static IsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static IsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static IsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static IsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static IsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); std::unique_ptr<::mlir::irdl::Constraint> getVerifier(::mlir::ArrayRef valueToConstr, ::mlir::DenseMap<::mlir::irdl::TypeOp, std::unique_ptr<::mlir::DynamicTypeDefinition>> const&types, ::mlir::DenseMap<::mlir::irdl::AttributeOp, std::unique_ptr<::mlir::DynamicAttrDefinition>> const&attrs); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 1 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::IsOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::detail::IsOpGenericAdaptorBase::Properties) namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::OperandsOp declarations //===----------------------------------------------------------------------===// namespace detail { class OperandsOpGenericAdaptorBase { public: struct Properties { using namesTy = ::mlir::ArrayAttr; namesTy names; auto getNames() const { auto &propStorage = this->names; return ::llvm::cast<::mlir::ArrayAttr>(propStorage); } void setNames(const ::mlir::ArrayAttr &propValue) { this->names = propValue; } using variadicityTy = ::mlir::irdl::VariadicityArrayAttr; variadicityTy variadicity; auto getVariadicity() const { auto &propStorage = this->variadicity; return ::llvm::cast<::mlir::irdl::VariadicityArrayAttr>(propStorage); } void setVariadicity(const ::mlir::irdl::VariadicityArrayAttr &propValue) { this->variadicity = propValue; } bool operator==(const Properties &rhs) const { return rhs.names == this->names && rhs.variadicity == this->variadicity && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: OperandsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.operands", odsAttrs.getContext()); } OperandsOpGenericAdaptorBase(OperandsOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getNamesAttr() { auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().names); return attr; } ::mlir::ArrayAttr getNames(); ::mlir::irdl::VariadicityArrayAttr getVariadicityAttr() { auto attr = ::llvm::cast<::mlir::irdl::VariadicityArrayAttr>(getProperties().variadicity); return attr; } ::llvm::ArrayRef getVariadicity(); }; } // namespace detail template class OperandsOpGenericAdaptor : public detail::OperandsOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::OperandsOpGenericAdaptorBase; static constexpr int odsIndex_args = 0; public: OperandsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} OperandsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : OperandsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} OperandsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : OperandsOpGenericAdaptor(values, attrs, Properties{}, {}) {} OperandsOpGenericAdaptor(RangeT values, const OperandsOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> OperandsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getArgs() { return getODSOperands(0); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class OperandsOpAdaptor : public OperandsOpGenericAdaptor<::mlir::ValueRange> { public: using OperandsOpGenericAdaptor::OperandsOpGenericAdaptor; OperandsOpAdaptor(OperandsOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class OperandsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = OperandsOpAdaptor; template using GenericAdaptor = OperandsOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_args = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("names"), ::llvm::StringRef("variadicity")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getNamesAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getNamesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getVariadicityAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getVariadicityAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.operands"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getArgs() { return getODSOperands(0); } ::mlir::MutableOperandRange getArgsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::ArrayAttr getNamesAttr() { return ::llvm::cast<::mlir::ArrayAttr>(getProperties().names); } ::mlir::ArrayAttr getNames(); ::mlir::irdl::VariadicityArrayAttr getVariadicityAttr() { return ::llvm::cast<::mlir::irdl::VariadicityArrayAttr>(getProperties().variadicity); } ::llvm::ArrayRef getVariadicity(); void setNamesAttr(::mlir::ArrayAttr attr) { getProperties().names = attr; } void setVariadicityAttr(::mlir::irdl::VariadicityArrayAttr attr) { getProperties().variadicity = attr; } void setVariadicity(::llvm::ArrayRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::mlir::irdl::VariadicityArrayAttr variadicity); static OperandsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::mlir::irdl::VariadicityArrayAttr variadicity); static OperandsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::mlir::irdl::VariadicityArrayAttr variadicity); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::mlir::irdl::VariadicityArrayAttr variadicity); static OperandsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::mlir::irdl::VariadicityArrayAttr variadicity); static OperandsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::mlir::irdl::VariadicityArrayAttr variadicity); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::llvm::ArrayRef variadicity); static OperandsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::llvm::ArrayRef variadicity); static OperandsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::llvm::ArrayRef variadicity); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::llvm::ArrayRef variadicity); static OperandsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::llvm::ArrayRef variadicity); static OperandsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::llvm::ArrayRef variadicity); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static OperandsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static OperandsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static OperandsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static OperandsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::OperandsOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::detail::OperandsOpGenericAdaptorBase::Properties) namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::OperationOp declarations //===----------------------------------------------------------------------===// namespace detail { class OperationOpGenericAdaptorBase { public: struct Properties { using sym_nameTy = ::mlir::StringAttr; sym_nameTy sym_name; auto getSymName() const { auto &propStorage = this->sym_name; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setSymName(const ::mlir::StringAttr &propValue) { this->sym_name = propValue; } bool operator==(const Properties &rhs) const { return rhs.sym_name == this->sym_name && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: OperationOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.operation", odsAttrs.getContext()); } OperationOpGenericAdaptorBase(OperationOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getSymNameAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); return attr; } ::llvm::StringRef getSymName(); ::mlir::Region &getBody() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class OperationOpGenericAdaptor : public detail::OperationOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::OperationOpGenericAdaptorBase; public: OperationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} OperationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : OperationOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} OperationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : OperationOpGenericAdaptor(values, attrs, Properties{}, {}) {} OperationOpGenericAdaptor(RangeT values, const OperationOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> OperationOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class OperationOpAdaptor : public OperationOpGenericAdaptor<::mlir::ValueRange> { public: using OperationOpGenericAdaptor::OperationOpGenericAdaptor; OperationOpAdaptor(OperationOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class OperationOp : public ::mlir::Op::Impl, ::mlir::OpTrait::NoTerminator, ::mlir::OpTrait::NoRegionArguments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::AtMostOneChildOf::Impl, ::mlir::SymbolOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove> { public: using Op::Op; using Op::print; using Adaptor = OperationOpAdaptor; template using GenericAdaptor = OperationOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("sym_name")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getSymNameAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.operation"); } std::pair getODSOperandIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Region &getBody() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::StringAttr getSymNameAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); } ::llvm::StringRef getSymName(); void setSymNameAttr(::mlir::StringAttr attr) { getProperties().sym_name = attr; } void setSymName(::llvm::StringRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name); static OperationOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name); static OperationOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static OperationOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static OperationOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name); static OperationOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name); static OperationOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static OperationOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static OperationOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static OperationOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static OperationOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static OperationOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static OperationOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); ::llvm::LogicalResult verifyRegions(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 1 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::OperationOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::detail::OperationOpGenericAdaptorBase::Properties) namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::ParametersOp declarations //===----------------------------------------------------------------------===// namespace detail { class ParametersOpGenericAdaptorBase { public: struct Properties { using namesTy = ::mlir::ArrayAttr; namesTy names; auto getNames() const { auto &propStorage = this->names; return ::llvm::cast<::mlir::ArrayAttr>(propStorage); } void setNames(const ::mlir::ArrayAttr &propValue) { this->names = propValue; } bool operator==(const Properties &rhs) const { return rhs.names == this->names && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: ParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.parameters", odsAttrs.getContext()); } ParametersOpGenericAdaptorBase(ParametersOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getNamesAttr() { auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().names); return attr; } ::mlir::ArrayAttr getNames(); }; } // namespace detail template class ParametersOpGenericAdaptor : public detail::ParametersOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ParametersOpGenericAdaptorBase; static constexpr int odsIndex_args = 0; public: ParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ParametersOpGenericAdaptor(values, attrs, Properties{}, {}) {} ParametersOpGenericAdaptor(RangeT values, const ParametersOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getArgs() { return getODSOperands(0); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ParametersOpAdaptor : public ParametersOpGenericAdaptor<::mlir::ValueRange> { public: using ParametersOpGenericAdaptor::ParametersOpGenericAdaptor; ParametersOpAdaptor(ParametersOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ParametersOpAdaptor; template using GenericAdaptor = ParametersOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_args = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("names")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getNamesAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getNamesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.parameters"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getArgs() { return getODSOperands(0); } ::mlir::MutableOperandRange getArgsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::ArrayAttr getNamesAttr() { return ::llvm::cast<::mlir::ArrayAttr>(getProperties().names); } ::mlir::ArrayAttr getNames(); void setNamesAttr(::mlir::ArrayAttr attr) { getProperties().names = attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange args, ::mlir::ArrayAttr names); static ParametersOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange args, ::mlir::ArrayAttr names); static ParametersOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange args, ::mlir::ArrayAttr names); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names); static ParametersOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names); static ParametersOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ParametersOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ParametersOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ParametersOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ParametersOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 1 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::ParametersOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::detail::ParametersOpGenericAdaptorBase::Properties) namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::ParametricOp declarations //===----------------------------------------------------------------------===// namespace detail { class ParametricOpGenericAdaptorBase { public: struct Properties { using base_typeTy = ::mlir::SymbolRefAttr; base_typeTy base_type; auto getBaseType() const { auto &propStorage = this->base_type; return ::llvm::cast<::mlir::SymbolRefAttr>(propStorage); } void setBaseType(const ::mlir::SymbolRefAttr &propValue) { this->base_type = propValue; } bool operator==(const Properties &rhs) const { return rhs.base_type == this->base_type && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: ParametricOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.parametric", odsAttrs.getContext()); } ParametricOpGenericAdaptorBase(ParametricOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::SymbolRefAttr getBaseTypeAttr() { auto attr = ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().base_type); return attr; } ::mlir::SymbolRefAttr getBaseType(); }; } // namespace detail template class ParametricOpGenericAdaptor : public detail::ParametricOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ParametricOpGenericAdaptorBase; static constexpr int odsIndex_args = 0; public: ParametricOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ParametricOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ParametricOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ParametricOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ParametricOpGenericAdaptor(values, attrs, Properties{}, {}) {} ParametricOpGenericAdaptor(RangeT values, const ParametricOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ParametricOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getArgs() { return getODSOperands(0); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ParametricOpAdaptor : public ParametricOpGenericAdaptor<::mlir::ValueRange> { public: using ParametricOpGenericAdaptor::ParametricOpGenericAdaptor; ParametricOpAdaptor(ParametricOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ParametricOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::irdl::VerifyConstraintInterface::Trait, ::mlir::SymbolUserOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ParametricOpAdaptor; template using GenericAdaptor = ParametricOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_args = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("base_type")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getBaseTypeAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getBaseTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.parametric"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getArgs() { return getODSOperands(0); } ::mlir::MutableOperandRange getArgsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::TypedValue<::mlir::irdl::AttributeType> getOutput() { return ::llvm::cast<::mlir::TypedValue<::mlir::irdl::AttributeType>>(*getODSResults(0).begin()); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::SymbolRefAttr getBaseTypeAttr() { return ::llvm::cast<::mlir::SymbolRefAttr>(getProperties().base_type); } ::mlir::SymbolRefAttr getBaseType(); void setBaseTypeAttr(::mlir::SymbolRefAttr attr) { getProperties().base_type = attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::SymbolRefAttr base_type, ::mlir::ValueRange args); static ParametricOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::SymbolRefAttr base_type, ::mlir::ValueRange args); static ParametricOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::SymbolRefAttr base_type, ::mlir::ValueRange args); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::SymbolRefAttr base_type, ::mlir::ValueRange args); static ParametricOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::SymbolRefAttr base_type, ::mlir::ValueRange args); static ParametricOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::SymbolRefAttr base_type, ::mlir::ValueRange args); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr base_type, ::mlir::ValueRange args); static ParametricOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr base_type, ::mlir::ValueRange args); static ParametricOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr base_type, ::mlir::ValueRange args); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ParametricOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ParametricOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ParametricOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ParametricOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ParametricOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ParametricOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ParametricOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ParametricOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); std::unique_ptr<::mlir::irdl::Constraint> getVerifier(::mlir::ArrayRef valueToConstr, ::mlir::DenseMap<::mlir::irdl::TypeOp, std::unique_ptr<::mlir::DynamicTypeDefinition>> const&types, ::mlir::DenseMap<::mlir::irdl::AttributeOp, std::unique_ptr<::mlir::DynamicAttrDefinition>> const&attrs); ::llvm::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 1 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::ParametricOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::detail::ParametricOpGenericAdaptorBase::Properties) namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::RegionOp declarations //===----------------------------------------------------------------------===// namespace detail { class RegionOpGenericAdaptorBase { public: struct Properties { using constrainedArgumentsTy = ::mlir::UnitAttr; constrainedArgumentsTy constrainedArguments; auto getConstrainedArguments() const { auto &propStorage = this->constrainedArguments; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setConstrainedArguments(const ::mlir::UnitAttr &propValue) { this->constrainedArguments = propValue; } using numberOfBlocksTy = ::mlir::IntegerAttr; numberOfBlocksTy numberOfBlocks; auto getNumberOfBlocks() const { auto &propStorage = this->numberOfBlocks; return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); } void setNumberOfBlocks(const ::mlir::IntegerAttr &propValue) { this->numberOfBlocks = propValue; } bool operator==(const Properties &rhs) const { return rhs.constrainedArguments == this->constrainedArguments && rhs.numberOfBlocks == this->numberOfBlocks && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: RegionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.region", odsAttrs.getContext()); } RegionOpGenericAdaptorBase(RegionOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::IntegerAttr getNumberOfBlocksAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().numberOfBlocks); return attr; } ::std::optional getNumberOfBlocks(); ::mlir::UnitAttr getConstrainedArgumentsAttr(); bool getConstrainedArguments(); }; } // namespace detail template class RegionOpGenericAdaptor : public detail::RegionOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::RegionOpGenericAdaptorBase; static constexpr int odsIndex_entryBlockArgs = 0; public: RegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} RegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : RegionOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} RegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : RegionOpGenericAdaptor(values, attrs, Properties{}, {}) {} RegionOpGenericAdaptor(RangeT values, const RegionOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> RegionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getEntryBlockArgs() { return getODSOperands(0); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class RegionOpAdaptor : public RegionOpGenericAdaptor<::mlir::ValueRange> { public: using RegionOpGenericAdaptor::RegionOpGenericAdaptor; RegionOpAdaptor(RegionOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class RegionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::irdl::VerifyRegionInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = RegionOpAdaptor; template using GenericAdaptor = RegionOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_entryBlockArgs = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("constrainedArguments"), ::llvm::StringRef("numberOfBlocks")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getConstrainedArgumentsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getConstrainedArgumentsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getNumberOfBlocksAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getNumberOfBlocksAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.region"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getEntryBlockArgs() { return getODSOperands(0); } ::mlir::MutableOperandRange getEntryBlockArgsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::TypedValue<::mlir::irdl::RegionType> getOutput() { return ::llvm::cast<::mlir::TypedValue<::mlir::irdl::RegionType>>(*getODSResults(0).begin()); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::IntegerAttr getNumberOfBlocksAttr() { return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(getProperties().numberOfBlocks); } ::std::optional getNumberOfBlocks(); ::mlir::UnitAttr getConstrainedArgumentsAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().constrainedArguments); } bool getConstrainedArguments(); void setNumberOfBlocksAttr(::mlir::IntegerAttr attr) { getProperties().numberOfBlocks = attr; } void setNumberOfBlocks(::std::optional attrValue); void setConstrainedArgumentsAttr(::mlir::UnitAttr attr) { getProperties().constrainedArguments = attr; } void setConstrainedArguments(bool attrValue); ::mlir::Attribute removeNumberOfBlocksAttr() { auto attr = getProperties().numberOfBlocks; getProperties().numberOfBlocks = {}; return attr; } ::mlir::Attribute removeConstrainedArgumentsAttr() { auto attr = getProperties().constrainedArguments; getProperties().constrainedArguments = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/::mlir::UnitAttr constrainedArguments); static RegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/::mlir::UnitAttr constrainedArguments); static RegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/::mlir::UnitAttr constrainedArguments); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/::mlir::UnitAttr constrainedArguments); static RegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/::mlir::UnitAttr constrainedArguments); static RegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/::mlir::UnitAttr constrainedArguments); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/::mlir::UnitAttr constrainedArguments); static RegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/::mlir::UnitAttr constrainedArguments); static RegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/::mlir::UnitAttr constrainedArguments); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/bool constrainedArguments = false); static RegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type output, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/bool constrainedArguments = false); static RegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type output, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/bool constrainedArguments = false); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/bool constrainedArguments = false); static RegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/bool constrainedArguments = false); static RegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/bool constrainedArguments = false); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/bool constrainedArguments = false); static RegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/bool constrainedArguments = false); static RegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange entryBlockArgs, /*optional*/::mlir::IntegerAttr numberOfBlocks, /*optional*/bool constrainedArguments = false); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static RegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static RegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static RegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static RegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static RegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static RegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static RegionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static RegionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::PropertyRef properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); std::unique_ptr<::mlir::irdl::RegionConstraint> getVerifier(::mlir::ArrayRef valueToConstr, ::mlir::DenseMap<::mlir::irdl::TypeOp, std::unique_ptr<::mlir::DynamicTypeDefinition>> const&types, ::mlir::DenseMap<::mlir::irdl::AttributeOp, std::unique_ptr<::mlir::DynamicAttrDefinition>> const&attrs); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::RegionOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::detail::RegionOpGenericAdaptorBase::Properties) namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::RegionsOp declarations //===----------------------------------------------------------------------===// namespace detail { class RegionsOpGenericAdaptorBase { public: struct Properties { using namesTy = ::mlir::ArrayAttr; namesTy names; auto getNames() const { auto &propStorage = this->names; return ::llvm::cast<::mlir::ArrayAttr>(propStorage); } void setNames(const ::mlir::ArrayAttr &propValue) { this->names = propValue; } bool operator==(const Properties &rhs) const { return rhs.names == this->names && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: RegionsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.regions", odsAttrs.getContext()); } RegionsOpGenericAdaptorBase(RegionsOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getNamesAttr() { auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().names); return attr; } ::mlir::ArrayAttr getNames(); }; } // namespace detail template class RegionsOpGenericAdaptor : public detail::RegionsOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::RegionsOpGenericAdaptorBase; static constexpr int odsIndex_args = 0; public: RegionsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} RegionsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : RegionsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} RegionsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : RegionsOpGenericAdaptor(values, attrs, Properties{}, {}) {} RegionsOpGenericAdaptor(RangeT values, const RegionsOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> RegionsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getArgs() { return getODSOperands(0); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class RegionsOpAdaptor : public RegionsOpGenericAdaptor<::mlir::ValueRange> { public: using RegionsOpGenericAdaptor::RegionsOpGenericAdaptor; RegionsOpAdaptor(RegionsOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class RegionsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = RegionsOpAdaptor; template using GenericAdaptor = RegionsOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_args = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("names")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getNamesAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getNamesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.regions"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getArgs() { return getODSOperands(0); } ::mlir::MutableOperandRange getArgsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::ArrayAttr getNamesAttr() { return ::llvm::cast<::mlir::ArrayAttr>(getProperties().names); } ::mlir::ArrayAttr getNames(); void setNamesAttr(::mlir::ArrayAttr attr) { getProperties().names = attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange args, ::mlir::ArrayAttr names); static RegionsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange args, ::mlir::ArrayAttr names); static RegionsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange args, ::mlir::ArrayAttr names); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names); static RegionsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names); static RegionsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static RegionsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static RegionsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static RegionsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static RegionsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 1 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::RegionsOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::detail::RegionsOpGenericAdaptorBase::Properties) namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::ResultsOp declarations //===----------------------------------------------------------------------===// namespace detail { class ResultsOpGenericAdaptorBase { public: struct Properties { using namesTy = ::mlir::ArrayAttr; namesTy names; auto getNames() const { auto &propStorage = this->names; return ::llvm::cast<::mlir::ArrayAttr>(propStorage); } void setNames(const ::mlir::ArrayAttr &propValue) { this->names = propValue; } using variadicityTy = ::mlir::irdl::VariadicityArrayAttr; variadicityTy variadicity; auto getVariadicity() const { auto &propStorage = this->variadicity; return ::llvm::cast<::mlir::irdl::VariadicityArrayAttr>(propStorage); } void setVariadicity(const ::mlir::irdl::VariadicityArrayAttr &propValue) { this->variadicity = propValue; } bool operator==(const Properties &rhs) const { return rhs.names == this->names && rhs.variadicity == this->variadicity && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: ResultsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.results", odsAttrs.getContext()); } ResultsOpGenericAdaptorBase(ResultsOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::ArrayAttr getNamesAttr() { auto attr = ::llvm::cast<::mlir::ArrayAttr>(getProperties().names); return attr; } ::mlir::ArrayAttr getNames(); ::mlir::irdl::VariadicityArrayAttr getVariadicityAttr() { auto attr = ::llvm::cast<::mlir::irdl::VariadicityArrayAttr>(getProperties().variadicity); return attr; } ::llvm::ArrayRef getVariadicity(); }; } // namespace detail template class ResultsOpGenericAdaptor : public detail::ResultsOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ResultsOpGenericAdaptorBase; static constexpr int odsIndex_args = 0; public: ResultsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ResultsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ResultsOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ResultsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ResultsOpGenericAdaptor(values, attrs, Properties{}, {}) {} ResultsOpGenericAdaptor(RangeT values, const ResultsOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ResultsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getArgs() { return getODSOperands(0); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ResultsOpAdaptor : public ResultsOpGenericAdaptor<::mlir::ValueRange> { public: using ResultsOpGenericAdaptor::ResultsOpGenericAdaptor; ResultsOpAdaptor(ResultsOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ResultsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ResultsOpAdaptor; template using GenericAdaptor = ResultsOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_args = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("names"), ::llvm::StringRef("variadicity")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getNamesAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getNamesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getVariadicityAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getVariadicityAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.results"); } std::pair getODSOperandIndexAndLength(unsigned index); ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } ::mlir::Operation::operand_range getArgs() { return getODSOperands(0); } ::mlir::MutableOperandRange getArgsMutable(); std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::ArrayAttr getNamesAttr() { return ::llvm::cast<::mlir::ArrayAttr>(getProperties().names); } ::mlir::ArrayAttr getNames(); ::mlir::irdl::VariadicityArrayAttr getVariadicityAttr() { return ::llvm::cast<::mlir::irdl::VariadicityArrayAttr>(getProperties().variadicity); } ::llvm::ArrayRef getVariadicity(); void setNamesAttr(::mlir::ArrayAttr attr) { getProperties().names = attr; } void setVariadicityAttr(::mlir::irdl::VariadicityArrayAttr attr) { getProperties().variadicity = attr; } void setVariadicity(::llvm::ArrayRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::mlir::irdl::VariadicityArrayAttr variadicity); static ResultsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::mlir::irdl::VariadicityArrayAttr variadicity); static ResultsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::mlir::irdl::VariadicityArrayAttr variadicity); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::mlir::irdl::VariadicityArrayAttr variadicity); static ResultsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::mlir::irdl::VariadicityArrayAttr variadicity); static ResultsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::mlir::irdl::VariadicityArrayAttr variadicity); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::llvm::ArrayRef variadicity); static ResultsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::llvm::ArrayRef variadicity); static ResultsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::llvm::ArrayRef variadicity); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::llvm::ArrayRef variadicity); static ResultsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::llvm::ArrayRef variadicity); static ResultsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names, ::llvm::ArrayRef variadicity); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ResultsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ResultsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ResultsOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ResultsOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 2 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::ResultsOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::detail::ResultsOpGenericAdaptorBase::Properties) namespace mlir::irdl { //===----------------------------------------------------------------------===// // ::mlir::irdl::TypeOp declarations //===----------------------------------------------------------------------===// namespace detail { class TypeOpGenericAdaptorBase { public: struct Properties { using sym_nameTy = ::mlir::StringAttr; sym_nameTy sym_name; auto getSymName() const { auto &propStorage = this->sym_name; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setSymName(const ::mlir::StringAttr &propValue) { this->sym_name = propValue; } bool operator==(const Properties &rhs) const { return rhs.sym_name == this->sym_name && true; } bool operator!=(const Properties &rhs) const { return !(*this == rhs); } }; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: TypeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("irdl.type", odsAttrs.getContext()); } TypeOpGenericAdaptorBase(TypeOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getSymNameAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); return attr; } ::llvm::StringRef getSymName(); ::mlir::Region &getBody() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class TypeOpGenericAdaptor : public detail::TypeOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::TypeOpGenericAdaptorBase; public: TypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} TypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : TypeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} TypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : TypeOpGenericAdaptor(values, attrs, Properties{}, {}) {} TypeOpGenericAdaptor(RangeT values, const TypeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> TypeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} std::pair getODSOperandIndexAndLength(unsigned index) { return Base::getODSOperandIndexAndLength(index, odsOperands.size()); } RangeT getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(odsOperands.begin(), valueRange.first), std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class TypeOpAdaptor : public TypeOpGenericAdaptor<::mlir::ValueRange> { public: using TypeOpGenericAdaptor::TypeOpGenericAdaptor; TypeOpAdaptor(TypeOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class TypeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::NoTerminator, ::mlir::OpTrait::NoRegionArguments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::AtMostOneChildOf::Impl, ::mlir::SymbolOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove> { public: using Op::Op; using Op::print; using Adaptor = TypeOpAdaptor; template using GenericAdaptor = TypeOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("sym_name")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getSymNameAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("irdl.type"); } std::pair getODSOperandIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::operand_range getODSOperands(unsigned index) { auto valueRange = getODSOperandIndexAndLength(index); return {std::next(getOperation()->operand_begin(), valueRange.first), std::next(getOperation()->operand_begin(), valueRange.first + valueRange.second)}; } std::pair getODSResultIndexAndLength(unsigned index) { return {index, 1}; } ::mlir::Operation::result_range getODSResults(unsigned index) { auto valueRange = getODSResultIndexAndLength(index); return {std::next(getOperation()->result_begin(), valueRange.first), std::next(getOperation()->result_begin(), valueRange.first + valueRange.second)}; } ::mlir::Region &getBody() { return (*this)->getRegion(0); } static ::llvm::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); static llvm::hash_code computePropertiesHash(const Properties &prop); static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); static ::llvm::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); static ::llvm::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); void writeProperties(::mlir::DialectBytecodeWriter &writer); ::mlir::StringAttr getSymNameAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().sym_name); } ::llvm::StringRef getSymName(); void setSymNameAttr(::mlir::StringAttr attr) { getProperties().sym_name = attr; } void setSymName(::llvm::StringRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name); static TypeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name); static TypeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static TypeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static TypeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name); static TypeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name); static TypeOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static TypeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static TypeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static TypeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static TypeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static TypeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static TypeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 1 && "invalid attribute index"); assert(name.getStringRef() == getOperationName() && "invalid operation name"); assert(name.isRegistered() && "Operation isn't registered, missing a " "dependent dialect loading?"); return name.getAttributeNames()[index]; } public: }; } // namespace mlir::irdl MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::TypeOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::irdl::detail::TypeOpGenericAdaptorBase::Properties) #endif // GET_OP_CLASSES