[Mlir-commits] [mlir] [mlir][emitc][NFC] Add an example to the description of the emitc.literal operation (PR #128005)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Feb 20 05:28:04 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-emitc
Author: Andrey Timonin (EtoAndruwa)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/128005.diff
1 Files Affected:
- (modified) mlir/include/mlir/Dialect/EmitC/IR/EmitC.td (+13)
``````````diff
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);
``````````
</details>
https://github.com/llvm/llvm-project/pull/128005
More information about the Mlir-commits
mailing list