Skip to content

Commit ad64bff

Browse files
[mlir][emitc] Update description for ExpressionOp (NFC) (#156554)
Since the `emitc.expression` was recently updated, the documentation has been changed
1 parent 79f102f commit ad64bff

File tree

1 file changed

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

1 file changed

+13
-15
lines changed

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

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -471,35 +471,33 @@ def EmitC_ExpressionOp
471471
let summary = "Expression operation";
472472
let description = [{
473473
The `emitc.expression` operation returns a single SSA value which is yielded by
474-
its single-basic-block region. The operation doesn't take any arguments.
474+
its single-basic-block region. The operation takes zero or more input operands
475+
that are passed as block arguments to the region.
475476

476477
As the operation is to be emitted as a C expression, the operations within
477478
its body must form a single Def-Use tree, or a DAG trivially expandable to
478479
one, i.e. a DAG where each operation with side effects is only reachable
479480
once from the expression root.
480481

481-
Example:
482+
Input operands can be of both value types (`EmitCType`) and lvalue types
483+
(`EmitC_LValueType`).
482484

485+
Example:
483486
```mlir
484-
%r = emitc.expression : i32 {
485-
%0 = emitc.add %a, %b : (i32, i32) -> i32
486-
%1 = emitc.call_opaque "foo"(%0) : (i32) -> i32
487-
%2 = emitc.add %c, %d : (i32, i32) -> i32
488-
%3 = emitc.mul %1, %2 : (i32, i32) -> i32
489-
emitc.yield %3 : i32
487+
%r = emitc.expression %a, %b, %c : (i32, i32, i32) -> i32 {
488+
%0 = emitc.call_opaque "foo"(%a) : (i32) -> i32
489+
%1 = emitc.add %b, %c : (i32, i32) -> i32
490+
%2 = emitc.mul %0, %1 : (i32, i32) -> i32
491+
emitc.yield %2 : i32
490492
}
491493
```
492494

493-
May be emitted as
494-
495+
May be emitted as:
495496
```c++
496-
int32_t v7 = foo(v1 + v2) * (v3 + v4);
497+
int32_t v4 = foo(v1) * (v2 + v3);
497498
```
498499

499-
The operations allowed within expression body are EmitC operations with the
500-
CExpressionInterface interface.
501-
502-
When specified, the optional `do_not_inline` indicates that the expression is
500+
When specified, the optional `noinline` indicates that the expression is
503501
to be emitted as seen above, i.e. as the rhs of an EmitC SSA value
504502
definition. Otherwise, the expression may be emitted inline, i.e. directly
505503
at its use.

0 commit comments

Comments
 (0)