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

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


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

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

>From 17f9d2ffc1e3f448342137dd6a3a6b6219148269 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 builders for call_opaque op

Add builders for the call_opaque op that has default valued attributes at the end. These can then be omitted during op creation.
---
 mlir/include/mlir/Dialect/EmitC/IR/EmitC.td | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
index 39cc360cef41d..b264a582df5aa 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)
   }];



More information about the Mlir-commits mailing list