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

Simon Camphausen llvmlistbot at llvm.org
Wed Feb 7 07:03:05 PST 2024


https://github.com/simon-camp updated https://github.com/llvm/llvm-project/pull/80879

>From e9b4f9ac3646691f0275cf19a195d336a48f7f65 Mon Sep 17 00:00:00 2001
From: Simon Camphausen <simon.camphausen at iml.fraunhofer.de>
Date: Tue, 6 Feb 2024 17:33:20 +0000
Subject: [PATCH] [mlir][EmitC] Add builder for call_opaque op

This allows to omit the default valued attributes and therefore write more compact code.
---
 mlir/include/mlir/Dialect/EmitC/IR/EmitC.td | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
index 39cc360cef41d4..c50fdf397a0fec 100644
--- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
+++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
@@ -122,6 +122,19 @@ 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);
+      }]
+    >
+  ];
+
   let assemblyFormat = [{
     $callee `(` $operands `)` attr-dict `:` functional-type($operands, results)
   }];



More information about the Mlir-commits mailing list