[flang-commits] [flang] [llvm] [flang][MIF] Adding lowering for EVENT POST/WAIT statements (PR #210283)

via flang-commits flang-commits at lists.llvm.org
Tue Sep 8 02:56:46 PDT 2026


================
@@ -592,4 +592,56 @@ def mif_DeallocCoarrayOp
   }];
 }
 
+//===----------------------------------------------------------------------===//
+// Events 
+//===----------------------------------------------------------------------===//
+
+def mif_EventPostOp : mif_Op<"event_post", [AttrSizedOperandSegments,
+                                            MemoryEffects<[MemWrite]>]> {
+  let summary = "Posts an event.";
+  let description = [{
+    This is a post-event operation.
+    Arguments: 
+      - `cosubscripts`: Shall be a list of integer cosubscripts to determine the 
+        image_num to be communicated.
+      - `event_var`: Shall be a coarray or be part of a coarray of 
+        type EVENT_TYPE from the intrinsic module ISO_FORTRAN_ENV.
+  }];
+
+  let arguments = (ins AnyRefOrBoxType:$event,
+      Variadic<AnyInteger>:$cosubscripts,
+      Arg<Optional<AnyReferenceLike>, "", [MemWrite]>:$stat,
+      Arg<Optional<AnyRefOrBoxType>, "", [MemWrite]>:$errmsg);
+
+  let assemblyFormat = [{
+    $event (`[` $cosubscripts^ `]` )? 
+    (`stat` $stat^ )?  (`errmsg` $errmsg^ )?
+    attr-dict `:` functional-type(operands, results)
+  }];
+}
+
+def mif_EventWaitOp : mif_Op<"event_wait", [AttrSizedOperandSegments,
+                                            MemoryEffects<[MemWrite]>]> {
+  let summary = "Waits until an event is posted.";
+  let description = [{
+    Arguments: 
+      - `event`: Shall be a reference of type EVENT_TYPE from the intrinsic
+        module ISO_FORTRAN_ENV.
+      - `until_count`(optional) : Shall be an integer scalar and indicate the count of 
+        the given event variable to be waited for.
+  }];
+
+  let arguments = (ins AnyRefOrBoxType:$event,
----------------
jeanPerier wrote:

Same here.

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


More information about the flang-commits mailing list