Skip to content

Commit 0179aa5

Browse files
committed
[mlir][emitc][NFC] Add an example to the description of the emitc.literal operation
1 parent 46ffacc commit 0179aa5

File tree

1 file changed

+13
-0
lines changed
  • mlir/include/mlir/Dialect/EmitC/IR

1 file changed

+13
-0
lines changed

mlir/include/mlir/Dialect/EmitC/IR/EmitC.td

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,19 @@ def EmitC_LiteralOp : EmitC_Op<"literal", [Pure]> {
798798
let description = [{
799799
The `emitc.literal` operation produces an SSA value equal to some constant
800800
specified by an attribute.
801+
802+
Example:
803+
804+
```mlir
805+
%x = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i32>
806+
%one = literal "1" : i32
807+
"emitc.assign"(%x, %one) : (!emitc.lvalue<i32>, i32) -> ()
808+
```
809+
```c++
810+
// Code emitted for the operation above.
811+
int32_t v1;
812+
v1 = 1;
813+
```
801814
}];
802815

803816
let arguments = (ins StrAttr:$value);

0 commit comments

Comments
 (0)