[clang] [CIR] Upstream get_bitfield operation to load bit-field members from structs (PR #145971)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 27 16:56:02 PDT 2025


================
@@ -405,6 +406,16 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
 
     return createGlobal(module, loc, uniqueName, type, linkage);
   }
+
+  mlir::Value createGetBitfield(mlir::Location loc, mlir::Type resultType,
+                                mlir::Value addr, mlir::Type storageType,
+                                const CIRGenBitFieldInfo &info,
+                                bool isLvalueVolatile, bool useVolatile) {
+    unsigned int offset = useVolatile ? info.volatileOffset : info.offset;
----------------
andykaylor wrote:

Classic codegen seems to also use `useVolatile` to select the `info.volatileSize`. I suspect we'll need to do that too, but more generally I think we should delay introducing the volatile fields in the info until we have support for the target that uses them.

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


More information about the cfe-commits mailing list