[flang-commits] [flang] [flang][rfc] Add represention of volatile references (PR #132486)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Tue Mar 25 12:16:41 PDT 2025


================
@@ -363,18 +363,22 @@ def fir_ReferenceType : FIR_Type<"Reference", "ref"> {
     The type of a reference to an entity in memory.
   }];
 
-  let parameters = (ins "mlir::Type":$eleTy);
+  let parameters = (ins
+    "mlir::Type":$eleTy,
+    DefaultValuedParameter<"bool", "false">:$isVol);
 
   let skipDefaultBuilders = 1;
 
----------------
vzakhari wrote:

I think you can use:
```
let assemblyFormat = "`<` $eleTy (`,` custom<IsVolatile>($isVolatile)^)? `>`";
```
to simplify the C++ part where you will only have to parse the `volatile` keyword.  At least, this worked for me with `PackArrayConstraints` (see `fir.pack_array` definition).

Anyway, some pieces will still be in C++.

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


More information about the flang-commits mailing list