================
@@ -229,4 +229,32 @@ def ConstPtrAttr : CIR_Attr<"ConstPtr", "ptr", 
[TypedAttrInterface]> {
   }];
 }
 
+//===----------------------------------------------------------------------===//
+// RecordLayoutAttr
+//===----------------------------------------------------------------------===//
+
+// Used to decouple layout information from the record type. RecordType's
+// uses this attribute to cache that information.
+
+def RecordLayoutAttr : CIR_Attr<"RecordLayout", "record_layout"> {
+  let summary = "ABI specific information about a record layout";
+  let description = [{
+    Holds layout information often queried by !cir.record users
+    during lowering passes and optimizations.
+  }];
+
+  let parameters = (ins "unsigned":$size,
+                        "unsigned":$alignment,
+                        "bool":$padded,
+                        "mlir::Type":$largest_member,
----------------
xlauko wrote:

I don't really like `largest_member` as it is only useful when [lowering 
unions](https://github.com/llvm/clangir/blob/204c03efbe898c9f64e477937d869767fdfb1310/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp#L4487)
 and at that particular location one can easily search for it in record? Why to 
hold additional member in each other struct?

The second use is here:

https://github.com/llvm/clangir/blob/204c03efbe898c9f64e477937d869767fdfb1310/clang/lib/CIR/Dialect/Transforms/TargetLowering/LowerFunction.cpp#L76
 
which for some reason diverges from CodeGen, that does not treat unions here 
anyhow: 

https://github.com/llvm/llvm-project/blob/45f27167bcd312a8691365a63719fab136972692/clang/lib/CodeGen/CGCall.cpp#L1234

But similarly to @erichkeane I have no idea how this thing is intertwined.

https://github.com/llvm/llvm-project/pull/136036
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to