/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* Op Declarations *| |* *| |* Automatically generated file, do not edit! *| |* From: EmitC.td *| |* *| \*===----------------------------------------------------------------------===*/ namespace mlir::emitc { /// Addition operation /// With the `emitc.add` operation the arithmetic operator + (addition) can /// be applied. /// /// Example: /// /// ```mlir /// // Custom form of the addition operation. /// %0 = emitc.add %arg0, %arg1 : (i32, i32) -> i32 /// %1 = emitc.add %arg2, %arg3 : (!emitc.ptr, i32) -> !emitc.ptr /// ``` /// ```c++ /// // Code emitted for the operations above. /// int32_t v5 = v1 + v2; /// float* v6 = v3 + v4; /// ``` class AddOp; } // namespace mlir::emitc namespace mlir::emitc { /// Address operation /// This operation models the C & (address of) operator for a single operand, /// which must be an emitc.lvalue, and returns an emitc pointer to its location. /// /// Example: /// /// ```mlir /// // Custom form of applying the & operator. /// %0 = emitc.address_of %arg0 : (!emitc.lvalue) -> !emitc.ptr /// ``` class AddressOfOp; } // namespace mlir::emitc namespace mlir::emitc { /// Assign operation /// The `emitc.assign` operation stores an SSA value to the location designated by an /// EmitC variable. This operation doesn't return any value. The assigned value /// must be of the same type as the variable being assigned. The operation is /// emitted as a C/C++ '=' operator. /// /// Example: /// /// ```mlir /// // Integer variable /// %0 = "emitc.variable"(){value = 42 : i32} : () -> !emitc.lvalue /// %1 = emitc.call_opaque "foo"() : () -> (i32) /// /// // Assign emitted as `... = ...;` /// "emitc.assign"(%0, %1) : (!emitc.lvalue, i32) -> () /// ``` class AssignOp; } // namespace mlir::emitc namespace mlir::emitc { /// Bitwise and operation /// With the `emitc.bitwise_and` operation the bitwise operator & (and) can /// be applied. /// /// Example: /// /// ```mlir /// %0 = emitc.bitwise_and %arg0, %arg1 : (i32, i32) -> i32 /// ``` /// ```c++ /// // Code emitted for the operation above. /// int32_t v3 = v1 & v2; /// ``` class BitwiseAndOp; } // namespace mlir::emitc namespace mlir::emitc { /// Bitwise left shift operation /// With the `emitc.bitwise_left_shift` operation the bitwise operator << /// (left shift) can be applied. /// /// Example: /// /// ```mlir /// %0 = emitc.bitwise_left_shift %arg0, %arg1 : (i32, i32) -> i32 /// ``` /// ```c++ /// // Code emitted for the operation above. /// int32_t v3 = v1 << v2; /// ``` class BitwiseLeftShiftOp; } // namespace mlir::emitc namespace mlir::emitc { /// Bitwise not operation /// With the `emitc.bitwise_not` operation the bitwise operator ~ (not) can /// be applied. /// /// Example: /// /// ```mlir /// %0 = emitc.bitwise_not %arg0 : (i32) -> i32 /// ``` /// ```c++ /// // Code emitted for the operation above. /// int32_t v2 = ~v1; /// ``` class BitwiseNotOp; } // namespace mlir::emitc namespace mlir::emitc { /// Bitwise or operation /// With the `emitc.bitwise_or` operation the bitwise operator | (or) /// can be applied. /// /// Example: /// /// ```mlir /// %0 = emitc.bitwise_or %arg0, %arg1 : (i32, i32) -> i32 /// ``` /// ```c++ /// // Code emitted for the operation above. /// int32_t v3 = v1 | v2; /// ``` class BitwiseOrOp; } // namespace mlir::emitc namespace mlir::emitc { /// Bitwise right shift operation /// With the `emitc.bitwise_right_shift` operation the bitwise operator >> /// (right shift) can be applied. /// /// Example: /// /// ```mlir /// %0 = emitc.bitwise_right_shift %arg0, %arg1 : (i32, i32) -> i32 /// ``` /// ```c++ /// // Code emitted for the operation above. /// int32_t v3 = v1 >> v2; /// ``` class BitwiseRightShiftOp; } // namespace mlir::emitc namespace mlir::emitc { /// Bitwise xor operation /// With the `emitc.bitwise_xor` operation the bitwise operator ^ (xor) /// can be applied. /// /// Example: /// /// ```mlir /// %0 = emitc.bitwise_xor %arg0, %arg1 : (i32, i32) -> i32 /// ``` /// ```c++ /// // Code emitted for the operation above. /// int32_t v3 = v1 ^ v2; /// ``` class BitwiseXorOp; } // namespace mlir::emitc namespace mlir::emitc { /// Call operation /// The `emitc.call` operation represents a direct call to an `emitc.func` /// that is within the same symbol scope as the call. The operands and result type /// of the call must match the specified function type. The callee is encoded as a /// symbol reference attribute named "callee". /// /// Example: /// /// ```mlir /// %2 = emitc.call @my_add(%0, %1) : (f32, f32) -> f32 /// ``` class CallOp; } // namespace mlir::emitc namespace mlir::emitc { /// Opaque call operation /// The `emitc.call_opaque` operation represents a C++ function call. The callee /// can be an arbitrary non-empty string. The call allows specifying order /// of operands and attributes in the call as follows: /// /// - integer value of index type refers to an operand; /// - attribute which will get lowered to constant value in call; /// /// Example: /// /// ```mlir /// // Custom form defining a call to `foo()`. /// %0 = emitc.call_opaque "foo" () : () -> i32 /// /// // Generic form of the same operation. /// %0 = "emitc.call_opaque"() {callee = "foo"} : () -> i32 /// ``` class CallOpaqueOp; } // namespace mlir::emitc namespace mlir::emitc { /// Cast operation /// The `emitc.cast` operation performs an explicit type conversion and is emitted /// as a C-style cast expression. It can be applied to integer, float, index /// and EmitC types. /// /// Example: /// /// ```mlir /// // Cast from `int32_t` to `float` /// %0 = emitc.cast %arg0: i32 to f32 /// /// // Cast from `void` to `int32_t` pointer /// %1 = emitc.cast %arg1 : /// !emitc.ptr> to !emitc.ptr /// ``` /// /// In general, C++ cast expressions cannot always be assumed to be pure: /// they may invoke user-defined conversions or be affected by floating-point /// environment settings. However, in many practical cases, such as integer /// casts without operator overloading, the cast is pure and can be treated as /// speculatable and side-effect-free. For such cases, the `pure` attribute /// may be used. /// /// When `pure` attribute is set, `getSpeculatability()` returns `Speculatable` /// and `getEffects()` reports no effects. It is UB if the `pure` attribute is /// set and the actual conversion is not pure, e.g. when the user-defined /// conversion has memory effects. class CastOp; } // namespace mlir::emitc namespace mlir::emitc { /// Represents a C++ class definition, encapsulating fields and methods. /// The `emitc.class` operation defines a C++ class, acting as a container /// for its data fields (`emitc.field`) and methods (`emitc.func`). /// It creates a distinct scope, isolating its contents from the surrounding /// MLIR region, similar to how C++ classes encapsulate their internals. /// /// Example: /// /// ```mlir /// emitc.class @modelClass { /// emitc.field @fieldName0 : !emitc.array<1xf32> = {emitc.opaque = "input_tensor"} /// emitc.func @execute() { /// %0 = "emitc.constant"() <{value = 0 : index}> : () -> !emitc.size_t /// %1 = get_field @fieldName0 : !emitc.array<1xf32> /// %2 = subscript %1[%0] : (!emitc.array<1xf32>, !emitc.size_t) -> !emitc.lvalue /// return /// } /// } /// // Class with a final specifer /// emitc.class final @modelClass { /// emitc.field @fieldName0 : !emitc.array<1xf32> = {emitc.opaque = "input_tensor"} /// emitc.func @execute() { /// %0 = "emitc.constant"() <{value = 0 : index}> : () -> !emitc.size_t /// %1 = get_field @fieldName0 : !emitc.array<1xf32> /// %2 = subscript %1[%0] : (!emitc.array<1xf32>, !emitc.size_t) -> !emitc.lvalue /// return /// } /// } /// ``` class ClassOp; } // namespace mlir::emitc namespace mlir::emitc { /// Comparison operation /// With the `emitc.cmp` operation the comparison operators ==, !=, <, <=, >, >=, <=> /// can be applied. /// /// Its first argument is an attribute that defines the comparison operator: /// /// - equal to (mnemonic: `"eq"`; integer value: `0`) /// - not equal to (mnemonic: `"ne"`; integer value: `1`) /// - less than (mnemonic: `"lt"`; integer value: `2`) /// - less than or equal to (mnemonic: `"le"`; integer value: `3`) /// - greater than (mnemonic: `"gt"`; integer value: `4`) /// - greater than or equal to (mnemonic: `"ge"`; integer value: `5`) /// - three-way-comparison (mnemonic: `"three_way"`; integer value: `6`) /// /// Example: /// ```mlir /// // Custom form of the cmp operation. /// %0 = emitc.cmp eq, %arg0, %arg1 : (i32, i32) -> i1 /// %1 = emitc.cmp lt, %arg2, %arg3 : /// ( /// !emitc.opaque<"std::valarray">, /// !emitc.opaque<"std::valarray"> /// ) -> !emitc.opaque<"std::valarray"> /// ``` /// ```c++ /// // Code emitted for the operations above. /// bool v5 = v1 == v2; /// std::valarray v6 = v3 < v4; /// ``` class CmpOp; } // namespace mlir::emitc namespace mlir::emitc { /// Conditional (ternary) operation /// With the `emitc.conditional` operation the ternary conditional operator can /// be applied. /// /// Example: /// /// ```mlir /// %0 = emitc.cmp gt, %arg0, %arg1 : (i32, i32) -> i1 /// /// %c0 = "emitc.constant"() {value = 10 : i32} : () -> i32 /// %c1 = "emitc.constant"() {value = 11 : i32} : () -> i32 /// /// %1 = emitc.conditional %0, %c0, %c1 : i32 /// ``` /// ```c++ /// // Code emitted for the operations above. /// bool v3 = v1 > v2; /// int32_t v4 = 10; /// int32_t v5 = 11; /// int32_t v6 = v3 ? v4 : v5; /// ``` class ConditionalOp; } // namespace mlir::emitc namespace mlir::emitc { /// Constant operation /// The `emitc.constant` operation produces an SSA value equal to some constant /// specified by an attribute. This can be used to form simple integer and /// floating point constants, as well as more exotic things like tensor /// constants. The `emitc.constant` operation also supports the EmitC opaque /// attribute and the EmitC opaque type. Since folding is supported, /// it should not be used with pointers. /// /// Example: /// /// ```mlir /// // Integer constant /// %0 = "emitc.constant"(){value = 42 : i32} : () -> i32 /// /// // Constant emitted as `char = CHAR_MIN;` /// %1 = "emitc.constant"() {value = #emitc.opaque<"CHAR_MIN">} /// : () -> !emitc.opaque<"char"> /// ``` class ConstantOp; } // namespace mlir::emitc namespace mlir::emitc { /// An operation to declare a function /// The `emitc.declare_func` operation allows to insert a function declaration for an /// `emitc.func` at a specific position. The operation only requires the "callee" /// of the `emitc.func` to be specified as an attribute. /// /// Example: /// /// ```mlir /// emitc.declare_func @bar /// emitc.func @foo(%arg0: i32) -> i32 { /// %0 = emitc.call @bar(%arg0) : (i32) -> (i32) /// emitc.return %0 : i32 /// } /// /// emitc.func @bar(%arg0: i32) -> i32 { /// emitc.return %arg0 : i32 /// } /// ``` /// /// ```c++ /// // Code emitted for the operations above. /// int32_t bar(int32_t v1); /// int32_t foo(int32_t v1) { /// int32_t v2 = bar(v1); /// return v2; /// } /// /// int32_t bar(int32_t v1) { /// return v1; /// } /// ``` class DeclareFuncOp; } // namespace mlir::emitc namespace mlir::emitc { /// Dereference operation /// This operation models the C * (dereference) operator, which must be of /// !emitc.ptr<> type, returning an !emitc.lvalue<> the value pointed to by the /// pointer. /// /// Example: /// /// ```mlir /// // Custom form of the dereference operator. /// %0 = emitc.dereference %arg0 : (!emitc.ptr) -> !emitc.lvalue /// ``` class DereferenceOp; } // namespace mlir::emitc namespace mlir::emitc { /// Division operation /// With the `emitc.div` operation the arithmetic operator / (division) can /// be applied. /// /// Example: /// /// ```mlir /// // Custom form of the division operation. /// %0 = emitc.div %arg0, %arg1 : (i32, i32) -> i32 /// %1 = emitc.div %arg2, %arg3 : (f32, f32) -> f32 /// ``` /// ```c++ /// // Code emitted for the operations above. /// int32_t v5 = v1 / v2; /// float v6 = v3 / v4; /// ``` class DivOp; } // namespace mlir::emitc namespace mlir::emitc { /// Do-while operation /// The `emitc.do` operation represents a C/C++ do-while loop construct that /// repeatedly executes a body region as long as a condition region evaluates to /// true. The operation has two regions: /// /// 1. A body region that contains the loop body /// 2. A condition region that must yield a boolean value (i1) /// /// The condition is evaluated before each iteration as follows: /// - The condition region must contain exactly one block with: /// 1. An `emitc.expression` operation producing an i1 value /// 2. An `emitc.yield` passing through the expression result /// - The expression's body contains the actual condition logic /// /// The body region is executed before the first evaluation of the /// condition. Thus, there is a guarantee that the loop will be executed /// at least once. The loop terminates when the condition yields false. /// /// The canonical structure of `emitc.do` is: /// /// ```mlir /// emitc.do { /// // Body region (no terminator required). /// // Loop body operations... /// } while { /// // Condition region (must yield i1) /// %condition = emitc.expression : () -> i1 { /// // Condition computation... /// %result = ... : i1 // Last operation must produce i1 /// emitc.yield %result : i1 /// } /// // Forward expression result /// emitc.yield %condition : i1 /// } /// ``` /// /// Example: /// /// ```mlir /// emitc.func @do_example() { /// %counter = "emitc.variable"() <{value = 0 : i32}> : () -> !emitc.lvalue /// %end = emitc.literal "10" : i32 /// %step = emitc.literal "1" : i32 /// /// emitc.do { /// // Print current value /// %val = emitc.load %counter : !emitc.lvalue /// emitc.verbatim "printf(\"%d\\n\", {});" args %val : i32 /// /// // Increment counter /// %new_val = emitc.add %val, %step : (i32, i32) -> i32 /// "emitc.assign"(%counter, %new_val) : (!emitc.lvalue, i32) -> () /// } while { /// %condition = emitc.expression %counter, %end : (!emitc.lvalue, i32) -> i1 { /// %current = emitc.load %counter : !emitc.lvalue /// %cmp_res = emitc.cmp lt, %current, %end : (i32, i32) -> i1 /// emitc.yield %cmp_res : i1 /// } /// emitc.yield %condition : i1 /// } /// return /// } /// ``` /// ```c++ /// // Code emitted for the operation above. /// void do_example() { /// int32_t v1 = 0; /// do { /// int32_t v2 = v1; /// printf("%d\n", v2); /// int32_t v3 = v2 + 1; /// v1 = v3; /// } while (v1 < 10); /// return; /// } /// ``` class DoOp; } // namespace mlir::emitc namespace mlir::emitc { /// Expression operation /// The `emitc.expression` operation returns a single SSA value which is yielded by /// its single-basic-block region. The operation takes zero or more input operands /// that are passed as block arguments to the region. /// /// As the operation is to be emitted as a C expression, the operations within /// its body must form a single Def-Use tree, or a DAG trivially expandable to /// one, i.e. a DAG where each operation with side effects is only reachable /// once from the expression root. /// /// Input operands can be of both value types (`EmitCType`) and lvalue types /// (`EmitC_LValueType`). /// /// Example: /// ```mlir /// %r = emitc.expression %a, %b, %c : (i32, i32, i32) -> i32 { /// %0 = emitc.call_opaque "foo"(%a) : (i32) -> i32 /// %1 = emitc.add %b, %c : (i32, i32) -> i32 /// %2 = emitc.mul %0, %1 : (i32, i32) -> i32 /// emitc.yield %2 : i32 /// } /// ``` /// /// May be emitted as: /// ```c++ /// int32_t v4 = foo(v1) * (v2 + v3); /// ``` /// /// When specified, the optional `noinline` indicates that the expression is /// to be emitted as seen above, i.e. as the rhs of an EmitC SSA value /// definition. Otherwise, the expression may be emitted inline, i.e. directly /// at its use. class ExpressionOp; } // namespace mlir::emitc namespace mlir::emitc { /// A field within a class /// The `emitc.field` operation declares a named field within an `emitc.class` /// operation. The field's type must be an EmitC type. /// /// Example: /// /// ```mlir /// // Example with an attribute: /// emitc.field @fieldName0 : !emitc.array<1xf32> {emitc.opaque = "another_feature"} /// // Example with no attribute: /// emitc.field @fieldName0 : !emitc.array<1xf32> /// // Example with an initial value: /// emitc.field @fieldName0 : !emitc.array<1xf32> = dense<0.0> /// // Example with an initial value and attributes: /// emitc.field @fieldName0 : !emitc.array<1xf32> = dense<0.0> { /// emitc.opaque = "input_tensor"} /// ``` class FieldOp; } // namespace mlir::emitc namespace mlir::emitc { /// A file container operation /// A `file` represents a single C/C++ file. /// /// `mlir-translate` ignores the body of all `emitc.file` ops /// unless the `-file-id=id` flag is used. With that flag, all `emitc.file` ops /// with matching id are emitted. /// /// Example: /// /// ```mlir /// emitc.file "main" { /// emitc.func @func_one() { /// emitc.return /// } /// } /// ``` class FileOp; } // namespace mlir::emitc namespace mlir::emitc { /// For operation /// The `emitc.for` operation represents a C loop of the following form: /// /// ```c++ /// for (T i = lb; i < ub; i += step) { /* ... */ } // where T is typeof(lb) /// ``` /// /// The operation takes 3 SSA values as operands that represent the lower bound, /// upper bound and step respectively, and defines an SSA value for its /// induction variable. It has one region capturing the loop body. The induction /// variable is represented as an argument of this region. This SSA value is a /// signless integer, or an index. The step is a value of same type. /// /// This operation has no result. The body region must contain exactly one block /// that terminates with `emitc.yield`. Calling ForOp::build will create such a /// region and insert the terminator implicitly if none is defined, so will the /// parsing even in cases when it is absent from the custom format. For example: /// /// ```mlir /// // Index case. /// emitc.for %iv = %lb to %ub step %step { /// ... // body /// } /// ... /// // Integer case. /// emitc.for %iv_32 = %lb_32 to %ub_32 step %step_32 : i32 { /// ... // body /// } /// ``` class ForOp; } // namespace mlir::emitc namespace mlir::emitc { /// An operation with a name containing a single `SSACFG` region /// Operations within the function cannot implicitly capture values defined /// outside of the function, i.e. Functions are `IsolatedFromAbove`. All /// external references must use function arguments or attributes that establish /// a symbolic connection (e.g. symbols referenced by name via a string /// attribute like SymbolRefAttr). While the MLIR textual form provides a nice /// inline syntax for function arguments, they are internally represented as /// “block arguments” to the first block in the region. /// /// Only dialect attribute names may be specified in the attribute dictionaries /// for function arguments, results, or the function itself. /// /// Example: /// /// ```mlir /// // A function with no results: /// emitc.func @foo(%arg0 : i32) { /// emitc.call_opaque "bar" (%arg0) : (i32) -> () /// emitc.return /// } /// /// // A function with its argument as single result: /// emitc.func @foo(%arg0 : i32) -> i32 { /// emitc.return %arg0 : i32 /// } /// /// // A function with specifiers attribute: /// emitc.func @example_specifiers_fn_attr() -> i32 /// attributes {specifiers = ["static","inline"]} { /// %0 = emitc.call_opaque "foo" (): () -> i32 /// emitc.return %0 : i32 /// } /// /// // An external function definition: /// emitc.func private @extern_func(i32) /// attributes {specifiers = ["extern"]} /// ``` class FuncOp; } // namespace mlir::emitc namespace mlir::emitc { /// Obtain access to a field within a class instance /// The `emitc.get_field` operation retrieves the lvalue of a /// named field from a given class instance. /// /// Example: /// /// ```mlir /// %0 = get_field @fieldName0 : !emitc.array<1xf32> /// ``` class GetFieldOp; } // namespace mlir::emitc namespace mlir::emitc { /// Obtain access to a global variable /// The `emitc.get_global` operation retrieves the lvalue of a /// named global variable. If the global variable is marked constant, assigning /// to that lvalue is undefined. /// /// Example: /// /// ```mlir /// %x = emitc.get_global @foo : !emitc.array<2xf32> /// %y = emitc.get_global @bar : !emitc.lvalue /// ``` class GetGlobalOp; } // namespace mlir::emitc namespace mlir::emitc { /// A global variable /// The `emitc.global` operation declares or defines a named global variable. /// The backing memory for the variable is allocated statically and described by /// the variable's type, which must be an EmitC type. /// Optionally, an `initial_value` can be provided. /// Internal linkage can be specified using the `static_specifier` unit attribute /// and external linkage can be specified using the `extern_specifier` unit attribute. /// Note that the default linkage without those two keywords depends on whether /// the target is C or C++ and whether the global variable is `const`. /// The global variable can also be marked constant using the `const_specifier` /// unit attribute. Writing to such constant global variables is /// undefined. /// /// The global variable can be accessed by using the `emitc.get_global` to /// retrieve the value for the global variable. /// /// Example: /// /// ```mlir /// // Global variable with an initial value. /// emitc.global @x : !emitc.array<2xf32> = dense<0.0> /// // Global variable with an initial values. /// emitc.global @x : !emitc.array<3xi32> = dense<[0, 1, 2]> /// // Global variable with an opaque initial value. /// emitc.global @x : !emitc.opaque<"char"> = #emitc.opaque<"CHAR_MIN"> /// // External global variable /// emitc.global extern @x : !emitc.array<2xf32> /// // Constant global variable with internal linkage /// emitc.global static const @x : i32 = 0 /// ``` class GlobalOp; } // namespace mlir::emitc namespace mlir::emitc { /// If-then-else operation /// The `emitc.if` operation represents an if-then-else construct for /// conditionally executing two regions of code. The operand to an if operation /// is a boolean value. For example: /// /// ```mlir /// emitc.if %b { /// ... /// } else { /// ... /// } /// ``` /// /// The "then" region has exactly 1 block. The "else" region may have 0 or 1 /// blocks. The blocks are always terminated with `emitc.yield`, which can be /// left out to be inserted implicitly. This operation doesn't produce any /// results. class IfOp; } // namespace mlir::emitc namespace mlir::emitc { /// Include operation /// The `emitc.include` operation allows to define a source file inclusion via the /// `#include` directive. /// /// Example: /// /// ```mlir /// // Custom form defining the inclusion of ``. /// emitc.include <"myheader.h"> /// /// // Generic form of the same operation. /// "emitc.include" (){include = "myheader.h", is_standard_include} : () -> () /// /// // Custom form defining the inclusion of `"myheader"`. /// emitc.include "myheader.h" /// /// // Generic form of the same operation. /// "emitc.include" (){include = "myheader.h"} : () -> () /// ``` class IncludeOp; } // namespace mlir::emitc namespace mlir::emitc { /// Literal operation /// The `emitc.literal` operation produces an SSA value equal to some constant /// specified by an attribute. /// /// Example: /// /// ```mlir /// %p0 = emitc.literal "M_PI" : f32 /// %1 = "emitc.add" (%arg0, %p0) : (f32, f32) -> f32 /// ``` /// ```c++ /// // Code emitted for the operation above. /// float v2 = v1 + M_PI; /// ``` class LiteralOp; } // namespace mlir::emitc namespace mlir::emitc { /// Load an lvalue into an SSA value. /// This operation loads the content of a modifiable lvalue into an SSA value. /// Modifications of the lvalue executed after the load are not observable on /// the produced value. /// /// Example: /// /// ```mlir /// %1 = emitc.load %0 : !emitc.lvalue /// ``` /// ```c++ /// // Code emitted for the operation above. /// int32_t v2 = v1; /// ``` class LoadOp; } // namespace mlir::emitc namespace mlir::emitc { /// Logical and operation /// With the `emitc.logical_and` operation the logical operator && (and) can /// be applied. /// /// Example: /// /// ```mlir /// %0 = emitc.logical_and %arg0, %arg1 : i32, i32 /// ``` /// ```c++ /// // Code emitted for the operation above. /// bool v3 = v1 && v2; /// ``` class LogicalAndOp; } // namespace mlir::emitc namespace mlir::emitc { /// Logical not operation /// With the `emitc.logical_not` operation the logical operator ! (negation) can /// be applied. /// /// Example: /// /// ```mlir /// %0 = emitc.logical_not %arg0 : i32 /// ``` /// ```c++ /// // Code emitted for the operation above. /// bool v2 = !v1; /// ``` class LogicalNotOp; } // namespace mlir::emitc namespace mlir::emitc { /// Logical or operation /// With the `emitc.logical_or` operation the logical operator || (inclusive or) /// can be applied. /// /// Example: /// /// ```mlir /// %0 = emitc.logical_or %arg0, %arg1 : i32, i32 /// ``` /// ```c++ /// // Code emitted for the operation above. /// bool v3 = v1 || v2; /// ``` class LogicalOrOp; } // namespace mlir::emitc namespace mlir::emitc { /// Opaque member call operation /// The `emitc.member_call_opaque` operation represents a C++ member function /// call. It takes a receiver operand, a callee string attribute (the method /// name), and variadic operands for arguments. /// /// The call allows specifying order of operands and attributes in the call as /// follows: /// - integer value of index type refers to an argument operand; /// - attribute which will get lowered to constant value in call; /// /// Example: /// /// ```mlir /// %0 = emitc.member_call_opaque %receiver "method" (%arg0, %arg1) : !emitc.opaque<"MyClass">, (i32, i32) -> i32 /// ``` class MemberCallOpaqueOp; } // namespace mlir::emitc namespace mlir::emitc { /// Member of pointer operation /// With the `emitc.member_of_ptr` operation the member access operator `->` /// can be applied. /// /// Example: /// /// ```mlir /// %0 = "emitc.member_of_ptr" (%arg0) {member = "a"} /// : (!emitc.lvalue>>) /// -> !emitc.lvalue /// %1 = "emitc.member_of_ptr" (%arg0) {member = "b"} /// : (!emitc.lvalue>>) /// -> !emitc.array<2xi32> /// ``` class MemberOfPtrOp; } // namespace mlir::emitc namespace mlir::emitc { /// Member operation /// With the `emitc.member` operation the member access operator `.` can be /// applied. /// /// Example: /// /// ```mlir /// %0 = "emitc.member" (%arg0) {member = "a"} /// : (!emitc.opaque<"mystruct">) -> i32 /// %0 = "emitc.member" (%arg0) {member = "a"} /// : (!emitc.lvalue>) -> !emitc.lvalue /// %1 = "emitc.member" (%arg0) {member = "b"} /// : (!emitc.lvalue>) -> !emitc.array<2xi32> /// ``` class MemberOp; } // namespace mlir::emitc namespace mlir::emitc { /// Multiplication operation /// With the `emitc.mul` operation the arithmetic operator * (multiplication) can /// be applied. /// /// Example: /// /// ```mlir /// // Custom form of the multiplication operation. /// %0 = emitc.mul %arg0, %arg1 : (i32, i32) -> i32 /// %1 = emitc.mul %arg2, %arg3 : (f32, f32) -> f32 /// ``` /// ```c++ /// // Code emitted for the operations above. /// int32_t v5 = v1 * v2; /// float v6 = v3 * v4; /// ``` class MulOp; } // namespace mlir::emitc namespace mlir::emitc { /// Remainder operation /// With the `emitc.rem` operation the arithmetic operator % (remainder) can /// be applied. /// /// Example: /// /// ```mlir /// // Custom form of the remainder operation. /// %0 = emitc.rem %arg0, %arg1 : (i32, i32) -> i32 /// ``` /// ```c++ /// // Code emitted for the operation above. /// int32_t v5 = v1 % v2; /// ``` class RemOp; } // namespace mlir::emitc namespace mlir::emitc { /// Function return operation /// The `emitc.return` operation represents a return operation within a function. /// The operation takes zero or exactly one operand and produces no results. /// The operand number and type must match the signature of the function /// that contains the operation. /// /// Example: /// /// ```mlir /// emitc.func @foo() -> (i32) { /// ... /// emitc.return %0 : i32 /// } /// ``` class ReturnOp; } // namespace mlir::emitc namespace mlir::emitc { /// Subtraction operation /// With the `emitc.sub` operation the arithmetic operator - (subtraction) can /// be applied. /// /// Example: /// /// ```mlir /// // Custom form of the substraction operation. /// %0 = emitc.sub %arg0, %arg1 : (i32, i32) -> i32 /// %1 = emitc.sub %arg2, %arg3 : (!emitc.ptr, i32) -> !emitc.ptr /// %2 = emitc.sub %arg4, %arg5 : (!emitc.ptr, !emitc.ptr) /// -> !emitc.ptrdiff_t /// ``` /// ```c++ /// // Code emitted for the operations above. /// int32_t v7 = v1 - v2; /// float* v8 = v3 - v4; /// ptrdiff_t v9 = v5 - v6; /// ``` class SubOp; } // namespace mlir::emitc namespace mlir::emitc { /// Subscript operation /// With the `emitc.subscript` operation the subscript operator `[]` can be applied /// to variables or arguments of array, pointer and opaque type. /// /// Example: /// /// ```mlir /// %i = index.constant 1 /// %j = index.constant 7 /// %0 = emitc.subscript %arg0[%i, %j] : (!emitc.array<4x8xf32>, index, index) /// -> !emitc.lvalue /// %1 = emitc.subscript %arg1[%i] : (!emitc.ptr, index) /// -> !emitc.lvalue /// ``` class SubscriptOp; } // namespace mlir::emitc namespace mlir::emitc { /// Switch operation /// The `emitc.switch` is a control-flow operation that branches to one of /// the given regions based on the values of the argument and the cases. /// The operand to a switch operation is a opaque, integral or pointer /// wide types. /// /// The operation always has a "default" region and any number of case regions /// denoted by integer constants. Control-flow transfers to the case region /// whose constant value equals the value of the argument. If the argument does /// not equal any of the case values, control-flow transfer to the "default" /// region. /// /// The operation does not return any value. Moreover, case regions must be /// explicitly terminated using the `emitc.yield` operation. Default region is /// yielded implicitly. /// /// Example: /// /// ```mlir /// // Example: /// emitc.switch %0 : i32 /// case 2 { /// %1 = emitc.call_opaque "func_b" () : () -> i32 /// emitc.yield /// } /// case 5 { /// %2 = emitc.call_opaque "func_a" () : () -> i32 /// emitc.yield /// } /// default { /// %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32 /// emitc.call_opaque "func2" (%3) : (f32) -> () /// } /// ``` /// ```c++ /// // Code emitted for the operations above. /// switch (v1) { /// case 2: { /// int32_t v2 = func_b(); /// break; /// } /// case 5: { /// int32_t v3 = func_a(); /// break; /// } /// default: { /// float v4 = 4.200000000e+01f; /// func2(v4); /// break; /// } /// } /// ``` class SwitchOp; } // namespace mlir::emitc namespace mlir::emitc { /// Unary minus operation /// With the `emitc.unary_minus` operation the unary operator - (minus) can be /// applied. /// /// Example: /// /// ```mlir /// %0 = emitc.unary_minus %arg0 : (i32) -> i32 /// ``` /// ```c++ /// // Code emitted for the operation above. /// int32_t v2 = -v1; /// ``` class UnaryMinusOp; } // namespace mlir::emitc namespace mlir::emitc { /// Unary plus operation /// With the `emitc.unary_plus` operation the unary operator + (plus) can be /// applied. /// /// Example: /// /// ```mlir /// %0 = emitc.unary_plus %arg0 : (i32) -> i32 /// ``` /// ```c++ /// // Code emitted for the operation above. /// int32_t v2 = +v1; /// ``` class UnaryPlusOp; } // namespace mlir::emitc namespace mlir::emitc { /// Variable operation /// The `emitc.variable` operation produces an SSA value equal to some value /// specified by an attribute. This can be used to form simple integer and /// floating point variables, as well as more exotic things like tensor /// variables. The `emitc.variable` operation also supports the EmitC opaque /// attribute and the EmitC opaque type. If further supports the EmitC /// pointer type, whereas folding is not supported. /// The `emitc.variable` is emitted as a C/C++ local variable. /// /// Example: /// /// ```mlir /// // Integer variable /// %0 = "emitc.variable"(){value = 42 : i32} : () -> !emitc.lvalue /// /// // Variable emitted as `int32_t* = NULL;` /// %1 = "emitc.variable"() {value = #emitc.opaque<"NULL">} /// : () -> !emitc.lvalue>> /// ``` /// /// Since folding is not supported, it can be used with pointers. /// As an example, it is valid to create pointers to `variable` operations /// by using `address_of` operations and pass these to a `call` operation. /// ```mlir /// %0 = "emitc.variable"() {value = 0 : i32} : () -> !emitc.lvalue /// %1 = "emitc.variable"() {value = 0 : i32} : () -> !emitc.lvalue /// %2 = emitc.address_of %0 : !emitc.lvalue /// %3 = emitc.address_of %1 : !emitc.lvalue /// emitc.call_opaque "write"(%2, %3) /// : (!emitc.ptr, !emitc.ptr) -> () /// ``` class VariableOp; } // namespace mlir::emitc namespace mlir::emitc { /// Verbatim operation /// The `emitc.verbatim` operation produces no results and the value is emitted as is /// followed by a line break ('\n' character) during translation. /// /// Note: Use with caution. This operation can have arbitrary effects on the /// semantics of the emitted code. Use semantically more meaningful operations /// whenever possible. Additionally this op is *NOT* intended to be used to /// inject large snippets of code. /// /// This operation can be used in situations where a more suitable operation is /// not yet implemented in the dialect or where preprocessor directives /// interfere with the structure of the code. One example of this is to declare /// the linkage of external symbols to make the generated code usable in both C /// and C++ contexts: /// /// ```c++ /// #ifdef __cplusplus /// extern "C" { /// #endif /// /// ... /// /// #ifdef __cplusplus /// } /// #endif /// ``` /// /// If the `emitc.verbatim` op has operands, then the `value` is interpreted as /// format string, where `{}` is a placeholder for an operand in their order. /// For example, `emitc.verbatim "#pragma my src={} dst={}" %src, %dest : i32, i32` /// would be emitted as `#pragma my src=a dst=b` if `%src` became `a` and /// `%dest` became `b` in the C code. /// `{{` in the format string is interpreted as a single `{` and doesn't introduce /// a placeholder. /// /// Example: /// /// ```mlir /// emitc.verbatim "typedef float f32;" /// emitc.verbatim "#pragma my var={} property" args %arg : f32 /// ``` /// ```c++ /// // Code emitted for the operation above. /// typedef float f32; /// #pragma my var=v1 property /// ``` class VerbatimOp; } // namespace mlir::emitc namespace mlir::emitc { /// Block termination operation /// The `emitc.yield` terminates its parent EmitC op's region, optionally yielding /// an SSA value. The semantics of how the values are yielded is defined by the /// parent operation. /// If `emitc.yield` has an operand, the operand must match the parent operation's /// result. If the parent operation defines no values, then the `emitc.yield` /// may be left out in the custom syntax and the builders will insert one /// implicitly. Otherwise, it has to be present in the syntax to indicate which /// value is yielded. class YieldOp; } // namespace mlir::emitc #ifdef GET_OP_CLASSES #undef GET_OP_CLASSES namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::AddOp declarations //===----------------------------------------------------------------------===// namespace detail { class AddOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: AddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.add", odsAttrs.getContext()); } AddOpGenericAdaptorBase(AddOp 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 AddOpGenericAdaptor : public detail::AddOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::AddOpGenericAdaptorBase; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; public: AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AddOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AddOpGenericAdaptor(values, attrs, Properties{}, {}) {} AddOpGenericAdaptor(RangeT values, const AddOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> AddOpGenericAdaptor(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)}; } ValueT getLhs() { return (*getODSOperands(0).begin()); } ValueT getRhs() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class AddOpAdaptor : public AddOpGenericAdaptor<::mlir::ValueRange> { public: using AddOpGenericAdaptor::AddOpGenericAdaptor; AddOpAdaptor(AddOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class AddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = AddOpAdaptor; template using GenericAdaptor = AddOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.add"); } 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)}; } ::mlir::TypedValue<::mlir::Type> getLhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getRhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::OpOperand &getLhsMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getRhsMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } 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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static AddOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static AddOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static AddOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static AddOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AddOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AddOp 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 AddOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AddOp 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); public: bool hasSideEffects() { // If both operands are fundamental types, the operation is pure. return !isFundamentalType(getOperand(0).getType()) || !isFundamentalType(getOperand(1).getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::AddOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::AddressOfOp declarations //===----------------------------------------------------------------------===// namespace detail { class AddressOfOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: AddressOfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.address_of", odsAttrs.getContext()); } AddressOfOpGenericAdaptorBase(AddressOfOp 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 AddressOfOpGenericAdaptor : public detail::AddressOfOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::AddressOfOpGenericAdaptorBase; static constexpr int odsIndex_reference = 0; public: AddressOfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} AddressOfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AddressOfOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} AddressOfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AddressOfOpGenericAdaptor(values, attrs, Properties{}, {}) {} AddressOfOpGenericAdaptor(RangeT values, const AddressOfOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> AddressOfOpGenericAdaptor(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)}; } ValueT getReference() { return (*getODSOperands(0).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class AddressOfOpAdaptor : public AddressOfOpGenericAdaptor<::mlir::ValueRange> { public: using AddressOfOpGenericAdaptor::AddressOfOpGenericAdaptor; AddressOfOpAdaptor(AddressOfOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class AddressOfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = AddressOfOpAdaptor; template using GenericAdaptor = AddressOfOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_reference = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.address_of"); } 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)}; } ::mlir::TypedValue<::mlir::emitc::LValueType> getReference() { return ::llvm::cast<::mlir::TypedValue<::mlir::emitc::LValueType>>(*getODSOperands(0).begin()); } ::mlir::OpOperand &getReferenceMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } 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::emitc::PointerType> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::emitc::PointerType>>(*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 result, ::mlir::Value reference); static AddressOfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value reference); static AddressOfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value reference); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value reference); static AddressOfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value reference); static AddressOfOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value reference); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AddressOfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AddressOfOp 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 AddressOfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AddressOfOp 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); public: bool hasSideEffects() { return false; } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::AddressOfOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::AssignOp declarations //===----------------------------------------------------------------------===// namespace detail { class AssignOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: AssignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.assign", odsAttrs.getContext()); } AssignOpGenericAdaptorBase(AssignOp 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 AssignOpGenericAdaptor : public detail::AssignOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::AssignOpGenericAdaptorBase; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_value = 1; public: AssignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} AssignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : AssignOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} AssignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : AssignOpGenericAdaptor(values, attrs, Properties{}, {}) {} AssignOpGenericAdaptor(RangeT values, const AssignOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> AssignOpGenericAdaptor(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)}; } ValueT getVar() { return (*getODSOperands(0).begin()); } ValueT getValue() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class AssignOpAdaptor : public AssignOpGenericAdaptor<::mlir::ValueRange> { public: using AssignOpGenericAdaptor::AssignOpGenericAdaptor; AssignOpAdaptor(AssignOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class AssignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = AssignOpAdaptor; template using GenericAdaptor = AssignOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_var = 0; static constexpr int odsIndex_value = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.assign"); } 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)}; } ::mlir::TypedValue<::mlir::emitc::LValueType> getVar() { return ::llvm::cast<::mlir::TypedValue<::mlir::emitc::LValueType>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getValue() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::OpOperand &getVarMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getValueMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } 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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value value); static AssignOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value var, ::mlir::Value value); static AssignOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value var, ::mlir::Value value); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value value); static AssignOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value value); static AssignOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value value); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AssignOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static AssignOp 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 AssignOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static AssignOp 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); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); public: }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::AssignOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::BitwiseAndOp declarations //===----------------------------------------------------------------------===// namespace detail { class BitwiseAndOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: BitwiseAndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.bitwise_and", odsAttrs.getContext()); } BitwiseAndOpGenericAdaptorBase(BitwiseAndOp 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 BitwiseAndOpGenericAdaptor : public detail::BitwiseAndOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::BitwiseAndOpGenericAdaptorBase; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; public: BitwiseAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} BitwiseAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BitwiseAndOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} BitwiseAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : BitwiseAndOpGenericAdaptor(values, attrs, Properties{}, {}) {} BitwiseAndOpGenericAdaptor(RangeT values, const BitwiseAndOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> BitwiseAndOpGenericAdaptor(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)}; } ValueT getLhs() { return (*getODSOperands(0).begin()); } ValueT getRhs() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class BitwiseAndOpAdaptor : public BitwiseAndOpGenericAdaptor<::mlir::ValueRange> { public: using BitwiseAndOpGenericAdaptor::BitwiseAndOpGenericAdaptor; BitwiseAndOpAdaptor(BitwiseAndOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class BitwiseAndOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = BitwiseAndOpAdaptor; template using GenericAdaptor = BitwiseAndOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.bitwise_and"); } 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)}; } ::mlir::TypedValue<::mlir::Type> getLhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getRhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::OpOperand &getLhsMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getRhsMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } 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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseAndOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseAndOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseAndOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseAndOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static BitwiseAndOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static BitwiseAndOp 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 BitwiseAndOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static BitwiseAndOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: bool hasSideEffects() { // If both operands are fundamental types, the operation is pure. return !isFundamentalType(getOperand(0).getType()) || !isFundamentalType(getOperand(1).getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::BitwiseAndOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::BitwiseLeftShiftOp declarations //===----------------------------------------------------------------------===// namespace detail { class BitwiseLeftShiftOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: BitwiseLeftShiftOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.bitwise_left_shift", odsAttrs.getContext()); } BitwiseLeftShiftOpGenericAdaptorBase(BitwiseLeftShiftOp 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 BitwiseLeftShiftOpGenericAdaptor : public detail::BitwiseLeftShiftOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::BitwiseLeftShiftOpGenericAdaptorBase; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; public: BitwiseLeftShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} BitwiseLeftShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BitwiseLeftShiftOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} BitwiseLeftShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : BitwiseLeftShiftOpGenericAdaptor(values, attrs, Properties{}, {}) {} BitwiseLeftShiftOpGenericAdaptor(RangeT values, const BitwiseLeftShiftOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> BitwiseLeftShiftOpGenericAdaptor(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)}; } ValueT getLhs() { return (*getODSOperands(0).begin()); } ValueT getRhs() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class BitwiseLeftShiftOpAdaptor : public BitwiseLeftShiftOpGenericAdaptor<::mlir::ValueRange> { public: using BitwiseLeftShiftOpGenericAdaptor::BitwiseLeftShiftOpGenericAdaptor; BitwiseLeftShiftOpAdaptor(BitwiseLeftShiftOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class BitwiseLeftShiftOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = BitwiseLeftShiftOpAdaptor; template using GenericAdaptor = BitwiseLeftShiftOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.bitwise_left_shift"); } 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)}; } ::mlir::TypedValue<::mlir::Type> getLhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getRhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::OpOperand &getLhsMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getRhsMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } 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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseLeftShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseLeftShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseLeftShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseLeftShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static BitwiseLeftShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static BitwiseLeftShiftOp 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 BitwiseLeftShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static BitwiseLeftShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: bool hasSideEffects() { // If both operands are fundamental types, the operation is pure. return !isFundamentalType(getOperand(0).getType()) || !isFundamentalType(getOperand(1).getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::BitwiseLeftShiftOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::BitwiseNotOp declarations //===----------------------------------------------------------------------===// namespace detail { class BitwiseNotOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: BitwiseNotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.bitwise_not", odsAttrs.getContext()); } BitwiseNotOpGenericAdaptorBase(BitwiseNotOp 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 BitwiseNotOpGenericAdaptor : public detail::BitwiseNotOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::BitwiseNotOpGenericAdaptorBase; public: BitwiseNotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} BitwiseNotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BitwiseNotOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} BitwiseNotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : BitwiseNotOpGenericAdaptor(values, attrs, Properties{}, {}) {} BitwiseNotOpGenericAdaptor(RangeT values, const BitwiseNotOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> BitwiseNotOpGenericAdaptor(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 BitwiseNotOpAdaptor : public BitwiseNotOpGenericAdaptor<::mlir::ValueRange> { public: using BitwiseNotOpGenericAdaptor::BitwiseNotOpGenericAdaptor; BitwiseNotOpAdaptor(BitwiseNotOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class BitwiseNotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = BitwiseNotOpAdaptor; template using GenericAdaptor = BitwiseNotOpGenericAdaptor; 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("emitc.bitwise_not"); } 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)}; } 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 resultType0, ::mlir::Value odsArg_0); static BitwiseNotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value odsArg_0); static BitwiseNotOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value odsArg_0); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0); static BitwiseNotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0); static BitwiseNotOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static BitwiseNotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static BitwiseNotOp 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 BitwiseNotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static BitwiseNotOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: bool hasSideEffects() { // If operand is fundamental type, the operation is pure. return !isFundamentalType(getOperand().getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::BitwiseNotOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::BitwiseOrOp declarations //===----------------------------------------------------------------------===// namespace detail { class BitwiseOrOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: BitwiseOrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.bitwise_or", odsAttrs.getContext()); } BitwiseOrOpGenericAdaptorBase(BitwiseOrOp 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 BitwiseOrOpGenericAdaptor : public detail::BitwiseOrOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::BitwiseOrOpGenericAdaptorBase; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; public: BitwiseOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} BitwiseOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BitwiseOrOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} BitwiseOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : BitwiseOrOpGenericAdaptor(values, attrs, Properties{}, {}) {} BitwiseOrOpGenericAdaptor(RangeT values, const BitwiseOrOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> BitwiseOrOpGenericAdaptor(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)}; } ValueT getLhs() { return (*getODSOperands(0).begin()); } ValueT getRhs() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class BitwiseOrOpAdaptor : public BitwiseOrOpGenericAdaptor<::mlir::ValueRange> { public: using BitwiseOrOpGenericAdaptor::BitwiseOrOpGenericAdaptor; BitwiseOrOpAdaptor(BitwiseOrOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class BitwiseOrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = BitwiseOrOpAdaptor; template using GenericAdaptor = BitwiseOrOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.bitwise_or"); } 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)}; } ::mlir::TypedValue<::mlir::Type> getLhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getRhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::OpOperand &getLhsMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getRhsMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } 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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseOrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseOrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseOrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseOrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static BitwiseOrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static BitwiseOrOp 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 BitwiseOrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static BitwiseOrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: bool hasSideEffects() { // If both operands are fundamental types, the operation is pure. return !isFundamentalType(getOperand(0).getType()) || !isFundamentalType(getOperand(1).getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::BitwiseOrOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::BitwiseRightShiftOp declarations //===----------------------------------------------------------------------===// namespace detail { class BitwiseRightShiftOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: BitwiseRightShiftOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.bitwise_right_shift", odsAttrs.getContext()); } BitwiseRightShiftOpGenericAdaptorBase(BitwiseRightShiftOp 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 BitwiseRightShiftOpGenericAdaptor : public detail::BitwiseRightShiftOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::BitwiseRightShiftOpGenericAdaptorBase; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; public: BitwiseRightShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} BitwiseRightShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BitwiseRightShiftOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} BitwiseRightShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : BitwiseRightShiftOpGenericAdaptor(values, attrs, Properties{}, {}) {} BitwiseRightShiftOpGenericAdaptor(RangeT values, const BitwiseRightShiftOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> BitwiseRightShiftOpGenericAdaptor(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)}; } ValueT getLhs() { return (*getODSOperands(0).begin()); } ValueT getRhs() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class BitwiseRightShiftOpAdaptor : public BitwiseRightShiftOpGenericAdaptor<::mlir::ValueRange> { public: using BitwiseRightShiftOpGenericAdaptor::BitwiseRightShiftOpGenericAdaptor; BitwiseRightShiftOpAdaptor(BitwiseRightShiftOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class BitwiseRightShiftOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = BitwiseRightShiftOpAdaptor; template using GenericAdaptor = BitwiseRightShiftOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.bitwise_right_shift"); } 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)}; } ::mlir::TypedValue<::mlir::Type> getLhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getRhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::OpOperand &getLhsMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getRhsMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } 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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseRightShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseRightShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseRightShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseRightShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static BitwiseRightShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static BitwiseRightShiftOp 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 BitwiseRightShiftOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static BitwiseRightShiftOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: bool hasSideEffects() { // If both operands are fundamental types, the operation is pure. return !isFundamentalType(getOperand(0).getType()) || !isFundamentalType(getOperand(1).getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::BitwiseRightShiftOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::BitwiseXorOp declarations //===----------------------------------------------------------------------===// namespace detail { class BitwiseXorOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: BitwiseXorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.bitwise_xor", odsAttrs.getContext()); } BitwiseXorOpGenericAdaptorBase(BitwiseXorOp 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 BitwiseXorOpGenericAdaptor : public detail::BitwiseXorOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::BitwiseXorOpGenericAdaptorBase; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; public: BitwiseXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} BitwiseXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : BitwiseXorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} BitwiseXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : BitwiseXorOpGenericAdaptor(values, attrs, Properties{}, {}) {} BitwiseXorOpGenericAdaptor(RangeT values, const BitwiseXorOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> BitwiseXorOpGenericAdaptor(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)}; } ValueT getLhs() { return (*getODSOperands(0).begin()); } ValueT getRhs() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class BitwiseXorOpAdaptor : public BitwiseXorOpGenericAdaptor<::mlir::ValueRange> { public: using BitwiseXorOpGenericAdaptor::BitwiseXorOpGenericAdaptor; BitwiseXorOpAdaptor(BitwiseXorOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class BitwiseXorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = BitwiseXorOpAdaptor; template using GenericAdaptor = BitwiseXorOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.bitwise_xor"); } 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)}; } ::mlir::TypedValue<::mlir::Type> getLhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getRhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::OpOperand &getLhsMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getRhsMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } 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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseXorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseXorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseXorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static BitwiseXorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static BitwiseXorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static BitwiseXorOp 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 BitwiseXorOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static BitwiseXorOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: bool hasSideEffects() { // If both operands are fundamental types, the operation is pure. return !isFundamentalType(getOperand(0).getType()) || !isFundamentalType(getOperand(1).getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::BitwiseXorOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::CallOp declarations //===----------------------------------------------------------------------===// namespace detail { class CallOpGenericAdaptorBase { public: struct Properties { using arg_attrsTy = ::mlir::ArrayAttr; arg_attrsTy arg_attrs; auto getArgAttrs() const { auto &propStorage = this->arg_attrs; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setArgAttrs(const ::mlir::ArrayAttr &propValue) { this->arg_attrs = propValue; } using calleeTy = ::mlir::FlatSymbolRefAttr; calleeTy callee; auto getCallee() const { auto &propStorage = this->callee; return ::llvm::cast<::mlir::FlatSymbolRefAttr>(propStorage); } void setCallee(const ::mlir::FlatSymbolRefAttr &propValue) { this->callee = propValue; } using res_attrsTy = ::mlir::ArrayAttr; res_attrsTy res_attrs; auto getResAttrs() const { auto &propStorage = this->res_attrs; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setResAttrs(const ::mlir::ArrayAttr &propValue) { this->res_attrs = propValue; } bool operator==(const Properties &rhs) const { return rhs.arg_attrs == this->arg_attrs && rhs.callee == this->callee && rhs.res_attrs == this->res_attrs && 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: CallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.call", odsAttrs.getContext()); } CallOpGenericAdaptorBase(CallOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::FlatSymbolRefAttr getCalleeAttr() { auto attr = ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().callee); return attr; } ::llvm::StringRef getCallee(); ::mlir::ArrayAttr getArgAttrsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); return attr; } ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); ::mlir::ArrayAttr getResAttrsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); return attr; } ::std::optional< ::mlir::ArrayAttr > getResAttrs(); }; } // namespace detail template class CallOpGenericAdaptor : public detail::CallOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::CallOpGenericAdaptorBase; static constexpr int odsIndex_operands = 0; public: CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CallOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CallOpGenericAdaptor(values, attrs, Properties{}, {}) {} CallOpGenericAdaptor(RangeT values, const CallOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> CallOpGenericAdaptor(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 getODSOperands(0); } private: RangeT odsOperands; }; class CallOpAdaptor : public CallOpGenericAdaptor<::mlir::ValueRange> { public: using CallOpGenericAdaptor::CallOpGenericAdaptor; CallOpAdaptor(CallOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class CallOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = CallOpAdaptor; template using GenericAdaptor = CallOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_operands = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("arg_attrs"), ::llvm::StringRef("callee"), ::llvm::StringRef("res_attrs")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getArgAttrsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getArgAttrsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getCalleeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getCalleeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getResAttrsAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getResAttrsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.call"); } 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 getOperands() { return getODSOperands(0); } ::mlir::MutableOperandRange getOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::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::FlatSymbolRefAttr getCalleeAttr() { return ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().callee); } ::llvm::StringRef getCallee(); ::mlir::ArrayAttr getArgAttrsAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); } ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); ::mlir::ArrayAttr getResAttrsAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); } ::std::optional< ::mlir::ArrayAttr > getResAttrs(); void setCalleeAttr(::mlir::FlatSymbolRefAttr attr) { getProperties().callee = attr; } void setCallee(::llvm::StringRef attrValue); void setArgAttrsAttr(::mlir::ArrayAttr attr) { getProperties().arg_attrs = attr; } void setResAttrsAttr(::mlir::ArrayAttr attr) { getProperties().res_attrs = attr; } ::mlir::Attribute removeArgAttrsAttr() { auto attr = getProperties().arg_attrs; getProperties().arg_attrs = {}; return attr; } ::mlir::Attribute removeResAttrsAttr() { auto attr = getProperties().res_attrs; getProperties().res_attrs = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, FuncOp callee, ValueRange operands = {}); static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, FuncOp callee, ValueRange operands = {}); static CallOp create(::mlir::ImplicitLocOpBuilder &builder, FuncOp callee, ValueRange operands = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, SymbolRefAttr callee, TypeRange results, ValueRange operands = {}); static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, SymbolRefAttr callee, TypeRange results, ValueRange operands = {}); static CallOp create(::mlir::ImplicitLocOpBuilder &builder, SymbolRefAttr callee, TypeRange results, ValueRange operands = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringAttr callee, TypeRange results, ValueRange operands = {}); static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, StringAttr callee, TypeRange results, ValueRange operands = {}); static CallOp create(::mlir::ImplicitLocOpBuilder &builder, StringAttr callee, TypeRange results, ValueRange operands = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef callee, TypeRange results, ValueRange operands = {}); static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, StringRef callee, TypeRange results, ValueRange operands = {}); static CallOp create(::mlir::ImplicitLocOpBuilder &builder, StringRef callee, TypeRange results, ValueRange operands = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultType0, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static CallOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultType0, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static CallOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, ::mlir::ValueRange operands, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CallOp 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 CallOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static CallOp 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 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 < 3 && "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: FunctionType getCalleeType(); /// Get the argument operands to the called function. operand_range getArgOperands() { return {arg_operand_begin(), arg_operand_end()}; } MutableOperandRange getArgOperandsMutable() { return getOperandsMutable(); } operand_iterator arg_operand_begin() { return operand_begin(); } operand_iterator arg_operand_end() { return operand_end(); } /// Return the callee of this operation. CallInterfaceCallable getCallableForCallee() { return (*this)->getAttrOfType("callee"); } /// Set the callee for this operation. void setCalleeFromCallable(CallInterfaceCallable callee) { (*this)->setAttr("callee", cast(callee)); } bool hasSideEffects() { return false; } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::CallOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::CallOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::CallOpaqueOp declarations //===----------------------------------------------------------------------===// namespace detail { class CallOpaqueOpGenericAdaptorBase { public: struct Properties { using argsTy = ::mlir::ArrayAttr; argsTy args; auto getArgs() const { auto &propStorage = this->args; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setArgs(const ::mlir::ArrayAttr &propValue) { this->args = propValue; } using calleeTy = ::mlir::StringAttr; calleeTy callee; auto getCallee() const { auto &propStorage = this->callee; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setCallee(const ::mlir::StringAttr &propValue) { this->callee = propValue; } using template_argsTy = ::mlir::ArrayAttr; template_argsTy template_args; auto getTemplateArgs() const { auto &propStorage = this->template_args; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setTemplateArgs(const ::mlir::ArrayAttr &propValue) { this->template_args = propValue; } bool operator==(const Properties &rhs) const { return rhs.args == this->args && rhs.callee == this->callee && rhs.template_args == this->template_args && 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: CallOpaqueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.call_opaque", odsAttrs.getContext()); } CallOpaqueOpGenericAdaptorBase(CallOpaqueOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getCalleeAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().callee); return attr; } ::llvm::StringRef getCallee(); ::mlir::ArrayAttr getArgsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().args); return attr; } ::std::optional< ::mlir::ArrayAttr > getArgs(); ::mlir::ArrayAttr getTemplateArgsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().template_args); return attr; } ::std::optional< ::mlir::ArrayAttr > getTemplateArgs(); }; } // namespace detail template class CallOpaqueOpGenericAdaptor : public detail::CallOpaqueOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::CallOpaqueOpGenericAdaptorBase; static constexpr int odsIndex_arg_operands = 0; public: CallOpaqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} CallOpaqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CallOpaqueOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} CallOpaqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CallOpaqueOpGenericAdaptor(values, attrs, Properties{}, {}) {} CallOpaqueOpGenericAdaptor(RangeT values, const CallOpaqueOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> CallOpaqueOpGenericAdaptor(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 getArgOperands() { return getODSOperands(0); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class CallOpaqueOpAdaptor : public CallOpaqueOpGenericAdaptor<::mlir::ValueRange> { public: using CallOpaqueOpGenericAdaptor::CallOpaqueOpGenericAdaptor; CallOpaqueOpAdaptor(CallOpaqueOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class CallOpaqueOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = CallOpaqueOpAdaptor; template using GenericAdaptor = CallOpaqueOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_arg_operands = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("args"), ::llvm::StringRef("callee"), ::llvm::StringRef("template_args")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getArgsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getArgsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getCalleeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getCalleeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getTemplateArgsAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getTemplateArgsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.call_opaque"); } 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 getArgOperands() { return getODSOperands(0); } ::mlir::MutableOperandRange getArgOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::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::StringAttr getCalleeAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().callee); } ::llvm::StringRef getCallee(); ::mlir::ArrayAttr getArgsAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().args); } ::std::optional< ::mlir::ArrayAttr > getArgs(); ::mlir::ArrayAttr getTemplateArgsAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().template_args); } ::std::optional< ::mlir::ArrayAttr > getTemplateArgs(); void setCalleeAttr(::mlir::StringAttr attr) { getProperties().callee = attr; } void setCallee(::llvm::StringRef attrValue); void setArgsAttr(::mlir::ArrayAttr attr) { getProperties().args = attr; } void setTemplateArgsAttr(::mlir::ArrayAttr attr) { getProperties().template_args = attr; } ::mlir::Attribute removeArgsAttr() { auto attr = getProperties().args; getProperties().args = {}; return attr; } ::mlir::Attribute removeTemplateArgsAttr() { auto attr = getProperties().template_args; getProperties().template_args = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef callee, ::mlir::ValueRange arg_operands, ::mlir::ArrayAttr args = {}, ::mlir::ArrayAttr template_args = {}); static CallOpaqueOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef callee, ::mlir::ValueRange arg_operands, ::mlir::ArrayAttr args = {}, ::mlir::ArrayAttr template_args = {}); static CallOpaqueOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef callee, ::mlir::ValueRange arg_operands, ::mlir::ArrayAttr args = {}, ::mlir::ArrayAttr template_args = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::StringAttr callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands); static CallOpaqueOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultType0, ::mlir::StringAttr callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands); static CallOpaqueOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultType0, ::mlir::StringAttr callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands); static CallOpaqueOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands); static CallOpaqueOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultType0, ::llvm::StringRef callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CallOpaqueOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CallOpaqueOp 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 CallOpaqueOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static CallOpaqueOp 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); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); 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 < 3 && "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::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::CallOpaqueOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::CallOpaqueOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::CastOp declarations //===----------------------------------------------------------------------===// namespace detail { class CastOpGenericAdaptorBase { public: struct Properties { using pureTy = ::mlir::UnitAttr; pureTy pure; auto getPure() const { auto &propStorage = this->pure; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setPure(const ::mlir::UnitAttr &propValue) { this->pure = propValue; } bool operator==(const Properties &rhs) const { return rhs.pure == this->pure && 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: CastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.cast", odsAttrs.getContext()); } CastOpGenericAdaptorBase(CastOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::UnitAttr getPureAttr(); bool getPure(); }; } // namespace detail template class CastOpGenericAdaptor : public detail::CastOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::CastOpGenericAdaptorBase; static constexpr int odsIndex_source = 0; public: CastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} CastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CastOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} CastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CastOpGenericAdaptor(values, attrs, Properties{}, {}) {} CastOpGenericAdaptor(RangeT values, const CastOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> CastOpGenericAdaptor(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)}; } ValueT getSource() { return (*getODSOperands(0).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class CastOpAdaptor : public CastOpGenericAdaptor<::mlir::ValueRange> { public: using CastOpGenericAdaptor::CastOpGenericAdaptor; CastOpAdaptor(CastOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class CastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::emitc::CExpressionInterface::Trait, ::mlir::CastOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = CastOpAdaptor; template using GenericAdaptor = CastOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_source = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("pure")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getPureAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getPureAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.cast"); } 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)}; } ::mlir::TypedValue<::mlir::Type> getSource() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::OpOperand &getSourceMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } 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::Type> getDest() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*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::UnitAttr getPureAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().pure); } bool getPure(); void setPureAttr(::mlir::UnitAttr attr) { getProperties().pure = attr; } void setPure(bool attrValue); ::mlir::Attribute removePureAttr() { auto attr = getProperties().pure; getProperties().pure = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dest, ::mlir::Value source, /*optional*/::mlir::UnitAttr pure); static CastOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type dest, ::mlir::Value source, /*optional*/::mlir::UnitAttr pure); static CastOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type dest, ::mlir::Value source, /*optional*/::mlir::UnitAttr pure); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/::mlir::UnitAttr pure); static CastOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/::mlir::UnitAttr pure); static CastOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/::mlir::UnitAttr pure); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dest, ::mlir::Value source, /*optional*/bool pure = false); static CastOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type dest, ::mlir::Value source, /*optional*/bool pure = false); static CastOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type dest, ::mlir::Value source, /*optional*/bool pure = false); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/bool pure = false); static CastOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/bool pure = false); static CastOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value source, /*optional*/bool pure = false); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CastOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CastOp 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 CastOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static CastOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static bool areCastCompatible(::mlir::TypeRange inputs, ::mlir::TypeRange outputs); ::mlir::Speculation::Speculatability getSpeculatability(); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); 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: bool hasSideEffects() { // Use the "pure" attribute to see whether this CastOp has side effects. // Note that by default, `pure` is not set. return getPure(); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::CastOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::CastOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::ClassOp declarations //===----------------------------------------------------------------------===// namespace detail { class ClassOpGenericAdaptorBase { public: struct Properties { using class_typeTy = ::mlir::emitc::ClassTypeAttr; class_typeTy class_type; auto getClassType() const { auto &propStorage = this->class_type; return ::llvm::dyn_cast_or_null<::mlir::emitc::ClassTypeAttr>(propStorage); } void setClassType(const ::mlir::emitc::ClassTypeAttr &propValue) { this->class_type = propValue; } using final_specifierTy = ::mlir::UnitAttr; final_specifierTy final_specifier; auto getFinalSpecifier() const { auto &propStorage = this->final_specifier; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setFinalSpecifier(const ::mlir::UnitAttr &propValue) { this->final_specifier = propValue; } 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.class_type == this->class_type && rhs.final_specifier == this->final_specifier && 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: ClassOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.class", odsAttrs.getContext()); } ClassOpGenericAdaptorBase(ClassOp 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::UnitAttr getFinalSpecifierAttr(); bool getFinalSpecifier(); ::mlir::emitc::ClassTypeAttr getClassTypeAttr(); ::mlir::emitc::ClassType getClassType(); ::mlir::Region &getBody() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class ClassOpGenericAdaptor : public detail::ClassOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ClassOpGenericAdaptorBase; public: ClassOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ClassOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ClassOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ClassOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ClassOpGenericAdaptor(values, attrs, Properties{}, {}) {} ClassOpGenericAdaptor(RangeT values, const ClassOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ClassOpGenericAdaptor(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 ClassOpAdaptor : public ClassOpGenericAdaptor<::mlir::ValueRange> { public: using ClassOpGenericAdaptor::ClassOpGenericAdaptor; ClassOpAdaptor(ClassOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ClassOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = ClassOpAdaptor; template using GenericAdaptor = ClassOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("class_type"), ::llvm::StringRef("final_specifier"), ::llvm::StringRef("sym_name")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getClassTypeAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getClassTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getFinalSpecifierAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getFinalSpecifierAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getSymNameAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.class"); } 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(); ::mlir::UnitAttr getFinalSpecifierAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().final_specifier); } bool getFinalSpecifier(); ::mlir::emitc::ClassTypeAttr getClassTypeAttr() { return ::llvm::dyn_cast_or_null<::mlir::emitc::ClassTypeAttr>(getProperties().class_type); } ::mlir::emitc::ClassType getClassType(); void setSymNameAttr(::mlir::StringAttr attr) { getProperties().sym_name = attr; } void setSymName(::llvm::StringRef attrValue); void setFinalSpecifierAttr(::mlir::UnitAttr attr) { getProperties().final_specifier = attr; } void setFinalSpecifier(bool attrValue); void setClassTypeAttr(::mlir::emitc::ClassTypeAttr attr) { getProperties().class_type = attr; } void setClassType(::mlir::emitc::ClassType attrValue); ::mlir::Attribute removeFinalSpecifierAttr() { auto attr = getProperties().final_specifier; getProperties().final_specifier = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, /*optional*/::mlir::UnitAttr final_specifier = nullptr, ::mlir::emitc::ClassTypeAttr class_type = nullptr); static ClassOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, /*optional*/::mlir::UnitAttr final_specifier = nullptr, ::mlir::emitc::ClassTypeAttr class_type = nullptr); static ClassOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, /*optional*/::mlir::UnitAttr final_specifier = nullptr, ::mlir::emitc::ClassTypeAttr class_type = nullptr); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, /*optional*/::mlir::UnitAttr final_specifier = nullptr, ::mlir::emitc::ClassTypeAttr class_type = nullptr); static ClassOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, /*optional*/::mlir::UnitAttr final_specifier = nullptr, ::mlir::emitc::ClassTypeAttr class_type = nullptr); static ClassOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, /*optional*/::mlir::UnitAttr final_specifier = nullptr, ::mlir::emitc::ClassTypeAttr class_type = nullptr); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, /*optional*/bool final_specifier = false, ::mlir::emitc::ClassType class_type = ClassType::class_); static ClassOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, /*optional*/bool final_specifier = false, ::mlir::emitc::ClassType class_type = ClassType::class_); static ClassOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, /*optional*/bool final_specifier = false, ::mlir::emitc::ClassType class_type = ClassType::class_); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, /*optional*/bool final_specifier = false, ::mlir::emitc::ClassType class_type = ClassType::class_); static ClassOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, /*optional*/bool final_specifier = false, ::mlir::emitc::ClassType class_type = ClassType::class_); static ClassOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, /*optional*/bool final_specifier = false, ::mlir::emitc::ClassType class_type = ClassType::class_); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ClassOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ClassOp 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 ClassOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ClassOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static void populateDefaultProperties(::mlir::OperationName opName, Properties &properties); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); 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 < 3 && "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: // Returns the body block containing class members and methods. Block &getBlock(); }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::ClassOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::ClassOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::CmpOp declarations //===----------------------------------------------------------------------===// namespace detail { class CmpOpGenericAdaptorBase { public: struct Properties { using predicateTy = ::mlir::emitc::CmpPredicateAttr; predicateTy predicate; auto getPredicate() const { auto &propStorage = this->predicate; return ::llvm::cast<::mlir::emitc::CmpPredicateAttr>(propStorage); } void setPredicate(const ::mlir::emitc::CmpPredicateAttr &propValue) { this->predicate = propValue; } bool operator==(const Properties &rhs) const { return rhs.predicate == this->predicate && 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: CmpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.cmp", odsAttrs.getContext()); } CmpOpGenericAdaptorBase(CmpOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::emitc::CmpPredicateAttr getPredicateAttr() { auto attr = ::llvm::cast<::mlir::emitc::CmpPredicateAttr>(getProperties().predicate); return attr; } ::mlir::emitc::CmpPredicate getPredicate(); }; } // namespace detail template class CmpOpGenericAdaptor : public detail::CmpOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::CmpOpGenericAdaptorBase; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; public: CmpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} CmpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : CmpOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} CmpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : CmpOpGenericAdaptor(values, attrs, Properties{}, {}) {} CmpOpGenericAdaptor(RangeT values, const CmpOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> CmpOpGenericAdaptor(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)}; } ValueT getLhs() { return (*getODSOperands(0).begin()); } ValueT getRhs() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class CmpOpAdaptor : public CmpOpGenericAdaptor<::mlir::ValueRange> { public: using CmpOpGenericAdaptor::CmpOpGenericAdaptor; CmpOpAdaptor(CmpOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class CmpOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = CmpOpAdaptor; template using GenericAdaptor = CmpOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("predicate")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getPredicateAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getPredicateAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.cmp"); } 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)}; } ::mlir::TypedValue<::mlir::Type> getLhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getRhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::OpOperand &getLhsMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getRhsMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } 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::emitc::CmpPredicateAttr getPredicateAttr() { return ::llvm::cast<::mlir::emitc::CmpPredicateAttr>(getProperties().predicate); } ::mlir::emitc::CmpPredicate getPredicate(); void setPredicateAttr(::mlir::emitc::CmpPredicateAttr attr) { getProperties().predicate = attr; } void setPredicate(::mlir::emitc::CmpPredicate attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::emitc::CmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs); static CmpOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::emitc::CmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs); static CmpOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::emitc::CmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::emitc::CmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs); static CmpOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::emitc::CmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs); static CmpOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::emitc::CmpPredicateAttr predicate, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::emitc::CmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs); static CmpOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::emitc::CmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs); static CmpOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::emitc::CmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::emitc::CmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs); static CmpOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::emitc::CmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs); static CmpOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::emitc::CmpPredicate predicate, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CmpOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static CmpOp 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 CmpOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static CmpOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); 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: bool hasSideEffects() { // If both operands are fundamental types, the operation is pure. return !isFundamentalType(getOperand(0).getType()) || !isFundamentalType(getOperand(1).getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::CmpOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::CmpOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::ConditionalOp declarations //===----------------------------------------------------------------------===// namespace detail { class ConditionalOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: ConditionalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.conditional", odsAttrs.getContext()); } ConditionalOpGenericAdaptorBase(ConditionalOp 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 ConditionalOpGenericAdaptor : public detail::ConditionalOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ConditionalOpGenericAdaptorBase; static constexpr int odsIndex_condition = 0; static constexpr int odsIndex_true_value = 1; static constexpr int odsIndex_false_value = 2; public: ConditionalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ConditionalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ConditionalOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ConditionalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ConditionalOpGenericAdaptor(values, attrs, Properties{}, {}) {} ConditionalOpGenericAdaptor(RangeT values, const ConditionalOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ConditionalOpGenericAdaptor(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)}; } ValueT getCondition() { return (*getODSOperands(0).begin()); } ValueT getTrueValue() { return (*getODSOperands(1).begin()); } ValueT getFalseValue() { return (*getODSOperands(2).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ConditionalOpAdaptor : public ConditionalOpGenericAdaptor<::mlir::ValueRange> { public: using ConditionalOpGenericAdaptor::ConditionalOpGenericAdaptor; ConditionalOpAdaptor(ConditionalOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ConditionalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ConditionalOpAdaptor; template using GenericAdaptor = ConditionalOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_condition = 0; static constexpr int odsIndex_true_value = 1; static constexpr int odsIndex_false_value = 2; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.conditional"); } 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)}; } ::mlir::TypedValue<::mlir::IntegerType> getCondition() { return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getTrueValue() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::TypedValue<::mlir::Type> getFalseValue() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(2).begin()); } ::mlir::OpOperand &getConditionMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getTrueValueMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getFalseValueMutable() { auto range = getODSOperandIndexAndLength(2); return getOperation()->getOpOperand(range.first); } 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::Type> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*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 result, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value); static ConditionalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value); static ConditionalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value); static ConditionalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value); static ConditionalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value true_value, ::mlir::Value false_value); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ConditionalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ConditionalOp 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 ConditionalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ConditionalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: bool hasSideEffects() { return false; } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::ConditionalOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::ConstantOp declarations //===----------------------------------------------------------------------===// namespace detail { class ConstantOpGenericAdaptorBase { public: struct Properties { using valueTy = ::mlir::Attribute; valueTy value; auto getValue() const { auto &propStorage = this->value; return ::llvm::cast<::mlir::Attribute>(propStorage); } void setValue(const ::mlir::Attribute &propValue) { this->value = propValue; } bool operator==(const Properties &rhs) const { return rhs.value == this->value && 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: ConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.constant", odsAttrs.getContext()); } ConstantOpGenericAdaptorBase(ConstantOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Attribute getValueAttr() { auto attr = ::llvm::cast<::mlir::Attribute>(getProperties().value); return attr; } ::mlir::Attribute getValue(); }; } // namespace detail template class ConstantOpGenericAdaptor : public detail::ConstantOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ConstantOpGenericAdaptorBase; public: ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ConstantOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ConstantOpGenericAdaptor(values, attrs, Properties{}, {}) {} ConstantOpGenericAdaptor(RangeT values, const ConstantOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ConstantOpGenericAdaptor(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 ConstantOpAdaptor : public ConstantOpGenericAdaptor<::mlir::ValueRange> { public: using ConstantOpGenericAdaptor::ConstantOpGenericAdaptor; ConstantOpAdaptor(ConstantOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ConstantOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::ConstantLike, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = ConstantOpAdaptor; template using GenericAdaptor = ConstantOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getValueAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.constant"); } 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)}; } 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 getValueAttr() { return ::llvm::cast<::mlir::Attribute>(getProperties().value); } ::mlir::Attribute getValue(); void setValueAttr(::mlir::Attribute attr) { getProperties().value = attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Attribute value); static ConstantOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Attribute value); static ConstantOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Attribute value); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute value); static ConstantOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Attribute value); static ConstantOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Attribute value); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ConstantOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ConstantOp 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 ConstantOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ConstantOp 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(); ::mlir::OpFoldResult fold(FoldAdaptor adaptor); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); 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: bool hasSideEffects() { // If operand is fundamental type, the operation is pure. return !isFundamentalType(getResult().getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::ConstantOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::ConstantOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::DeclareFuncOp declarations //===----------------------------------------------------------------------===// namespace detail { class DeclareFuncOpGenericAdaptorBase { public: struct Properties { using sym_nameTy = ::mlir::FlatSymbolRefAttr; sym_nameTy sym_name; auto getSymName() const { auto &propStorage = this->sym_name; return ::llvm::cast<::mlir::FlatSymbolRefAttr>(propStorage); } void setSymName(const ::mlir::FlatSymbolRefAttr &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: DeclareFuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.declare_func", odsAttrs.getContext()); } DeclareFuncOpGenericAdaptorBase(DeclareFuncOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::FlatSymbolRefAttr getSymNameAttr() { auto attr = ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().sym_name); return attr; } ::llvm::StringRef getSymName(); }; } // namespace detail template class DeclareFuncOpGenericAdaptor : public detail::DeclareFuncOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DeclareFuncOpGenericAdaptorBase; public: DeclareFuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DeclareFuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DeclareFuncOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DeclareFuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : DeclareFuncOpGenericAdaptor(values, attrs, Properties{}, {}) {} DeclareFuncOpGenericAdaptor(RangeT values, const DeclareFuncOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DeclareFuncOpGenericAdaptor(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 DeclareFuncOpAdaptor : public DeclareFuncOpGenericAdaptor<::mlir::ValueRange> { public: using DeclareFuncOpGenericAdaptor::DeclareFuncOpGenericAdaptor; DeclareFuncOpAdaptor(DeclareFuncOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DeclareFuncOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = DeclareFuncOpAdaptor; template using GenericAdaptor = DeclareFuncOpGenericAdaptor; 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("emitc.declare_func"); } 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)}; } 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::FlatSymbolRefAttr getSymNameAttr() { return ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().sym_name); } ::llvm::StringRef getSymName(); void setSymNameAttr(::mlir::FlatSymbolRefAttr attr) { getProperties().sym_name = attr; } void setSymName(::llvm::StringRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::FlatSymbolRefAttr sym_name); static DeclareFuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::FlatSymbolRefAttr sym_name); static DeclareFuncOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::FlatSymbolRefAttr sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr sym_name); static DeclareFuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr sym_name); static DeclareFuncOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr sym_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name); static DeclareFuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name); static DeclareFuncOp 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 DeclareFuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name); static DeclareFuncOp 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 DeclareFuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DeclareFuncOp 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 DeclareFuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DeclareFuncOp 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 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 < 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::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::DeclareFuncOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::DeclareFuncOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::DereferenceOp declarations //===----------------------------------------------------------------------===// namespace detail { class DereferenceOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DereferenceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.dereference", odsAttrs.getContext()); } DereferenceOpGenericAdaptorBase(DereferenceOp 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 DereferenceOpGenericAdaptor : public detail::DereferenceOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DereferenceOpGenericAdaptorBase; static constexpr int odsIndex_pointer = 0; public: DereferenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DereferenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DereferenceOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DereferenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : DereferenceOpGenericAdaptor(values, attrs, Properties{}, {}) {} DereferenceOpGenericAdaptor(RangeT values, const DereferenceOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DereferenceOpGenericAdaptor(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)}; } ValueT getPointer() { return (*getODSOperands(0).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class DereferenceOpAdaptor : public DereferenceOpGenericAdaptor<::mlir::ValueRange> { public: using DereferenceOpGenericAdaptor::DereferenceOpGenericAdaptor; DereferenceOpAdaptor(DereferenceOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DereferenceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DereferenceOpAdaptor; template using GenericAdaptor = DereferenceOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_pointer = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.dereference"); } 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)}; } ::mlir::TypedValue<::mlir::emitc::PointerType> getPointer() { return ::llvm::cast<::mlir::TypedValue<::mlir::emitc::PointerType>>(*getODSOperands(0).begin()); } ::mlir::OpOperand &getPointerMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } 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::emitc::LValueType> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::emitc::LValueType>>(*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 result, ::mlir::Value pointer); static DereferenceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value pointer); static DereferenceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value pointer); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pointer); static DereferenceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value pointer); static DereferenceOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value pointer); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DereferenceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DereferenceOp 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 DereferenceOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DereferenceOp 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); public: bool hasSideEffects() { return false; } bool alwaysInline() { return true; // C doesn't support references. } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::DereferenceOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::DivOp declarations //===----------------------------------------------------------------------===// namespace detail { class DivOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.div", odsAttrs.getContext()); } DivOpGenericAdaptorBase(DivOp 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 DivOpGenericAdaptor : public detail::DivOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DivOpGenericAdaptorBase; public: DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DivOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : DivOpGenericAdaptor(values, attrs, Properties{}, {}) {} DivOpGenericAdaptor(RangeT values, const DivOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DivOpGenericAdaptor(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 DivOpAdaptor : public DivOpGenericAdaptor<::mlir::ValueRange> { public: using DivOpGenericAdaptor::DivOpGenericAdaptor; DivOpAdaptor(DivOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = DivOpAdaptor; template using GenericAdaptor = DivOpGenericAdaptor; 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("emitc.div"); } 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)}; } 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 resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static DivOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static DivOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static DivOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static DivOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DivOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DivOp 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 DivOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DivOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: bool hasSideEffects() { // If both operands are fundamental types, the operation is pure. return !isFundamentalType(getOperand(0).getType()) || !isFundamentalType(getOperand(1).getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::DivOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::DoOp declarations //===----------------------------------------------------------------------===// namespace detail { class DoOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: DoOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.do", odsAttrs.getContext()); } DoOpGenericAdaptorBase(DoOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getBodyRegion() { return *odsRegions[0]; } ::mlir::Region &getConditionRegion() { return *odsRegions[1]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class DoOpGenericAdaptor : public detail::DoOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::DoOpGenericAdaptorBase; public: DoOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} DoOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : DoOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} DoOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : DoOpGenericAdaptor(values, attrs, Properties{}, {}) {} DoOpGenericAdaptor(RangeT values, const DoOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> DoOpGenericAdaptor(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 DoOpAdaptor : public DoOpGenericAdaptor<::mlir::ValueRange> { public: using DoOpGenericAdaptor::DoOpGenericAdaptor; DoOpAdaptor(DoOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class DoOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::NoTerminator, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects> { public: using Op::Op; using Op::print; using Adaptor = DoOpAdaptor; template using GenericAdaptor = DoOpGenericAdaptor; 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("emitc.do"); } 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 &getBodyRegion() { return (*this)->getRegion(0); } ::mlir::Region &getConditionRegion() { return (*this)->getRegion(1); } 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); static DoOp create(::mlir::OpBuilder &builder, ::mlir::Location location); static DoOp create(::mlir::ImplicitLocOpBuilder &builder); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); static DoOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes); static DoOp 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 DoOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static DoOp 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 DoOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static DoOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); public: //===------------------------------------------------------------------===// // OpAsmOpInterface Methods //===------------------------------------------------------------------===// /// EmitC ops in the body can omit their 'emitc.' prefix in the assembly. static ::llvm::StringRef getDefaultDialect() { return "emitc"; } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::DoOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::ExpressionOp declarations //===----------------------------------------------------------------------===// namespace detail { class ExpressionOpGenericAdaptorBase { public: struct Properties { using do_not_inlineTy = ::mlir::UnitAttr; do_not_inlineTy do_not_inline; auto getDoNotInline() const { auto &propStorage = this->do_not_inline; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setDoNotInline(const ::mlir::UnitAttr &propValue) { this->do_not_inline = propValue; } bool operator==(const Properties &rhs) const { return rhs.do_not_inline == this->do_not_inline && 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: ExpressionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.expression", odsAttrs.getContext()); } ExpressionOpGenericAdaptorBase(ExpressionOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::UnitAttr getDoNotInlineAttr(); bool getDoNotInline(); ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class ExpressionOpGenericAdaptor : public detail::ExpressionOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ExpressionOpGenericAdaptorBase; static constexpr int odsIndex_defs = 0; public: ExpressionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ExpressionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ExpressionOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ExpressionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ExpressionOpGenericAdaptor(values, attrs, Properties{}, {}) {} ExpressionOpGenericAdaptor(RangeT values, const ExpressionOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ExpressionOpGenericAdaptor(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 getDefs() { return getODSOperands(0); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ExpressionOpAdaptor : public ExpressionOpGenericAdaptor<::mlir::ValueRange> { public: using ExpressionOpGenericAdaptor::ExpressionOpGenericAdaptor; ExpressionOpAdaptor(ExpressionOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ExpressionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::HasOnlyGraphRegion, ::mlir::OpAsmOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove> { public: using Op::Op; using Op::print; using Adaptor = ExpressionOpAdaptor; template using GenericAdaptor = ExpressionOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_defs = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("do_not_inline")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getDoNotInlineAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getDoNotInlineAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.expression"); } 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 getDefs() { return getODSOperands(0); } ::mlir::MutableOperandRange getDefsMutable(); 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::Type> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSResults(0).begin()); } ::mlir::Region &getRegion() { 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::UnitAttr getDoNotInlineAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().do_not_inline); } bool getDoNotInline(); void setDoNotInlineAttr(::mlir::UnitAttr attr) { getProperties().do_not_inline = attr; } void setDoNotInline(bool attrValue); ::mlir::Attribute removeDoNotInlineAttr() { auto attr = getProperties().do_not_inline; getProperties().do_not_inline = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange defs, /*optional*/::mlir::UnitAttr do_not_inline); static ExpressionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::ValueRange defs, /*optional*/::mlir::UnitAttr do_not_inline); static ExpressionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::ValueRange defs, /*optional*/::mlir::UnitAttr do_not_inline); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange defs, /*optional*/::mlir::UnitAttr do_not_inline); static ExpressionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange defs, /*optional*/::mlir::UnitAttr do_not_inline); static ExpressionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange defs, /*optional*/::mlir::UnitAttr do_not_inline); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange defs, /*optional*/bool do_not_inline = false); static ExpressionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::ValueRange defs, /*optional*/bool do_not_inline = false); static ExpressionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::ValueRange defs, /*optional*/bool do_not_inline = false); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange defs, /*optional*/bool do_not_inline = false); static ExpressionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange defs, /*optional*/bool do_not_inline = false); static ExpressionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange defs, /*optional*/bool do_not_inline = false); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ExpressionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ExpressionOp 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 ExpressionOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ExpressionOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); 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: bool hasSideEffects() { auto predicate = [](Operation &op) { assert(isa(op) && "Expected a C expression"); return cast(op).hasSideEffects(); }; return llvm::any_of(getRegion().front().without_terminator(), predicate); }; Operation *getRootOp(); Block &createBody() { assert(getRegion().empty() && "expression already has a body"); Block &block = getRegion().emplaceBlock(); for (auto operand : getOperands()) block.addArgument(operand.getType(), operand.getLoc()); return block; } //===------------------------------------------------------------------===// // OpAsmOpInterface Methods //===------------------------------------------------------------------===// /// EmitC ops in the body can omit their 'emitc.' prefix in the assembly. static ::llvm::StringRef getDefaultDialect() { return "emitc"; } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::ExpressionOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::ExpressionOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::FieldOp declarations //===----------------------------------------------------------------------===// namespace detail { class FieldOpGenericAdaptorBase { public: struct Properties { using initial_valueTy = ::mlir::Attribute; initial_valueTy initial_value; auto getInitialValue() const { auto &propStorage = this->initial_value; return ::llvm::dyn_cast_or_null<::mlir::Attribute>(propStorage); } void setInitialValue(const ::mlir::Attribute &propValue) { this->initial_value = propValue; } 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; } using typeTy = ::mlir::TypeAttr; typeTy type; auto getType() const { auto &propStorage = this->type; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setType(const ::mlir::TypeAttr &propValue) { this->type = propValue; } bool operator==(const Properties &rhs) const { return rhs.initial_value == this->initial_value && rhs.sym_name == this->sym_name && rhs.type == this->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: FieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.field", odsAttrs.getContext()); } FieldOpGenericAdaptorBase(FieldOp 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::TypeAttr getTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().type); return attr; } ::mlir::Type getType(); ::mlir::Attribute getInitialValueAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().initial_value); return attr; } ::std::optional<::mlir::Attribute> getInitialValue(); }; } // namespace detail template class FieldOpGenericAdaptor : public detail::FieldOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::FieldOpGenericAdaptorBase; public: FieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} FieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : FieldOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} FieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : FieldOpGenericAdaptor(values, attrs, Properties{}, {}) {} FieldOpGenericAdaptor(RangeT values, const FieldOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> FieldOpGenericAdaptor(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 FieldOpAdaptor : public FieldOpGenericAdaptor<::mlir::ValueRange> { public: using FieldOpGenericAdaptor::FieldOpGenericAdaptor; FieldOpAdaptor(FieldOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class FieldOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = FieldOpAdaptor; template using GenericAdaptor = FieldOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("initial_value"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("type")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getInitialValueAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getInitialValueAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getSymNameAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getTypeAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.field"); } 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)}; } 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(); ::mlir::TypeAttr getTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().type); } ::mlir::Type getType(); ::mlir::Attribute getInitialValueAttr() { return ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().initial_value); } ::std::optional<::mlir::Attribute> getInitialValue(); void setSymNameAttr(::mlir::StringAttr attr) { getProperties().sym_name = attr; } void setSymName(::llvm::StringRef attrValue); void setTypeAttr(::mlir::TypeAttr attr) { getProperties().type = attr; } void setType(::mlir::Type attrValue); void setInitialValueAttr(::mlir::Attribute attr) { getProperties().initial_value = attr; } ::mlir::Attribute removeInitialValueAttr() { auto attr = getProperties().initial_value; getProperties().initial_value = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value); static FieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value); static FieldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value); static FieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value); static FieldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value); static FieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value); static FieldOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value); static FieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value); static FieldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static FieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static FieldOp 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 FieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static FieldOp 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 < 3 && "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::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::FieldOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::FieldOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::FileOp declarations //===----------------------------------------------------------------------===// namespace detail { class FileOpGenericAdaptorBase { public: struct Properties { using idTy = ::mlir::StringAttr; idTy id; auto getId() const { auto &propStorage = this->id; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setId(const ::mlir::StringAttr &propValue) { this->id = propValue; } bool operator==(const Properties &rhs) const { return rhs.id == this->id && 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: FileOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.file", odsAttrs.getContext()); } FileOpGenericAdaptorBase(FileOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getIdAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().id); return attr; } ::mlir::StringAttr getId(); ::mlir::Region &getBodyRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class FileOpGenericAdaptor : public detail::FileOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::FileOpGenericAdaptorBase; public: FileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} FileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : FileOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} FileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : FileOpGenericAdaptor(values, attrs, Properties{}, {}) {} FileOpGenericAdaptor(RangeT values, const FileOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> FileOpGenericAdaptor(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 FileOpAdaptor : public FileOpGenericAdaptor<::mlir::ValueRange> { public: using FileOpGenericAdaptor::FileOpGenericAdaptor; FileOpAdaptor(FileOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class FileOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = FileOpAdaptor; template using GenericAdaptor = FileOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("id")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getIdAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getIdAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.file"); } 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 &getBodyRegion() { 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 getIdAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().id); } ::mlir::StringAttr getId(); void setIdAttr(::mlir::StringAttr attr) { getProperties().id = attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef id); static FileOp create(::mlir::OpBuilder &builder, ::mlir::Location location, StringRef id); static FileOp create(::mlir::ImplicitLocOpBuilder &builder, StringRef id); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); 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: /// Construct a file op from the given location with a name. static FileOp create(Location loc, StringRef name); //===------------------------------------------------------------------===// // OpAsmOpInterface Methods //===------------------------------------------------------------------===// /// EmitC ops in the body can omit their 'emitc.' prefix in the assembly. static ::llvm::StringRef getDefaultDialect() { return "emitc"; } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::FileOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::FileOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::ForOp declarations //===----------------------------------------------------------------------===// namespace detail { class ForOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: ForOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.for", odsAttrs.getContext()); } ForOpGenericAdaptorBase(ForOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getRegion() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class ForOpGenericAdaptor : public detail::ForOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ForOpGenericAdaptorBase; static constexpr int odsIndex_lowerBound = 0; static constexpr int odsIndex_upperBound = 1; static constexpr int odsIndex_step = 2; public: ForOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ForOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ForOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ForOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ForOpGenericAdaptor(values, attrs, Properties{}, {}) {} ForOpGenericAdaptor(RangeT values, const ForOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ForOpGenericAdaptor(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)}; } ValueT getLowerBound() { return (*getODSOperands(0).begin()); } ValueT getUpperBound() { return (*getODSOperands(1).begin()); } ValueT getStep() { return (*getODSOperands(2).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ForOpAdaptor : public ForOpGenericAdaptor<::mlir::ValueRange> { public: using ForOpGenericAdaptor::ForOpGenericAdaptor; ForOpAdaptor(ForOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ForOp : public ::mlir::Op::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects> { public: using Op::Op; using Op::print; using Adaptor = ForOpAdaptor; template using GenericAdaptor = ForOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_lowerBound = 0; static constexpr int odsIndex_upperBound = 1; static constexpr int odsIndex_step = 2; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.for"); } 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)}; } ::mlir::TypedValue<::mlir::Type> getLowerBound() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getUpperBound() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::TypedValue<::mlir::Type> getStep() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(2).begin()); } ::mlir::OpOperand &getLowerBoundMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getUpperBoundMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getStepMutable() { auto range = getODSOperandIndexAndLength(2); return getOperation()->getOpOperand(range.first); } 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 &getRegion() { 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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value lowerBound, Value upperBound, Value step, function_ref odsArg3 = nullptr); static ForOp create(::mlir::OpBuilder &builder, ::mlir::Location location, Value lowerBound, Value upperBound, Value step, function_ref odsArg3 = nullptr); static ForOp create(::mlir::ImplicitLocOpBuilder &builder, Value lowerBound, Value upperBound, Value step, function_ref odsArg3 = nullptr); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verifyRegions(); static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); public: using BodyBuilderFn = function_ref; Value getInductionVar() { return getBody()->getArgument(0); } void setLowerBound(Value bound) { getOperation()->setOperand(0, bound); } void setUpperBound(Value bound) { getOperation()->setOperand(1, bound); } void setStep(Value step) { getOperation()->setOperand(2, step); } //===------------------------------------------------------------------===// // OpAsmOpInterface Methods //===------------------------------------------------------------------===// /// EmitC ops in the body can omit their 'emitc.' prefix in the assembly. static ::llvm::StringRef getDefaultDialect() { return "emitc"; } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::ForOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::FuncOp declarations //===----------------------------------------------------------------------===// namespace detail { class FuncOpGenericAdaptorBase { public: struct Properties { using arg_attrsTy = ::mlir::ArrayAttr; arg_attrsTy arg_attrs; auto getArgAttrs() const { auto &propStorage = this->arg_attrs; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setArgAttrs(const ::mlir::ArrayAttr &propValue) { this->arg_attrs = propValue; } using function_typeTy = ::mlir::TypeAttr; function_typeTy function_type; auto getFunctionType() const { auto &propStorage = this->function_type; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setFunctionType(const ::mlir::TypeAttr &propValue) { this->function_type = propValue; } using res_attrsTy = ::mlir::ArrayAttr; res_attrsTy res_attrs; auto getResAttrs() const { auto &propStorage = this->res_attrs; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setResAttrs(const ::mlir::ArrayAttr &propValue) { this->res_attrs = propValue; } using specifiersTy = ::mlir::ArrayAttr; specifiersTy specifiers; auto getSpecifiers() const { auto &propStorage = this->specifiers; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setSpecifiers(const ::mlir::ArrayAttr &propValue) { this->specifiers = propValue; } 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.arg_attrs == this->arg_attrs && rhs.function_type == this->function_type && rhs.res_attrs == this->res_attrs && rhs.specifiers == this->specifiers && 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: FuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.func", odsAttrs.getContext()); } FuncOpGenericAdaptorBase(FuncOp 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::TypeAttr getFunctionTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type); return attr; } ::mlir::FunctionType getFunctionType(); ::mlir::ArrayAttr getSpecifiersAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().specifiers); return attr; } ::std::optional< ::mlir::ArrayAttr > getSpecifiers(); ::mlir::ArrayAttr getArgAttrsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); return attr; } ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); ::mlir::ArrayAttr getResAttrsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); return attr; } ::std::optional< ::mlir::ArrayAttr > getResAttrs(); ::mlir::Region &getBody() { return *odsRegions[0]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class FuncOpGenericAdaptor : public detail::FuncOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::FuncOpGenericAdaptorBase; public: FuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} FuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : FuncOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} FuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : FuncOpGenericAdaptor(values, attrs, Properties{}, {}) {} FuncOpGenericAdaptor(RangeT values, const FuncOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> FuncOpGenericAdaptor(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 FuncOpAdaptor : public FuncOpGenericAdaptor<::mlir::ValueRange> { public: using FuncOpGenericAdaptor::FuncOpGenericAdaptor; FuncOpAdaptor(FuncOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class FuncOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = FuncOpAdaptor; template using GenericAdaptor = FuncOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("arg_attrs"), ::llvm::StringRef("function_type"), ::llvm::StringRef("res_attrs"), ::llvm::StringRef("specifiers"), ::llvm::StringRef("sym_name")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getArgAttrsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getArgAttrsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getFunctionTypeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getFunctionTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getResAttrsAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getResAttrsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getSpecifiersAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getSpecifiersAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getSymNameAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.func"); } 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(); ::mlir::TypeAttr getFunctionTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().function_type); } ::mlir::FunctionType getFunctionType(); ::mlir::ArrayAttr getSpecifiersAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().specifiers); } ::std::optional< ::mlir::ArrayAttr > getSpecifiers(); ::mlir::ArrayAttr getArgAttrsAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().arg_attrs); } ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); ::mlir::ArrayAttr getResAttrsAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().res_attrs); } ::std::optional< ::mlir::ArrayAttr > getResAttrs(); void setSymNameAttr(::mlir::StringAttr attr) { getProperties().sym_name = attr; } void setSymName(::llvm::StringRef attrValue); void setFunctionTypeAttr(::mlir::TypeAttr attr) { getProperties().function_type = attr; } void setFunctionType(::mlir::FunctionType attrValue); void setSpecifiersAttr(::mlir::ArrayAttr attr) { getProperties().specifiers = attr; } void setArgAttrsAttr(::mlir::ArrayAttr attr) { getProperties().arg_attrs = attr; } void setResAttrsAttr(::mlir::ArrayAttr attr) { getProperties().res_attrs = attr; } ::mlir::Attribute removeSpecifiersAttr() { auto attr = getProperties().specifiers; getProperties().specifiers = {}; return attr; } ::mlir::Attribute removeArgAttrsAttr() { auto attr = getProperties().arg_attrs; getProperties().arg_attrs = {}; return attr; } ::mlir::Attribute removeResAttrsAttr() { auto attr = getProperties().res_attrs; getProperties().res_attrs = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef name, FunctionType type, ArrayRef attrs = {}, ArrayRef argAttrs = {}); static FuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, StringRef name, FunctionType type, ArrayRef attrs = {}, ArrayRef argAttrs = {}); static FuncOp create(::mlir::ImplicitLocOpBuilder &builder, StringRef name, FunctionType type, ArrayRef attrs = {}, ArrayRef argAttrs = {}); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static FuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static FuncOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static FuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static FuncOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static FuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static FuncOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static FuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static FuncOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::FunctionType function_type, /*optional*/::mlir::ArrayAttr specifiers, /*optional*/::mlir::ArrayAttr arg_attrs, /*optional*/::mlir::ArrayAttr res_attrs); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static FuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static FuncOp 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 FuncOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static FuncOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); private: ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { return getAttributeNameForIndex((*this)->getName(), index); } static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { assert(index < 5 && "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: //===------------------------------------------------------------------===// // FunctionOpInterface Methods //===------------------------------------------------------------------===// /// Returns the region on the current operation that is callable. This may /// return null in the case of an external callable object, e.g. an external /// function. ::mlir::Region *getCallableRegion() { return isExternal() ? nullptr : &getBody(); } /// Returns the argument types of this function. ArrayRef getArgumentTypes() { return getFunctionType().getInputs(); } /// Returns the result types of this function. ArrayRef getResultTypes() { return getFunctionType().getResults(); } //===------------------------------------------------------------------===// // OpAsmOpInterface Methods //===------------------------------------------------------------------===// /// EmitC ops in the body can omit their 'emitc.' prefix in the assembly. static ::llvm::StringRef getDefaultDialect() { return "emitc"; } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::FuncOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::FuncOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::GetFieldOp declarations //===----------------------------------------------------------------------===// namespace detail { class GetFieldOpGenericAdaptorBase { public: struct Properties { using field_nameTy = ::mlir::FlatSymbolRefAttr; field_nameTy field_name; auto getFieldName() const { auto &propStorage = this->field_name; return ::llvm::cast<::mlir::FlatSymbolRefAttr>(propStorage); } void setFieldName(const ::mlir::FlatSymbolRefAttr &propValue) { this->field_name = propValue; } bool operator==(const Properties &rhs) const { return rhs.field_name == this->field_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: GetFieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.get_field", odsAttrs.getContext()); } GetFieldOpGenericAdaptorBase(GetFieldOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::FlatSymbolRefAttr getFieldNameAttr() { auto attr = ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().field_name); return attr; } ::llvm::StringRef getFieldName(); }; } // namespace detail template class GetFieldOpGenericAdaptor : public detail::GetFieldOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::GetFieldOpGenericAdaptorBase; public: GetFieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} GetFieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : GetFieldOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} GetFieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : GetFieldOpGenericAdaptor(values, attrs, Properties{}, {}) {} GetFieldOpGenericAdaptor(RangeT values, const GetFieldOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> GetFieldOpGenericAdaptor(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 GetFieldOpAdaptor : public GetFieldOpGenericAdaptor<::mlir::ValueRange> { public: using GetFieldOpGenericAdaptor::GetFieldOpGenericAdaptor; GetFieldOpAdaptor(GetFieldOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class GetFieldOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::HasAncestor::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::SymbolUserOpInterface::Trait, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = GetFieldOpAdaptor; template using GenericAdaptor = GetFieldOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("field_name")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getFieldNameAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getFieldNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.get_field"); } 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::Type> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*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::FlatSymbolRefAttr getFieldNameAttr() { return ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().field_name); } ::llvm::StringRef getFieldName(); void setFieldNameAttr(::mlir::FlatSymbolRefAttr attr) { getProperties().field_name = attr; } void setFieldName(::llvm::StringRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::FlatSymbolRefAttr field_name); static GetFieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::FlatSymbolRefAttr field_name); static GetFieldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::FlatSymbolRefAttr field_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr field_name); static GetFieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr field_name); static GetFieldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr field_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llvm::StringRef field_name); static GetFieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::llvm::StringRef field_name); static GetFieldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::llvm::StringRef field_name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef field_name); static GetFieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef field_name); static GetFieldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef field_name); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetFieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetFieldOp 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 GetFieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GetFieldOp 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 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: bool hasSideEffects() { return false; } bool alwaysInline() { return true; // C doesn't support references. } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::GetFieldOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::GetFieldOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::GetGlobalOp declarations //===----------------------------------------------------------------------===// namespace detail { class GetGlobalOpGenericAdaptorBase { public: struct Properties { using nameTy = ::mlir::FlatSymbolRefAttr; nameTy name; auto getName() const { auto &propStorage = this->name; return ::llvm::cast<::mlir::FlatSymbolRefAttr>(propStorage); } void setName(const ::mlir::FlatSymbolRefAttr &propValue) { this->name = propValue; } bool operator==(const Properties &rhs) const { return rhs.name == this->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: GetGlobalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.get_global", odsAttrs.getContext()); } GetGlobalOpGenericAdaptorBase(GetGlobalOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::FlatSymbolRefAttr getNameAttr() { auto attr = ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().name); return attr; } ::llvm::StringRef getName(); }; } // namespace detail template class GetGlobalOpGenericAdaptor : public detail::GetGlobalOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::GetGlobalOpGenericAdaptorBase; public: GetGlobalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} GetGlobalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : GetGlobalOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} GetGlobalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : GetGlobalOpGenericAdaptor(values, attrs, Properties{}, {}) {} GetGlobalOpGenericAdaptor(RangeT values, const GetGlobalOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> GetGlobalOpGenericAdaptor(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 GetGlobalOpAdaptor : public GetGlobalOpGenericAdaptor<::mlir::ValueRange> { public: using GetGlobalOpGenericAdaptor::GetGlobalOpGenericAdaptor; GetGlobalOpAdaptor(GetGlobalOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class GetGlobalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::SymbolUserOpInterface::Trait, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = GetGlobalOpAdaptor; template using GenericAdaptor = GetGlobalOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("name")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getNameAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.get_global"); } 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::Type> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*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::FlatSymbolRefAttr getNameAttr() { return ::llvm::cast<::mlir::FlatSymbolRefAttr>(getProperties().name); } ::llvm::StringRef getName(); void setNameAttr(::mlir::FlatSymbolRefAttr attr) { getProperties().name = attr; } void setName(::llvm::StringRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::FlatSymbolRefAttr name); static GetGlobalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::FlatSymbolRefAttr name); static GetGlobalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::FlatSymbolRefAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr name); static GetGlobalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr name); static GetGlobalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::FlatSymbolRefAttr name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llvm::StringRef name); static GetGlobalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::llvm::StringRef name); static GetGlobalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::llvm::StringRef name); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef name); static GetGlobalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef name); static GetGlobalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef name); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetGlobalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GetGlobalOp 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 GetGlobalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GetGlobalOp 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 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: bool hasSideEffects() { return false; } bool alwaysInline() { return true; // C doesn't support references. } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::GetGlobalOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::GetGlobalOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::GlobalOp declarations //===----------------------------------------------------------------------===// namespace detail { class GlobalOpGenericAdaptorBase { public: struct Properties { using const_specifierTy = ::mlir::UnitAttr; const_specifierTy const_specifier; auto getConstSpecifier() const { auto &propStorage = this->const_specifier; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setConstSpecifier(const ::mlir::UnitAttr &propValue) { this->const_specifier = propValue; } using extern_specifierTy = ::mlir::UnitAttr; extern_specifierTy extern_specifier; auto getExternSpecifier() const { auto &propStorage = this->extern_specifier; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setExternSpecifier(const ::mlir::UnitAttr &propValue) { this->extern_specifier = propValue; } using initial_valueTy = ::mlir::Attribute; initial_valueTy initial_value; auto getInitialValue() const { auto &propStorage = this->initial_value; return ::llvm::dyn_cast_or_null<::mlir::Attribute>(propStorage); } void setInitialValue(const ::mlir::Attribute &propValue) { this->initial_value = propValue; } using static_specifierTy = ::mlir::UnitAttr; static_specifierTy static_specifier; auto getStaticSpecifier() const { auto &propStorage = this->static_specifier; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setStaticSpecifier(const ::mlir::UnitAttr &propValue) { this->static_specifier = propValue; } 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; } using typeTy = ::mlir::TypeAttr; typeTy type; auto getType() const { auto &propStorage = this->type; return ::llvm::cast<::mlir::TypeAttr>(propStorage); } void setType(const ::mlir::TypeAttr &propValue) { this->type = propValue; } bool operator==(const Properties &rhs) const { return rhs.const_specifier == this->const_specifier && rhs.extern_specifier == this->extern_specifier && rhs.initial_value == this->initial_value && rhs.static_specifier == this->static_specifier && rhs.sym_name == this->sym_name && rhs.type == this->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: GlobalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.global", odsAttrs.getContext()); } GlobalOpGenericAdaptorBase(GlobalOp 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::TypeAttr getTypeAttr() { auto attr = ::llvm::cast<::mlir::TypeAttr>(getProperties().type); return attr; } ::mlir::Type getType(); ::mlir::Attribute getInitialValueAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().initial_value); return attr; } ::std::optional<::mlir::Attribute> getInitialValue(); ::mlir::UnitAttr getExternSpecifierAttr(); bool getExternSpecifier(); ::mlir::UnitAttr getStaticSpecifierAttr(); bool getStaticSpecifier(); ::mlir::UnitAttr getConstSpecifierAttr(); bool getConstSpecifier(); }; } // namespace detail template class GlobalOpGenericAdaptor : public detail::GlobalOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::GlobalOpGenericAdaptorBase; public: GlobalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} GlobalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : GlobalOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} GlobalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : GlobalOpGenericAdaptor(values, attrs, Properties{}, {}) {} GlobalOpGenericAdaptor(RangeT values, const GlobalOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> GlobalOpGenericAdaptor(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 GlobalOpAdaptor : public GlobalOpGenericAdaptor<::mlir::ValueRange> { public: using GlobalOpGenericAdaptor::GlobalOpGenericAdaptor; GlobalOpAdaptor(GlobalOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class GlobalOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = GlobalOpAdaptor; template using GenericAdaptor = GlobalOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("const_specifier"), ::llvm::StringRef("extern_specifier"), ::llvm::StringRef("initial_value"), ::llvm::StringRef("static_specifier"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("type")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getConstSpecifierAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getConstSpecifierAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getExternSpecifierAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getExternSpecifierAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getInitialValueAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getInitialValueAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } ::mlir::StringAttr getStaticSpecifierAttrName() { return getAttributeNameForIndex(3); } static ::mlir::StringAttr getStaticSpecifierAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 3); } ::mlir::StringAttr getSymNameAttrName() { return getAttributeNameForIndex(4); } static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 4); } ::mlir::StringAttr getTypeAttrName() { return getAttributeNameForIndex(5); } static ::mlir::StringAttr getTypeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 5); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.global"); } 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)}; } 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(); ::mlir::TypeAttr getTypeAttr() { return ::llvm::cast<::mlir::TypeAttr>(getProperties().type); } ::mlir::Type getType(); ::mlir::Attribute getInitialValueAttr() { return ::llvm::dyn_cast_or_null<::mlir::Attribute>(getProperties().initial_value); } ::std::optional<::mlir::Attribute> getInitialValue(); ::mlir::UnitAttr getExternSpecifierAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().extern_specifier); } bool getExternSpecifier(); ::mlir::UnitAttr getStaticSpecifierAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().static_specifier); } bool getStaticSpecifier(); ::mlir::UnitAttr getConstSpecifierAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().const_specifier); } bool getConstSpecifier(); void setSymNameAttr(::mlir::StringAttr attr) { getProperties().sym_name = attr; } void setSymName(::llvm::StringRef attrValue); void setTypeAttr(::mlir::TypeAttr attr) { getProperties().type = attr; } void setType(::mlir::Type attrValue); void setInitialValueAttr(::mlir::Attribute attr) { getProperties().initial_value = attr; } void setExternSpecifierAttr(::mlir::UnitAttr attr) { getProperties().extern_specifier = attr; } void setExternSpecifier(bool attrValue); void setStaticSpecifierAttr(::mlir::UnitAttr attr) { getProperties().static_specifier = attr; } void setStaticSpecifier(bool attrValue); void setConstSpecifierAttr(::mlir::UnitAttr attr) { getProperties().const_specifier = attr; } void setConstSpecifier(bool attrValue); ::mlir::Attribute removeInitialValueAttr() { auto attr = getProperties().initial_value; getProperties().initial_value = {}; return attr; } ::mlir::Attribute removeExternSpecifierAttr() { auto attr = getProperties().extern_specifier; getProperties().extern_specifier = {}; return attr; } ::mlir::Attribute removeStaticSpecifierAttr() { auto attr = getProperties().static_specifier; getProperties().static_specifier = {}; return attr; } ::mlir::Attribute removeConstSpecifierAttr() { auto attr = getProperties().const_specifier; getProperties().const_specifier = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value, /*optional*/::mlir::UnitAttr extern_specifier = nullptr, /*optional*/::mlir::UnitAttr static_specifier = nullptr, /*optional*/::mlir::UnitAttr const_specifier = nullptr); static GlobalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value, /*optional*/::mlir::UnitAttr extern_specifier = nullptr, /*optional*/::mlir::UnitAttr static_specifier = nullptr, /*optional*/::mlir::UnitAttr const_specifier = nullptr); static GlobalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value, /*optional*/::mlir::UnitAttr extern_specifier = nullptr, /*optional*/::mlir::UnitAttr static_specifier = nullptr, /*optional*/::mlir::UnitAttr const_specifier = nullptr); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value, /*optional*/::mlir::UnitAttr extern_specifier = nullptr, /*optional*/::mlir::UnitAttr static_specifier = nullptr, /*optional*/::mlir::UnitAttr const_specifier = nullptr); static GlobalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value, /*optional*/::mlir::UnitAttr extern_specifier = nullptr, /*optional*/::mlir::UnitAttr static_specifier = nullptr, /*optional*/::mlir::UnitAttr const_specifier = nullptr); static GlobalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::TypeAttr type, /*optional*/::mlir::Attribute initial_value, /*optional*/::mlir::UnitAttr extern_specifier = nullptr, /*optional*/::mlir::UnitAttr static_specifier = nullptr, /*optional*/::mlir::UnitAttr const_specifier = nullptr); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value, /*optional*/bool extern_specifier = false, /*optional*/bool static_specifier = false, /*optional*/bool const_specifier = false); static GlobalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value, /*optional*/bool extern_specifier = false, /*optional*/bool static_specifier = false, /*optional*/bool const_specifier = false); static GlobalOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value, /*optional*/bool extern_specifier = false, /*optional*/bool static_specifier = false, /*optional*/bool const_specifier = false); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value, /*optional*/bool extern_specifier = false, /*optional*/bool static_specifier = false, /*optional*/bool const_specifier = false); static GlobalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value, /*optional*/bool extern_specifier = false, /*optional*/bool static_specifier = false, /*optional*/bool const_specifier = false); static GlobalOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::mlir::Type type, /*optional*/::mlir::Attribute initial_value, /*optional*/bool extern_specifier = false, /*optional*/bool static_specifier = false, /*optional*/bool const_specifier = false); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GlobalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static GlobalOp 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 GlobalOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static GlobalOp 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 < 6 && "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::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::GlobalOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::GlobalOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::IfOp declarations //===----------------------------------------------------------------------===// namespace detail { class IfOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: IfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.if", odsAttrs.getContext()); } IfOpGenericAdaptorBase(IfOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Region &getThenRegion() { return *odsRegions[0]; } ::mlir::Region &getElseRegion() { return *odsRegions[1]; } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class IfOpGenericAdaptor : public detail::IfOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::IfOpGenericAdaptorBase; static constexpr int odsIndex_condition = 0; public: IfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} IfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : IfOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} IfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : IfOpGenericAdaptor(values, attrs, Properties{}, {}) {} IfOpGenericAdaptor(RangeT values, const IfOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> IfOpGenericAdaptor(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)}; } ValueT getCondition() { return (*getODSOperands(0).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class IfOpAdaptor : public IfOpGenericAdaptor<::mlir::ValueRange> { public: using IfOpGenericAdaptor::IfOpGenericAdaptor; IfOpAdaptor(IfOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class IfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::NoRegionArguments, ::mlir::OpTrait::OpInvariants, ::mlir::RegionBranchOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects> { public: using Op::Op; using Op::print; using Adaptor = IfOpAdaptor; template using GenericAdaptor = IfOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_condition = 0; using Properties = FoldAdaptor::Properties; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorOperands; using ::mlir::RegionBranchOpInterface::Trait::getSuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getPredecessors; using ::mlir::RegionBranchOpInterface::Trait::getPredecessorValues; using ::mlir::RegionBranchOpInterface::Trait::areTypesCompatible; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.if"); } 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)}; } ::mlir::TypedValue<::mlir::IntegerType> getCondition() { return ::llvm::cast<::mlir::TypedValue<::mlir::IntegerType>>(*getODSOperands(0).begin()); } ::mlir::OpOperand &getConditionMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } 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 &getThenRegion() { return (*this)->getRegion(0); } ::mlir::Region &getElseRegion() { return (*this)->getRegion(1); } 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, Value cond, bool addThenBlock, bool addElseBlock); static IfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, Value cond, bool addThenBlock, bool addElseBlock); static IfOp create(::mlir::ImplicitLocOpBuilder &builder, Value cond, bool addThenBlock, bool addElseBlock); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value cond, bool withElseRegion); static IfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, Value cond, bool withElseRegion); static IfOp create(::mlir::ImplicitLocOpBuilder &builder, Value cond, bool withElseRegion); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value cond, function_ref thenBuilder = buildTerminatedBody, function_ref elseBuilder = nullptr); static IfOp create(::mlir::OpBuilder &builder, ::mlir::Location location, Value cond, function_ref thenBuilder = buildTerminatedBody, function_ref elseBuilder = nullptr); static IfOp create(::mlir::ImplicitLocOpBuilder &builder, Value cond, function_ref thenBuilder = buildTerminatedBody, function_ref elseBuilder = nullptr); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); void getEntrySuccessorRegions(::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); ::mlir::ValueRange getSuccessorInputs(::mlir::RegionSuccessor successor); void getRegionInvocationBounds(::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::InvocationBounds> &invocationBounds); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); public: OpBuilder getThenBodyBuilder(OpBuilder::Listener *listener = nullptr) { Block* body = getBody(0); return OpBuilder::atBlockEnd(body, listener); } OpBuilder getElseBodyBuilder(OpBuilder::Listener *listener = nullptr) { Block* body = getBody(1); return OpBuilder::atBlockEnd(body, listener); } //===------------------------------------------------------------------===// // OpAsmOpInterface Methods //===------------------------------------------------------------------===// /// EmitC ops in the body can omit their 'emitc.' prefix in the assembly. static ::llvm::StringRef getDefaultDialect() { return "emitc"; } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::IfOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::IncludeOp declarations //===----------------------------------------------------------------------===// namespace detail { class IncludeOpGenericAdaptorBase { public: struct Properties { using includeTy = ::mlir::StringAttr; includeTy include; auto getInclude() const { auto &propStorage = this->include; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setInclude(const ::mlir::StringAttr &propValue) { this->include = propValue; } using is_standard_includeTy = ::mlir::UnitAttr; is_standard_includeTy is_standard_include; auto getIsStandardInclude() const { auto &propStorage = this->is_standard_include; return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); } void setIsStandardInclude(const ::mlir::UnitAttr &propValue) { this->is_standard_include = propValue; } bool operator==(const Properties &rhs) const { return rhs.include == this->include && rhs.is_standard_include == this->is_standard_include && 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: IncludeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.include", odsAttrs.getContext()); } IncludeOpGenericAdaptorBase(IncludeOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getIncludeAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().include); return attr; } ::llvm::StringRef getInclude(); ::mlir::UnitAttr getIsStandardIncludeAttr(); bool getIsStandardInclude(); }; } // namespace detail template class IncludeOpGenericAdaptor : public detail::IncludeOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::IncludeOpGenericAdaptorBase; public: IncludeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} IncludeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : IncludeOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} IncludeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : IncludeOpGenericAdaptor(values, attrs, Properties{}, {}) {} IncludeOpGenericAdaptor(RangeT values, const IncludeOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> IncludeOpGenericAdaptor(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 IncludeOpAdaptor : public IncludeOpGenericAdaptor<::mlir::ValueRange> { public: using IncludeOpGenericAdaptor::IncludeOpGenericAdaptor; IncludeOpAdaptor(IncludeOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class IncludeOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = IncludeOpAdaptor; template using GenericAdaptor = IncludeOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("include"), ::llvm::StringRef("is_standard_include")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getIncludeAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getIncludeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getIsStandardIncludeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getIsStandardIncludeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.include"); } 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)}; } 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 getIncludeAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().include); } ::llvm::StringRef getInclude(); ::mlir::UnitAttr getIsStandardIncludeAttr() { return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(getProperties().is_standard_include); } bool getIsStandardInclude(); void setIncludeAttr(::mlir::StringAttr attr) { getProperties().include = attr; } void setInclude(::llvm::StringRef attrValue); void setIsStandardIncludeAttr(::mlir::UnitAttr attr) { getProperties().is_standard_include = attr; } void setIsStandardInclude(bool attrValue); ::mlir::Attribute removeIsStandardIncludeAttr() { auto attr = getProperties().is_standard_include; getProperties().is_standard_include = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr include, /*optional*/::mlir::UnitAttr is_standard_include = nullptr); static IncludeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr include, /*optional*/::mlir::UnitAttr is_standard_include = nullptr); static IncludeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr include, /*optional*/::mlir::UnitAttr is_standard_include = nullptr); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr include, /*optional*/::mlir::UnitAttr is_standard_include = nullptr); static IncludeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr include, /*optional*/::mlir::UnitAttr is_standard_include = nullptr); static IncludeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr include, /*optional*/::mlir::UnitAttr is_standard_include = nullptr); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef include, /*optional*/bool is_standard_include = false); static IncludeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef include, /*optional*/bool is_standard_include = false); static IncludeOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef include, /*optional*/bool is_standard_include = false); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef include, /*optional*/bool is_standard_include = false); static IncludeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef include, /*optional*/bool is_standard_include = false); static IncludeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef include, /*optional*/bool is_standard_include = false); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static IncludeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static IncludeOp 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 IncludeOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static IncludeOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &p); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); 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::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::IncludeOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::IncludeOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::LiteralOp declarations //===----------------------------------------------------------------------===// namespace detail { class LiteralOpGenericAdaptorBase { public: struct Properties { using valueTy = ::mlir::StringAttr; valueTy value; auto getValue() const { auto &propStorage = this->value; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setValue(const ::mlir::StringAttr &propValue) { this->value = propValue; } bool operator==(const Properties &rhs) const { return rhs.value == this->value && 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: LiteralOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.literal", odsAttrs.getContext()); } LiteralOpGenericAdaptorBase(LiteralOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getValueAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().value); return attr; } ::llvm::StringRef getValue(); }; } // namespace detail template class LiteralOpGenericAdaptor : public detail::LiteralOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::LiteralOpGenericAdaptorBase; public: LiteralOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} LiteralOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : LiteralOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} LiteralOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : LiteralOpGenericAdaptor(values, attrs, Properties{}, {}) {} LiteralOpGenericAdaptor(RangeT values, const LiteralOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> LiteralOpGenericAdaptor(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 LiteralOpAdaptor : public LiteralOpGenericAdaptor<::mlir::ValueRange> { public: using LiteralOpGenericAdaptor::LiteralOpGenericAdaptor; LiteralOpAdaptor(LiteralOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class LiteralOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = LiteralOpAdaptor; template using GenericAdaptor = LiteralOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getValueAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.literal"); } 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::Type> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*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 getValueAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().value); } ::llvm::StringRef getValue(); void setValueAttr(::mlir::StringAttr attr) { getProperties().value = attr; } void setValue(::llvm::StringRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::StringAttr value); static LiteralOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::StringAttr value); static LiteralOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::StringAttr value); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr value); static LiteralOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr value); static LiteralOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr value); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llvm::StringRef value); static LiteralOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::llvm::StringRef value); static LiteralOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::llvm::StringRef value); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef value); static LiteralOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef value); static LiteralOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef value); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static LiteralOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static LiteralOp 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 LiteralOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static LiteralOp 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); 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: bool hasSideEffects() { return false; } bool alwaysInline() { return true; // Always inlined by design. } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::LiteralOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::LiteralOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::LoadOp declarations //===----------------------------------------------------------------------===// namespace detail { class LoadOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: LoadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.load", odsAttrs.getContext()); } LoadOpGenericAdaptorBase(LoadOp 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 LoadOpGenericAdaptor : public detail::LoadOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::LoadOpGenericAdaptorBase; static constexpr int odsIndex_operand = 0; public: LoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} LoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : LoadOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} LoadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : LoadOpGenericAdaptor(values, attrs, Properties{}, {}) {} LoadOpGenericAdaptor(RangeT values, const LoadOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> LoadOpGenericAdaptor(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)}; } ValueT getOperand() { return (*getODSOperands(0).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class LoadOpAdaptor : public LoadOpGenericAdaptor<::mlir::ValueRange> { public: using LoadOpGenericAdaptor::LoadOpGenericAdaptor; LoadOpAdaptor(LoadOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class LoadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = LoadOpAdaptor; template using GenericAdaptor = LoadOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_operand = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.load"); } 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)}; } ::mlir::TypedValue<::mlir::emitc::LValueType> getOperand() { return ::llvm::cast<::mlir::TypedValue<::mlir::emitc::LValueType>>(*getODSOperands(0).begin()); } ::mlir::OpOperand &getOperandMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } 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::Type> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*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 result, ::mlir::Value operand); static LoadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value operand); static LoadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value operand); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); static LoadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value operand); static LoadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value operand); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static LoadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static LoadOp 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 LoadOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static LoadOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); 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); public: }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::LoadOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::LogicalAndOp declarations //===----------------------------------------------------------------------===// namespace detail { class LogicalAndOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: LogicalAndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.logical_and", odsAttrs.getContext()); } LogicalAndOpGenericAdaptorBase(LogicalAndOp 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 LogicalAndOpGenericAdaptor : public detail::LogicalAndOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::LogicalAndOpGenericAdaptorBase; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; public: LogicalAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} LogicalAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : LogicalAndOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} LogicalAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : LogicalAndOpGenericAdaptor(values, attrs, Properties{}, {}) {} LogicalAndOpGenericAdaptor(RangeT values, const LogicalAndOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> LogicalAndOpGenericAdaptor(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)}; } ValueT getLhs() { return (*getODSOperands(0).begin()); } ValueT getRhs() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class LogicalAndOpAdaptor : public LogicalAndOpGenericAdaptor<::mlir::ValueRange> { public: using LogicalAndOpGenericAdaptor::LogicalAndOpGenericAdaptor; LogicalAndOpAdaptor(LogicalAndOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class LogicalAndOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = LogicalAndOpAdaptor; template using GenericAdaptor = LogicalAndOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.logical_and"); } 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)}; } ::mlir::TypedValue<::mlir::Type> getLhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getRhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::OpOperand &getLhsMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getRhsMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } 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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static LogicalAndOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static LogicalAndOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static LogicalAndOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static LogicalAndOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static LogicalAndOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static LogicalAndOp 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 LogicalAndOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static LogicalAndOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: bool hasSideEffects() { // If both operands are fundamental types, the operation is pure. return !isFundamentalType(getOperand(0).getType()) || !isFundamentalType(getOperand(1).getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::LogicalAndOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::LogicalNotOp declarations //===----------------------------------------------------------------------===// namespace detail { class LogicalNotOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: LogicalNotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.logical_not", odsAttrs.getContext()); } LogicalNotOpGenericAdaptorBase(LogicalNotOp 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 LogicalNotOpGenericAdaptor : public detail::LogicalNotOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::LogicalNotOpGenericAdaptorBase; public: LogicalNotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} LogicalNotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : LogicalNotOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} LogicalNotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : LogicalNotOpGenericAdaptor(values, attrs, Properties{}, {}) {} LogicalNotOpGenericAdaptor(RangeT values, const LogicalNotOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> LogicalNotOpGenericAdaptor(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 LogicalNotOpAdaptor : public LogicalNotOpGenericAdaptor<::mlir::ValueRange> { public: using LogicalNotOpGenericAdaptor::LogicalNotOpGenericAdaptor; LogicalNotOpAdaptor(LogicalNotOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class LogicalNotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = LogicalNotOpAdaptor; template using GenericAdaptor = LogicalNotOpGenericAdaptor; 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("emitc.logical_not"); } 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)}; } 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 resultType0, ::mlir::Value odsArg_0); static LogicalNotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value odsArg_0); static LogicalNotOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value odsArg_0); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0); static LogicalNotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0); static LogicalNotOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static LogicalNotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static LogicalNotOp 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 LogicalNotOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static LogicalNotOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: bool hasSideEffects() { // If operand is fundamental type, the operation is pure. return !isFundamentalType(getOperand().getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::LogicalNotOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::LogicalOrOp declarations //===----------------------------------------------------------------------===// namespace detail { class LogicalOrOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: LogicalOrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.logical_or", odsAttrs.getContext()); } LogicalOrOpGenericAdaptorBase(LogicalOrOp 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 LogicalOrOpGenericAdaptor : public detail::LogicalOrOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::LogicalOrOpGenericAdaptorBase; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; public: LogicalOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} LogicalOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : LogicalOrOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} LogicalOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : LogicalOrOpGenericAdaptor(values, attrs, Properties{}, {}) {} LogicalOrOpGenericAdaptor(RangeT values, const LogicalOrOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> LogicalOrOpGenericAdaptor(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)}; } ValueT getLhs() { return (*getODSOperands(0).begin()); } ValueT getRhs() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class LogicalOrOpAdaptor : public LogicalOrOpGenericAdaptor<::mlir::ValueRange> { public: using LogicalOrOpGenericAdaptor::LogicalOrOpGenericAdaptor; LogicalOrOpAdaptor(LogicalOrOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class LogicalOrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = LogicalOrOpAdaptor; template using GenericAdaptor = LogicalOrOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.logical_or"); } 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)}; } ::mlir::TypedValue<::mlir::Type> getLhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getRhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::OpOperand &getLhsMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getRhsMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } 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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static LogicalOrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static LogicalOrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static LogicalOrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static LogicalOrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static LogicalOrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static LogicalOrOp 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 LogicalOrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static LogicalOrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: bool hasSideEffects() { // If both operands are fundamental types, the operation is pure. return !isFundamentalType(getOperand(0).getType()) || !isFundamentalType(getOperand(1).getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::LogicalOrOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::MemberCallOpaqueOp declarations //===----------------------------------------------------------------------===// namespace detail { class MemberCallOpaqueOpGenericAdaptorBase { public: struct Properties { using argsTy = ::mlir::ArrayAttr; argsTy args; auto getArgs() const { auto &propStorage = this->args; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setArgs(const ::mlir::ArrayAttr &propValue) { this->args = propValue; } using calleeTy = ::mlir::StringAttr; calleeTy callee; auto getCallee() const { auto &propStorage = this->callee; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setCallee(const ::mlir::StringAttr &propValue) { this->callee = propValue; } using template_argsTy = ::mlir::ArrayAttr; template_argsTy template_args; auto getTemplateArgs() const { auto &propStorage = this->template_args; return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); } void setTemplateArgs(const ::mlir::ArrayAttr &propValue) { this->template_args = propValue; } bool operator==(const Properties &rhs) const { return rhs.args == this->args && rhs.callee == this->callee && rhs.template_args == this->template_args && 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: MemberCallOpaqueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.member_call_opaque", odsAttrs.getContext()); } MemberCallOpaqueOpGenericAdaptorBase(MemberCallOpaqueOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getCalleeAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().callee); return attr; } ::llvm::StringRef getCallee(); ::mlir::ArrayAttr getArgsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().args); return attr; } ::std::optional< ::mlir::ArrayAttr > getArgs(); ::mlir::ArrayAttr getTemplateArgsAttr() { auto attr = ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().template_args); return attr; } ::std::optional< ::mlir::ArrayAttr > getTemplateArgs(); }; } // namespace detail template class MemberCallOpaqueOpGenericAdaptor : public detail::MemberCallOpaqueOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::MemberCallOpaqueOpGenericAdaptorBase; static constexpr int odsIndex_receiver = 0; static constexpr int odsIndex_arg_operands = 1; public: MemberCallOpaqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} MemberCallOpaqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MemberCallOpaqueOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} MemberCallOpaqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : MemberCallOpaqueOpGenericAdaptor(values, attrs, Properties{}, {}) {} MemberCallOpaqueOpGenericAdaptor(RangeT values, const MemberCallOpaqueOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> MemberCallOpaqueOpGenericAdaptor(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)}; } ValueT getReceiver() { return (*getODSOperands(0).begin()); } RangeT getArgOperands() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class MemberCallOpaqueOpAdaptor : public MemberCallOpaqueOpGenericAdaptor<::mlir::ValueRange> { public: using MemberCallOpaqueOpGenericAdaptor::MemberCallOpaqueOpGenericAdaptor; MemberCallOpaqueOpAdaptor(MemberCallOpaqueOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class MemberCallOpaqueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = MemberCallOpaqueOpAdaptor; template using GenericAdaptor = MemberCallOpaqueOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_receiver = 0; static constexpr int odsIndex_arg_operands = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("args"), ::llvm::StringRef("callee"), ::llvm::StringRef("template_args")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getArgsAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getArgsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } ::mlir::StringAttr getCalleeAttrName() { return getAttributeNameForIndex(1); } static ::mlir::StringAttr getCalleeAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 1); } ::mlir::StringAttr getTemplateArgsAttrName() { return getAttributeNameForIndex(2); } static ::mlir::StringAttr getTemplateArgsAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 2); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.member_call_opaque"); } 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::TypedValue<::mlir::Type> getReceiver() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::Operation::operand_range getArgOperands() { return getODSOperands(1); } ::mlir::OpOperand &getReceiverMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getArgOperandsMutable(); std::pair getODSResultIndexAndLength(unsigned index); ::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::StringAttr getCalleeAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().callee); } ::llvm::StringRef getCallee(); ::mlir::ArrayAttr getArgsAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().args); } ::std::optional< ::mlir::ArrayAttr > getArgs(); ::mlir::ArrayAttr getTemplateArgsAttr() { return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(getProperties().template_args); } ::std::optional< ::mlir::ArrayAttr > getTemplateArgs(); void setCalleeAttr(::mlir::StringAttr attr) { getProperties().callee = attr; } void setCallee(::llvm::StringRef attrValue); void setArgsAttr(::mlir::ArrayAttr attr) { getProperties().args = attr; } void setTemplateArgsAttr(::mlir::ArrayAttr attr) { getProperties().template_args = attr; } ::mlir::Attribute removeArgsAttr() { auto attr = getProperties().args; getProperties().args = {}; return attr; } ::mlir::Attribute removeTemplateArgsAttr() { auto attr = getProperties().template_args; getProperties().template_args = {}; return attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value receiver, ::mlir::StringAttr callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands); static MemberCallOpaqueOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultType0, ::mlir::Value receiver, ::mlir::StringAttr callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands); static MemberCallOpaqueOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultType0, ::mlir::Value receiver, ::mlir::StringAttr callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value receiver, ::llvm::StringRef callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands); static MemberCallOpaqueOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultType0, ::mlir::Value receiver, ::llvm::StringRef callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands); static MemberCallOpaqueOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultType0, ::mlir::Value receiver, ::llvm::StringRef callee, /*optional*/::mlir::ArrayAttr args, /*optional*/::mlir::ArrayAttr template_args, ::mlir::ValueRange arg_operands); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static MemberCallOpaqueOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static MemberCallOpaqueOp 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 MemberCallOpaqueOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static MemberCallOpaqueOp 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); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); 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 < 3 && "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::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::MemberCallOpaqueOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::MemberCallOpaqueOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::MemberOfPtrOp declarations //===----------------------------------------------------------------------===// namespace detail { class MemberOfPtrOpGenericAdaptorBase { public: struct Properties { using memberTy = ::mlir::StringAttr; memberTy member; auto getMember() const { auto &propStorage = this->member; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setMember(const ::mlir::StringAttr &propValue) { this->member = propValue; } bool operator==(const Properties &rhs) const { return rhs.member == this->member && 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: MemberOfPtrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.member_of_ptr", odsAttrs.getContext()); } MemberOfPtrOpGenericAdaptorBase(MemberOfPtrOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getMemberAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().member); return attr; } ::llvm::StringRef getMember(); }; } // namespace detail template class MemberOfPtrOpGenericAdaptor : public detail::MemberOfPtrOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::MemberOfPtrOpGenericAdaptorBase; static constexpr int odsIndex_operand = 0; public: MemberOfPtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} MemberOfPtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MemberOfPtrOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} MemberOfPtrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : MemberOfPtrOpGenericAdaptor(values, attrs, Properties{}, {}) {} MemberOfPtrOpGenericAdaptor(RangeT values, const MemberOfPtrOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> MemberOfPtrOpGenericAdaptor(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)}; } ValueT getOperand() { return (*getODSOperands(0).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class MemberOfPtrOpAdaptor : public MemberOfPtrOpGenericAdaptor<::mlir::ValueRange> { public: using MemberOfPtrOpGenericAdaptor::MemberOfPtrOpGenericAdaptor; MemberOfPtrOpAdaptor(MemberOfPtrOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class MemberOfPtrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = MemberOfPtrOpAdaptor; template using GenericAdaptor = MemberOfPtrOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_operand = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("member")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getMemberAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getMemberAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.member_of_ptr"); } 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)}; } ::mlir::TypedValue<::mlir::emitc::LValueType> getOperand() { return ::llvm::cast<::mlir::TypedValue<::mlir::emitc::LValueType>>(*getODSOperands(0).begin()); } ::mlir::OpOperand &getOperandMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } 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::StringAttr getMemberAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().member); } ::llvm::StringRef getMember(); void setMemberAttr(::mlir::StringAttr attr) { getProperties().member = attr; } void setMember(::llvm::StringRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::StringAttr member, ::mlir::Value operand); static MemberOfPtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::StringAttr member, ::mlir::Value operand); static MemberOfPtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::StringAttr member, ::mlir::Value operand); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr member, ::mlir::Value operand); static MemberOfPtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr member, ::mlir::Value operand); static MemberOfPtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr member, ::mlir::Value operand); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::llvm::StringRef member, ::mlir::Value operand); static MemberOfPtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::llvm::StringRef member, ::mlir::Value operand); static MemberOfPtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::llvm::StringRef member, ::mlir::Value operand); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef member, ::mlir::Value operand); static MemberOfPtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef member, ::mlir::Value operand); static MemberOfPtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef member, ::mlir::Value operand); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static MemberOfPtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static MemberOfPtrOp 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 MemberOfPtrOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static MemberOfPtrOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); 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: bool hasSideEffects() { return false; } bool alwaysInline() { return true; // C doesn't support references. } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::MemberOfPtrOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::MemberOfPtrOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::MemberOp declarations //===----------------------------------------------------------------------===// namespace detail { class MemberOpGenericAdaptorBase { public: struct Properties { using memberTy = ::mlir::StringAttr; memberTy member; auto getMember() const { auto &propStorage = this->member; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setMember(const ::mlir::StringAttr &propValue) { this->member = propValue; } bool operator==(const Properties &rhs) const { return rhs.member == this->member && 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: MemberOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.member", odsAttrs.getContext()); } MemberOpGenericAdaptorBase(MemberOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getMemberAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().member); return attr; } ::llvm::StringRef getMember(); }; } // namespace detail template class MemberOpGenericAdaptor : public detail::MemberOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::MemberOpGenericAdaptorBase; static constexpr int odsIndex_operand = 0; public: MemberOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} MemberOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MemberOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} MemberOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : MemberOpGenericAdaptor(values, attrs, Properties{}, {}) {} MemberOpGenericAdaptor(RangeT values, const MemberOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> MemberOpGenericAdaptor(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)}; } ValueT getOperand() { return (*getODSOperands(0).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class MemberOpAdaptor : public MemberOpGenericAdaptor<::mlir::ValueRange> { public: using MemberOpGenericAdaptor::MemberOpGenericAdaptor; MemberOpAdaptor(MemberOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class MemberOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = MemberOpAdaptor; template using GenericAdaptor = MemberOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_operand = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("member")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getMemberAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getMemberAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.member"); } 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)}; } ::mlir::TypedValue<::mlir::Type> getOperand() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::OpOperand &getOperandMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } 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::StringAttr getMemberAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().member); } ::llvm::StringRef getMember(); void setMemberAttr(::mlir::StringAttr attr) { getProperties().member = attr; } void setMember(::llvm::StringRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::StringAttr member, ::mlir::Value operand); static MemberOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::StringAttr member, ::mlir::Value operand); static MemberOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::StringAttr member, ::mlir::Value operand); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr member, ::mlir::Value operand); static MemberOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr member, ::mlir::Value operand); static MemberOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr member, ::mlir::Value operand); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::llvm::StringRef member, ::mlir::Value operand); static MemberOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::llvm::StringRef member, ::mlir::Value operand); static MemberOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::llvm::StringRef member, ::mlir::Value operand); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef member, ::mlir::Value operand); static MemberOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef member, ::mlir::Value operand); static MemberOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef member, ::mlir::Value operand); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static MemberOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static MemberOp 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 MemberOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static MemberOp 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 ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); 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: bool hasSideEffects() { return false; } bool alwaysInline() { // C doesn't support references. return isa(getResult().getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::MemberOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::MemberOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::MulOp declarations //===----------------------------------------------------------------------===// namespace detail { class MulOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: MulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.mul", odsAttrs.getContext()); } MulOpGenericAdaptorBase(MulOp 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 MulOpGenericAdaptor : public detail::MulOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::MulOpGenericAdaptorBase; public: MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : MulOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : MulOpGenericAdaptor(values, attrs, Properties{}, {}) {} MulOpGenericAdaptor(RangeT values, const MulOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> MulOpGenericAdaptor(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 MulOpAdaptor : public MulOpGenericAdaptor<::mlir::ValueRange> { public: using MulOpGenericAdaptor::MulOpGenericAdaptor; MulOpAdaptor(MulOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class MulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = MulOpAdaptor; template using GenericAdaptor = MulOpGenericAdaptor; 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("emitc.mul"); } 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)}; } 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 resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static MulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static MulOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static MulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static MulOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static MulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static MulOp 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 MulOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static MulOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: bool hasSideEffects() { // If both operands are fundamental types, the operation is pure. return !isFundamentalType(getOperand(0).getType()) || !isFundamentalType(getOperand(1).getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::MulOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::RemOp declarations //===----------------------------------------------------------------------===// namespace detail { class RemOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: RemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.rem", odsAttrs.getContext()); } RemOpGenericAdaptorBase(RemOp 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 RemOpGenericAdaptor : public detail::RemOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::RemOpGenericAdaptorBase; public: RemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} RemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : RemOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} RemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : RemOpGenericAdaptor(values, attrs, Properties{}, {}) {} RemOpGenericAdaptor(RangeT values, const RemOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> RemOpGenericAdaptor(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 RemOpAdaptor : public RemOpGenericAdaptor<::mlir::ValueRange> { public: using RemOpGenericAdaptor::RemOpGenericAdaptor; RemOpAdaptor(RemOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class RemOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = RemOpAdaptor; template using GenericAdaptor = RemOpGenericAdaptor; 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("emitc.rem"); } 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)}; } 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 resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static RemOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static RemOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static RemOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static RemOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0, ::mlir::Value odsArg_1); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static RemOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static RemOp 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 RemOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static RemOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: bool hasSideEffects() { // If both operands are fundamental types, the operation is pure. return !isFundamentalType(getOperand(0).getType()) || !isFundamentalType(getOperand(1).getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::RemOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::ReturnOp declarations //===----------------------------------------------------------------------===// namespace detail { class ReturnOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.return", odsAttrs.getContext()); } ReturnOpGenericAdaptorBase(ReturnOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class ReturnOpGenericAdaptor : public detail::ReturnOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::ReturnOpGenericAdaptorBase; static constexpr int odsIndex_operand = 0; public: ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : ReturnOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : ReturnOpGenericAdaptor(values, attrs, Properties{}, {}) {} ReturnOpGenericAdaptor(RangeT values, const ReturnOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> ReturnOpGenericAdaptor(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)}; } ValueT getOperand() { auto operands = getODSOperands(0); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class ReturnOpAdaptor : public ReturnOpGenericAdaptor<::mlir::ValueRange> { public: using ReturnOpGenericAdaptor::ReturnOpGenericAdaptor; ReturnOpAdaptor(ReturnOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class ReturnOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::RegionBranchTerminatorOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::OpTrait::IsTerminator> { public: using Op::Op; using Op::print; using Adaptor = ReturnOpAdaptor; template using GenericAdaptor = ReturnOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_operand = 0; using Properties = FoldAdaptor::Properties; using ::mlir::RegionBranchTerminatorOpInterface::Trait::getMutableSuccessorOperands; using ::mlir::RegionBranchTerminatorOpInterface::Trait::getSuccessorRegions; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.return"); } 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::TypedValue<::mlir::Type> getOperand() { auto operands = getODSOperands(0); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::MutableOperandRange getOperandMutable(); 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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value operand); static ReturnOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value operand); static ReturnOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value operand); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value operand); static ReturnOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value operand); static ReturnOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value operand); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReturnOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static ReturnOp 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 ReturnOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static ReturnOp 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); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); public: }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::ReturnOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::SubOp declarations //===----------------------------------------------------------------------===// namespace detail { class SubOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: SubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.sub", odsAttrs.getContext()); } SubOpGenericAdaptorBase(SubOp 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 SubOpGenericAdaptor : public detail::SubOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::SubOpGenericAdaptorBase; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; public: SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SubOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : SubOpGenericAdaptor(values, attrs, Properties{}, {}) {} SubOpGenericAdaptor(RangeT values, const SubOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> SubOpGenericAdaptor(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)}; } ValueT getLhs() { return (*getODSOperands(0).begin()); } ValueT getRhs() { return (*getODSOperands(1).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class SubOpAdaptor : public SubOpGenericAdaptor<::mlir::ValueRange> { public: using SubOpGenericAdaptor::SubOpGenericAdaptor; SubOpAdaptor(SubOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class SubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = SubOpAdaptor; template using GenericAdaptor = SubOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_lhs = 0; static constexpr int odsIndex_rhs = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.sub"); } 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)}; } ::mlir::TypedValue<::mlir::Type> getLhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::TypedValue<::mlir::Type> getRhs() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(1).begin()); } ::mlir::OpOperand &getLhsMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::OpOperand &getRhsMutable() { auto range = getODSOperandIndexAndLength(1); return getOperation()->getOpOperand(range.first); } 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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static SubOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static SubOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static SubOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static SubOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static SubOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static SubOp 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 SubOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static SubOp 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); public: bool hasSideEffects() { // If both operands are fundamental types, the operation is pure. return !isFundamentalType(getOperand(0).getType()) || !isFundamentalType(getOperand(1).getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::SubOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::SubscriptOp declarations //===----------------------------------------------------------------------===// namespace detail { class SubscriptOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: SubscriptOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.subscript", odsAttrs.getContext()); } SubscriptOpGenericAdaptorBase(SubscriptOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class SubscriptOpGenericAdaptor : public detail::SubscriptOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::SubscriptOpGenericAdaptorBase; static constexpr int odsIndex_value = 0; static constexpr int odsIndex_indices = 1; public: SubscriptOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} SubscriptOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SubscriptOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} SubscriptOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : SubscriptOpGenericAdaptor(values, attrs, Properties{}, {}) {} SubscriptOpGenericAdaptor(RangeT values, const SubscriptOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> SubscriptOpGenericAdaptor(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)}; } ValueT getValue() { return (*getODSOperands(0).begin()); } RangeT getIndices() { return getODSOperands(1); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class SubscriptOpAdaptor : public SubscriptOpGenericAdaptor<::mlir::ValueRange> { public: using SubscriptOpGenericAdaptor::SubscriptOpGenericAdaptor; SubscriptOpAdaptor(SubscriptOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class SubscriptOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = SubscriptOpAdaptor; template using GenericAdaptor = SubscriptOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_value = 0; static constexpr int odsIndex_indices = 1; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.subscript"); } 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::TypedValue<::mlir::Type> getValue() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::Operation::operand_range getIndices() { return getODSOperands(1); } ::mlir::OpOperand &getValueMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } ::mlir::MutableOperandRange getIndicesMutable(); 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::emitc::LValueType> getResult() { return ::llvm::cast<::mlir::TypedValue<::mlir::emitc::LValueType>>(*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, TypedValue array, ValueRange indices); static SubscriptOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypedValue array, ValueRange indices); static SubscriptOp create(::mlir::ImplicitLocOpBuilder &builder, TypedValue array, ValueRange indices); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypedValue pointer, Value index); static SubscriptOp create(::mlir::OpBuilder &builder, ::mlir::Location location, TypedValue pointer, Value index); static SubscriptOp create(::mlir::ImplicitLocOpBuilder &builder, TypedValue pointer, Value index); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value value, ::mlir::ValueRange indices); static SubscriptOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type result, ::mlir::Value value, ::mlir::ValueRange indices); static SubscriptOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type result, ::mlir::Value value, ::mlir::ValueRange indices); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ValueRange indices); static SubscriptOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ValueRange indices); static SubscriptOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ValueRange indices); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static SubscriptOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static SubscriptOp 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 SubscriptOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static SubscriptOp 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); public: bool hasSideEffects() { return false; } bool alwaysInline() { return true; // C doesn't support references. } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::SubscriptOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::SwitchOp declarations //===----------------------------------------------------------------------===// namespace detail { class SwitchOpGenericAdaptorBase { public: struct Properties { using casesTy = ::mlir::DenseI64ArrayAttr; casesTy cases; auto getCases() const { auto &propStorage = this->cases; return ::llvm::cast<::mlir::DenseI64ArrayAttr>(propStorage); } void setCases(const ::mlir::DenseI64ArrayAttr &propValue) { this->cases = propValue; } bool operator==(const Properties &rhs) const { return rhs.cases == this->cases && 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: SwitchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.switch", odsAttrs.getContext()); } SwitchOpGenericAdaptorBase(SwitchOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::DenseI64ArrayAttr getCasesAttr() { auto attr = ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().cases); return attr; } ::llvm::ArrayRef getCases(); ::mlir::Region &getDefaultRegion() { return *odsRegions[0]; } ::mlir::RegionRange getCaseRegions() { return odsRegions.drop_front(1); } ::mlir::RegionRange getRegions() { return odsRegions; } }; } // namespace detail template class SwitchOpGenericAdaptor : public detail::SwitchOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::SwitchOpGenericAdaptorBase; static constexpr int odsIndex_arg = 0; public: SwitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} SwitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : SwitchOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} SwitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : SwitchOpGenericAdaptor(values, attrs, Properties{}, {}) {} SwitchOpGenericAdaptor(RangeT values, const SwitchOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> SwitchOpGenericAdaptor(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)}; } ValueT getArg() { return (*getODSOperands(0).begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class SwitchOpAdaptor : public SwitchOpGenericAdaptor<::mlir::ValueRange> { public: using SwitchOpGenericAdaptor::SwitchOpGenericAdaptor; SwitchOpAdaptor(SwitchOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class SwitchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::OpAsmOpInterface::Trait, ::mlir::RegionBranchOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = SwitchOpAdaptor; template using GenericAdaptor = SwitchOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_arg = 0; using Properties = FoldAdaptor::Properties; using ::mlir::RegionBranchOpInterface::Trait::getEntrySuccessorOperands; using ::mlir::RegionBranchOpInterface::Trait::getSuccessorRegions; using ::mlir::RegionBranchOpInterface::Trait::getSuccessorInputs; using ::mlir::RegionBranchOpInterface::Trait::getPredecessors; using ::mlir::RegionBranchOpInterface::Trait::getPredecessorValues; using ::mlir::RegionBranchOpInterface::Trait::areTypesCompatible; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cases")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getCasesAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getCasesAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.switch"); } 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)}; } ::mlir::TypedValue<::mlir::Type> getArg() { return ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*getODSOperands(0).begin()); } ::mlir::OpOperand &getArgMutable() { auto range = getODSOperandIndexAndLength(0); return getOperation()->getOpOperand(range.first); } 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 &getDefaultRegion() { return (*this)->getRegion(0); } ::mlir::MutableArrayRef<::mlir::Region> getCaseRegions() { return (*this)->getRegions().drop_front(1); } 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::DenseI64ArrayAttr getCasesAttr() { return ::llvm::cast<::mlir::DenseI64ArrayAttr>(getProperties().cases); } ::llvm::ArrayRef getCases(); void setCasesAttr(::mlir::DenseI64ArrayAttr attr) { getProperties().cases = attr; } void setCases(::llvm::ArrayRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg, ::mlir::DenseI64ArrayAttr cases, unsigned caseRegionsCount); static SwitchOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value arg, ::mlir::DenseI64ArrayAttr cases, unsigned caseRegionsCount); static SwitchOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value arg, ::mlir::DenseI64ArrayAttr cases, unsigned caseRegionsCount); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::DenseI64ArrayAttr cases, unsigned caseRegionsCount); static SwitchOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::DenseI64ArrayAttr cases, unsigned caseRegionsCount); static SwitchOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::DenseI64ArrayAttr cases, unsigned caseRegionsCount); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg, ::llvm::ArrayRef cases, unsigned caseRegionsCount); static SwitchOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Value arg, ::llvm::ArrayRef cases, unsigned caseRegionsCount); static SwitchOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Value arg, ::llvm::ArrayRef cases, unsigned caseRegionsCount); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::llvm::ArrayRef cases, unsigned caseRegionsCount); static SwitchOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::llvm::ArrayRef cases, unsigned caseRegionsCount); static SwitchOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::llvm::ArrayRef cases, unsigned caseRegionsCount); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions); static SwitchOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions); static SwitchOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes, unsigned numRegions); static SwitchOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes, unsigned numRegions); static SwitchOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes, unsigned numRegions); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); ::llvm::LogicalResult verify(); void getEntrySuccessorRegions(::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); void getRegionInvocationBounds(::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::InvocationBounds> &invocationBounds); 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: /// Get the number of cases. unsigned getNumCases(); /// Get the default region body. Block &getDefaultBlock(); /// Get the body of a case region. Block &getCaseBlock(unsigned idx); //===------------------------------------------------------------------===// // OpAsmOpInterface Methods //===------------------------------------------------------------------===// /// EmitC ops in the body can omit their 'emitc.' prefix in the assembly. static ::llvm::StringRef getDefaultDialect() { return "emitc"; } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::SwitchOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::SwitchOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::UnaryMinusOp declarations //===----------------------------------------------------------------------===// namespace detail { class UnaryMinusOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: UnaryMinusOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.unary_minus", odsAttrs.getContext()); } UnaryMinusOpGenericAdaptorBase(UnaryMinusOp 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 UnaryMinusOpGenericAdaptor : public detail::UnaryMinusOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::UnaryMinusOpGenericAdaptorBase; public: UnaryMinusOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} UnaryMinusOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : UnaryMinusOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} UnaryMinusOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : UnaryMinusOpGenericAdaptor(values, attrs, Properties{}, {}) {} UnaryMinusOpGenericAdaptor(RangeT values, const UnaryMinusOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> UnaryMinusOpGenericAdaptor(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 UnaryMinusOpAdaptor : public UnaryMinusOpGenericAdaptor<::mlir::ValueRange> { public: using UnaryMinusOpGenericAdaptor::UnaryMinusOpGenericAdaptor; UnaryMinusOpAdaptor(UnaryMinusOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class UnaryMinusOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = UnaryMinusOpAdaptor; template using GenericAdaptor = UnaryMinusOpGenericAdaptor; 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("emitc.unary_minus"); } 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)}; } 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 resultType0, ::mlir::Value odsArg_0); static UnaryMinusOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value odsArg_0); static UnaryMinusOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value odsArg_0); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0); static UnaryMinusOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0); static UnaryMinusOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static UnaryMinusOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static UnaryMinusOp 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 UnaryMinusOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static UnaryMinusOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: bool hasSideEffects() { // If operand is fundamental type, the operation is pure. return !isFundamentalType(getOperand().getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::UnaryMinusOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::UnaryPlusOp declarations //===----------------------------------------------------------------------===// namespace detail { class UnaryPlusOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: UnaryPlusOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.unary_plus", odsAttrs.getContext()); } UnaryPlusOpGenericAdaptorBase(UnaryPlusOp 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 UnaryPlusOpGenericAdaptor : public detail::UnaryPlusOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::UnaryPlusOpGenericAdaptorBase; public: UnaryPlusOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} UnaryPlusOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : UnaryPlusOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} UnaryPlusOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : UnaryPlusOpGenericAdaptor(values, attrs, Properties{}, {}) {} UnaryPlusOpGenericAdaptor(RangeT values, const UnaryPlusOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> UnaryPlusOpGenericAdaptor(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 UnaryPlusOpAdaptor : public UnaryPlusOpGenericAdaptor<::mlir::ValueRange> { public: using UnaryPlusOpGenericAdaptor::UnaryPlusOpGenericAdaptor; UnaryPlusOpAdaptor(UnaryPlusOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class UnaryPlusOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::emitc::CExpressionInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = UnaryPlusOpAdaptor; template using GenericAdaptor = UnaryPlusOpGenericAdaptor; 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("emitc.unary_plus"); } 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)}; } 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 resultType0, ::mlir::Value odsArg_0); static UnaryPlusOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Value odsArg_0); static UnaryPlusOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Value odsArg_0); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0); static UnaryPlusOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0); static UnaryPlusOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static UnaryPlusOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static UnaryPlusOp 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 UnaryPlusOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static UnaryPlusOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); ::llvm::LogicalResult verifyInvariantsImpl(); ::llvm::LogicalResult verifyInvariants(); static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); void print(::mlir::OpAsmPrinter &_odsPrinter); public: bool hasSideEffects() { // If operand is fundamental type, the operation is pure. return !isFundamentalType(getOperand().getType()); } }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::UnaryPlusOp) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::VariableOp declarations //===----------------------------------------------------------------------===// namespace detail { class VariableOpGenericAdaptorBase { public: struct Properties { using valueTy = ::mlir::Attribute; valueTy value; auto getValue() const { auto &propStorage = this->value; return ::llvm::cast<::mlir::Attribute>(propStorage); } void setValue(const ::mlir::Attribute &propValue) { this->value = propValue; } bool operator==(const Properties &rhs) const { return rhs.value == this->value && 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: VariableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.variable", odsAttrs.getContext()); } VariableOpGenericAdaptorBase(VariableOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize) { return {index, 1}; } const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::Attribute getValueAttr() { auto attr = ::llvm::cast<::mlir::Attribute>(getProperties().value); return attr; } ::mlir::Attribute getValue(); }; } // namespace detail template class VariableOpGenericAdaptor : public detail::VariableOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::VariableOpGenericAdaptorBase; public: VariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} VariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : VariableOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} VariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : VariableOpGenericAdaptor(values, attrs, Properties{}, {}) {} VariableOpGenericAdaptor(RangeT values, const VariableOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> VariableOpGenericAdaptor(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 VariableOpAdaptor : public VariableOpGenericAdaptor<::mlir::ValueRange> { public: using VariableOpGenericAdaptor::VariableOpGenericAdaptor; VariableOpAdaptor(VariableOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class VariableOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { public: using Op::Op; using Op::print; using Adaptor = VariableOpAdaptor; template using GenericAdaptor = VariableOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getValueAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.variable"); } 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)}; } 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 getValueAttr() { return ::llvm::cast<::mlir::Attribute>(getProperties().value); } ::mlir::Attribute getValue(); void setValueAttr(::mlir::Attribute attr) { getProperties().value = attr; } static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Attribute value); static VariableOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::Type resultType0, ::mlir::Attribute value); static VariableOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::Type resultType0, ::mlir::Attribute value); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute value); static VariableOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::Attribute value); static VariableOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::Attribute value); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static VariableOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static VariableOp 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 VariableOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static VariableOp 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 ::llvm::LogicalResult setPropertiesFromParsedAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); 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::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::VariableOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::VariableOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::VerbatimOp declarations //===----------------------------------------------------------------------===// namespace detail { class VerbatimOpGenericAdaptorBase { public: struct Properties { using valueTy = ::mlir::StringAttr; valueTy value; auto getValue() const { auto &propStorage = this->value; return ::llvm::cast<::mlir::StringAttr>(propStorage); } void setValue(const ::mlir::StringAttr &propValue) { this->value = propValue; } bool operator==(const Properties &rhs) const { return rhs.value == this->value && 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: VerbatimOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.verbatim", odsAttrs.getContext()); } VerbatimOpGenericAdaptorBase(VerbatimOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } ::mlir::StringAttr getValueAttr() { auto attr = ::llvm::cast<::mlir::StringAttr>(getProperties().value); return attr; } ::llvm::StringRef getValue(); }; } // namespace detail template class VerbatimOpGenericAdaptor : public detail::VerbatimOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::VerbatimOpGenericAdaptorBase; static constexpr int odsIndex_fmtArgs = 0; public: VerbatimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} VerbatimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : VerbatimOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} VerbatimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : VerbatimOpGenericAdaptor(values, attrs, Properties{}, {}) {} VerbatimOpGenericAdaptor(RangeT values, const VerbatimOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> VerbatimOpGenericAdaptor(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 getFmtArgs() { return getODSOperands(0); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class VerbatimOpAdaptor : public VerbatimOpGenericAdaptor<::mlir::ValueRange> { public: using VerbatimOpGenericAdaptor::VerbatimOpGenericAdaptor; VerbatimOpAdaptor(VerbatimOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class VerbatimOp : public ::mlir::Op { public: using Op::Op; using Op::print; using Adaptor = VerbatimOpAdaptor; template using GenericAdaptor = VerbatimOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_fmtArgs = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; return ::llvm::ArrayRef(attrNames); } ::mlir::StringAttr getValueAttrName() { return getAttributeNameForIndex(0); } static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { return getAttributeNameForIndex(name, 0); } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.verbatim"); } 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 getFmtArgs() { return getODSOperands(0); } ::mlir::MutableOperandRange getFmtArgsMutable(); 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::StringAttr getValueAttr() { return ::llvm::cast<::mlir::StringAttr>(getProperties().value); } ::llvm::StringRef getValue(); void setValueAttr(::mlir::StringAttr attr) { getProperties().value = attr; } void setValue(::llvm::StringRef attrValue); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef value); static VerbatimOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef value); static VerbatimOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef value); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr value, ::mlir::ValueRange fmtArgs); static VerbatimOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::StringAttr value, ::mlir::ValueRange fmtArgs); static VerbatimOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::StringAttr value, ::mlir::ValueRange fmtArgs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr value, ::mlir::ValueRange fmtArgs); static VerbatimOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::StringAttr value, ::mlir::ValueRange fmtArgs); static VerbatimOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::mlir::StringAttr value, ::mlir::ValueRange fmtArgs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef value, ::mlir::ValueRange fmtArgs); static VerbatimOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::llvm::StringRef value, ::mlir::ValueRange fmtArgs); static VerbatimOp create(::mlir::ImplicitLocOpBuilder &builder, ::llvm::StringRef value, ::mlir::ValueRange fmtArgs); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef value, ::mlir::ValueRange fmtArgs); static VerbatimOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::llvm::StringRef value, ::mlir::ValueRange fmtArgs); static VerbatimOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, ::llvm::StringRef value, ::mlir::ValueRange fmtArgs); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static VerbatimOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static VerbatimOp 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 VerbatimOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static VerbatimOp 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: FailureOr> parseFormatString(); }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::VerbatimOp) MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::detail::VerbatimOpGenericAdaptorBase::Properties) namespace mlir::emitc { //===----------------------------------------------------------------------===// // ::mlir::emitc::YieldOp declarations //===----------------------------------------------------------------------===// namespace detail { class YieldOpGenericAdaptorBase { public: using Properties = ::mlir::EmptyProperties; protected: ::mlir::DictionaryAttr odsAttrs; ::std::optional<::mlir::OperationName> odsOpName; Properties properties; ::mlir::RegionRange odsRegions; public: YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : odsAttrs(attrs), properties(properties), odsRegions(regions) { if (odsAttrs) odsOpName.emplace("emitc.yield", odsAttrs.getContext()); } YieldOpGenericAdaptorBase(YieldOp op); std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); const Properties &getProperties() { return properties; } ::mlir::DictionaryAttr getAttributes() { return odsAttrs; } }; } // namespace detail template class YieldOpGenericAdaptor : public detail::YieldOpGenericAdaptorBase { using ValueT = ::llvm::detail::ValueOfRange; using Base = detail::YieldOpGenericAdaptorBase; static constexpr int odsIndex_result = 0; public: YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::PropertyRef properties, ::mlir::RegionRange regions = {}) : YieldOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr) : YieldOpGenericAdaptor(values, attrs, Properties{}, {}) {} YieldOpGenericAdaptor(RangeT values, const YieldOpGenericAdaptorBase &base) : Base(base), odsOperands(values) {} template >> YieldOpGenericAdaptor(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)}; } ValueT getResult() { auto operands = getODSOperands(0); return operands.empty() ? ValueT{} : (*operands.begin()); } RangeT getOperands() { return odsOperands; } private: RangeT odsOperands; }; class YieldOpAdaptor : public YieldOpGenericAdaptor<::mlir::ValueRange> { public: using YieldOpGenericAdaptor::YieldOpGenericAdaptor; YieldOpAdaptor(YieldOp op); ::llvm::LogicalResult verify(::mlir::Location loc); }; class YieldOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::IsTerminator> { public: using Op::Op; using Op::print; using Adaptor = YieldOpAdaptor; template using GenericAdaptor = YieldOpGenericAdaptor; using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; static constexpr int odsIndex_result = 0; using Properties = FoldAdaptor::Properties; static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { return {}; } static constexpr ::llvm::StringLiteral getOperationName() { return ::llvm::StringLiteral("emitc.yield"); } 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::TypedValue<::mlir::Type> getResult() { auto operands = getODSOperands(0); return operands.empty() ? ::mlir::TypedValue<::mlir::Type>{} : ::llvm::cast<::mlir::TypedValue<::mlir::Type>>(*operands.begin()); } ::mlir::MutableOperandRange getResultMutable(); 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 void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); static YieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location); static YieldOp create(::mlir::ImplicitLocOpBuilder &builder); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, /*optional*/::mlir::Value result); static YieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, /*optional*/::mlir::Value result); static YieldOp create(::mlir::ImplicitLocOpBuilder &builder, /*optional*/::mlir::Value result); static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value result); static YieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value result); static YieldOp create(::mlir::ImplicitLocOpBuilder &builder, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value result); static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static YieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); static YieldOp 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 YieldOp create(::mlir::OpBuilder &builder, ::mlir::Location location, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, const Properties &properties, ::llvm::ArrayRef<::mlir::NamedAttribute> discardableAttributes = {}); static YieldOp 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); void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); public: }; } // namespace mlir::emitc MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::emitc::YieldOp) #endif // GET_OP_CLASSES