[Mlir-commits] [mlir] [mlir][EmitC] Add builders for call_opaque op (PR #80879)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Feb 6 09:39:39 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-emitc

Author: Simon Camphausen (simon-camp)

<details>
<summary>Changes</summary>

Add builders for the call_opaque op that has default valued attributes at the end. These can then be omitted during op creation.

---
Full diff: https://github.com/llvm/llvm-project/pull/80879.diff


1 Files Affected:

- (modified) mlir/include/mlir/Dialect/EmitC/IR/EmitC.td (+21) 


``````````diff
diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
index 39cc360cef41d4..b264a582df5aad 100644
--- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
+++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
@@ -122,6 +122,27 @@ def EmitC_CallOpaqueOp : EmitC_Op<"call_opaque", []> {
     Variadic<AnyType>:$operands
   );
   let results = (outs Variadic<AnyType>);
+  let builders = [
+    OpBuilder<(ins
+      "::mlir::TypeRange":$resultTypes,
+      "::llvm::StringRef":$callee,
+      "::mlir::ValueRange":$operands,
+      CArg<"::mlir::ArrayAttr", "{}">:$args,
+      CArg<"::mlir::ArrayAttr", "{}">:$template_args), [{
+        build($_builder, $_state, resultTypes, callee, args, template_args, operands);
+      }]
+    >,
+    OpBuilder<(ins
+      "::mlir::TypeRange":$resultTypes,
+      "::mlir::StringAttr":$callee,
+      "::mlir::ValueRange":$operands,
+      CArg<"::mlir::ArrayAttr", "{}">:$args,
+      CArg<"::mlir::ArrayAttr", "{}">:$template_args), [{
+        build($_builder, $_state, resultTypes, callee, args, template_args, operands);
+      }]
+    >
+  ];
+
   let assemblyFormat = [{
     $callee `(` $operands `)` attr-dict `:` functional-type($operands, results)
   }];

``````````

</details>


https://github.com/llvm/llvm-project/pull/80879


More information about the Mlir-commits mailing list