[clang] [CIR] Upstream get_bitfield operation to load bit-field members from structs (PR #145971)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 30 11:49:31 PDT 2025
================
@@ -1669,6 +1669,85 @@ def GetGlobalOp : CIR_Op<"get_global",
}];
}
+//===----------------------------------------------------------------------===//
+// GetBitfieldOp
+//===----------------------------------------------------------------------===//
+
+def GetBitfieldOp : CIR_Op<"get_bitfield"> {
+ let summary = "Get a bitfield";
+ let description = [{
+ The `cir.get_bitfield` operation provides a load-like access to
+ a bit field of a record.
+
+ It expects a name if a bit field, a pointer to a storage in the
+ base record, a type of the storage, a name of the bitfield,
+ a size the bit field, an offset of the bit field and a sign.
+
+ A unit attribute `volatile` can be used to indicate a volatile load of the
+ bitfield.
+
+ Example:
+ Suppose we have a struct with multiple bitfields stored in
+ different storages. The `cir.get_bitfield` operation gets the value
----------------
erichkeane wrote:
```suggestion
different members. The `cir.get_bitfield` operation gets the value
```
https://github.com/llvm/llvm-project/pull/145971
More information about the cfe-commits
mailing list