[Mlir-commits] [mlir] Add a structured if operation (PR #67234)

Simon Camphausen llvmlistbot at llvm.org
Mon Sep 25 08:24:46 PDT 2023


================
@@ -402,4 +403,103 @@ def EmitC_VariableOp : EmitC_Op<"variable", []> {
   let hasVerifier = 1;
 }
 
+def EmitC_AssignOp : EmitC_Op<"assign", [MemoryEffects<[MemWrite]>]> {
+  let summary = "Assign operation";
+  let description = [{
+    The `assign` operation stores an SSA value to the location designated by an
+    EmitC variable. This operation doesn't return any value. The assigned value
+    must be of the same type as the variable being assigned. The operation is
+    emitted as a C/C++ '=' operator.
+
+    Example:
+
+    ```mlir
+    // Integer variable
+    %0 = "emitc.variable"(){value = 42 : i32} : () -> i32
+    %1 = emitc.call "foo"() : () -> (i32)
+
+    // Assign emitted as `... = ...;`
+    "emitc.assign"(%0, %1) : (i32, %i32) -> ()
----------------
simon-camp wrote:

```suggestion
    "emitc.assign"(%0, %1) : (i32, i32) -> ()
```

https://github.com/llvm/llvm-project/pull/67234


More information about the Mlir-commits mailing list