[clang] [CIR] Upstream new SetBitfieldOp for handling C and C++ struct bitfields (PR #147609)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 10 10:23:15 PDT 2025


================
@@ -1669,6 +1669,94 @@ def GetGlobalOp : CIR_Op<"get_global",
   }];
 }
 
+//===----------------------------------------------------------------------===//
+// SetBitfieldOp
+//===----------------------------------------------------------------------===//
+
+def SetBitfieldOp : CIR_Op<"set_bitfield"> {
+  let summary = "Set the value of a bitfield member";
+  let description = [{
+    The `cir.set_bitfield` operation provides a store-like access to
+    a bit field of a record.
+
+    A bitfield info attribute must be provided to describe the location of
+    the bitfield within the memory referenced by the $addr argument.
+    The $src argument is inserted at the appropriate place in the memory and
+    the value that was stored. Returns a value being stored.
----------------
andykaylor wrote:

```suggestion
    the value that was stored. Returns the value being stored.
```

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


More information about the cfe-commits mailing list