[Mlir-commits] [mlir] [mlir][emitc][NFC] Add an example to the description of the emitc.verbatim operation (PR #128004)

Andrey Timonin llvmlistbot at llvm.org
Sat Feb 22 03:48:05 PST 2025


https://github.com/EtoAndruwa updated https://github.com/llvm/llvm-project/pull/128004

>From bc2e41f386eb06ea792f8f0d8d5392a5f1dba6a6 Mon Sep 17 00:00:00 2001
From: EtoAndruwa <timonina1909 at gmail.com>
Date: Thu, 20 Feb 2025 15:47:02 +0300
Subject: [PATCH 1/3] [mlir][emitc][NFC] Add an example to the description of
 the emitc.verbatim operation

---
 mlir/include/mlir/Dialect/EmitC/IR/EmitC.td | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
index 196283fe2c7ad..72291aadf1aca 100644
--- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
+++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
@@ -1271,6 +1271,7 @@ def EmitC_VerbatimOp : EmitC_Op<"verbatim"> {
     #endif
     ```
 
+<<<<<<< HEAD
     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`
@@ -1278,6 +1279,14 @@ def EmitC_VerbatimOp : EmitC_Op<"verbatim"> {
     `%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
+    ```
+>>>>>>> cabdac5e5703 ([mlir][emitc][NFC] Add an example to the description of the emitc.verbatim operation)
   }];
 
   let extraClassDeclaration = [{

>From 4e95f8cfd33ca73f4776caf55ddd315565566e2c Mon Sep 17 00:00:00 2001
From: EtoAndruwa <timonina1909 at gmail.com>
Date: Fri, 21 Feb 2025 18:29:46 +0300
Subject: [PATCH 2/3] [mlir][emitc][NFC] Add C++ samples

---
 mlir/include/mlir/Dialect/EmitC/IR/EmitC.td | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
index 72291aadf1aca..719113de99f20 100644
--- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
+++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
@@ -1286,6 +1286,11 @@ def EmitC_VerbatimOp : EmitC_Op<"verbatim"> {
     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
+    ```
 >>>>>>> cabdac5e5703 ([mlir][emitc][NFC] Add an example to the description of the emitc.verbatim operation)
   }];
 

>From 892586f72cc060dc2cb6d3250a71666626d1bee3 Mon Sep 17 00:00:00 2001
From: EtoAndruwa <timonina1909 at gmail.com>
Date: Sat, 22 Feb 2025 14:47:23 +0300
Subject: [PATCH 3/3] [mlir][emitc][NFC] Resolve the merge conflicts

---
 mlir/include/mlir/Dialect/EmitC/IR/EmitC.td | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
index 719113de99f20..9fd390a91314a 100644
--- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
+++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
@@ -1271,7 +1271,6 @@ def EmitC_VerbatimOp : EmitC_Op<"verbatim"> {
     #endif
     ```
 
-<<<<<<< HEAD
     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`
@@ -1279,7 +1278,7 @@ def EmitC_VerbatimOp : EmitC_Op<"verbatim"> {
     `%dest` became `b` in the C code.
     `{{` in the format string is interpreted as a single `{` and doesn't introduce
     a placeholder.
-=======
+
     Example:
 
     ```mlir
@@ -1291,7 +1290,6 @@ def EmitC_VerbatimOp : EmitC_Op<"verbatim"> {
     typedef float f32;
     #pragma my var=v1 property
     ```
->>>>>>> cabdac5e5703 ([mlir][emitc][NFC] Add an example to the description of the emitc.verbatim operation)
   }];
 
   let extraClassDeclaration = [{



More information about the Mlir-commits mailing list