[Mlir-commits] [mlir] [mlir][emitc][NFC] Add an example to the description of the emitc.literal operation (PR #128005)
Andrey Timonin
llvmlistbot at llvm.org
Thu Feb 20 05:27:24 PST 2025
https://github.com/EtoAndruwa created https://github.com/llvm/llvm-project/pull/128005
None
>From 0179aa53913aec32e0fa6fdefb3be1b4460121f4 Mon Sep 17 00:00:00 2001
From: EtoAndruwa <timonina1909 at gmail.com>
Date: Thu, 20 Feb 2025 16:25:28 +0300
Subject: [PATCH] [mlir][emitc][NFC] Add an example to the description of the
emitc.literal operation
---
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 4fbce995ce5b8..47e5390dc2106 100644
--- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
+++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
@@ -798,6 +798,19 @@ def EmitC_LiteralOp : EmitC_Op<"literal", [Pure]> {
let description = [{
The `emitc.literal` operation produces an SSA value equal to some constant
specified by an attribute.
+
+ Example:
+
+ ```mlir
+ %x = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i32>
+ %one = literal "1" : i32
+ "emitc.assign"(%x, %one) : (!emitc.lvalue<i32>, i32) -> ()
+ ```
+ ```c++
+ // Code emitted for the operation above.
+ int32_t v1;
+ v1 = 1;
+ ```
}];
let arguments = (ins StrAttr:$value);
More information about the Mlir-commits
mailing list