[clang] [CIR] Add handling for volatile loads and stores (PR #156124)
Henrich Lauko via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 2 06:53:24 PDT 2025
================
@@ -452,24 +464,32 @@ def CIR_StoreOp : CIR_Op<"store", [
a volatile store. Store's can be marked atomic by using
`atomic(<mem_order>)`.
- `align` can be used to specify an alignment that's different from the
+ `alignment` can be used to specify an alignment that's different from the
default, which is computed from `result`'s type ABI data layout.
Example:
```mlir
// Store a function argument to local storage, address in %0.
cir.store %arg0, %0 : i32, !cir.ptr<i32>
+
+ // Perform a volatile store into memory location at the address in %0.
+ cir.store volatile %arg0, %0 : i32, !cir.ptr<i32>
+
+ // Others
+ cir.store align(16) atomic(seq_cst) %x, %addr : i32, !cir.ptr<i32>
```
}];
let arguments = (ins CIR_AnyType:$value,
Arg<CIR_PointerType, "the address to store the value",
[MemWrite]>:$addr,
OptionalAttr<I64Attr>:$alignment,
+ UnitAttr:$is_volatile,
OptionalAttr<CIR_MemOrder>:$mem_order);
----------------
xlauko wrote:
same reordering here:
```suggestion
UnitAttr:$is_volatile,
OptionalAttr<I64Attr>:$alignment,
OptionalAttr<CIR_MemOrder>:$mem_order);
```
https://github.com/llvm/llvm-project/pull/156124
More information about the cfe-commits
mailing list