[PATCH] D79719: [AIX] Implement AIX special alignment rule about double/long double

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 11 11:18:05 PDT 2020


efriedma added a comment.

This approach seems to reflect the consensus from the mailing list.



================
Comment at: clang/include/clang/AST/RecordLayout.h:74
+  /// The maximum allowed field alignment. This is set by #pragma pack.
+  CharUnits MaxFieldAlignment;
+
----------------
If we have to keep around extra data anyway, probably better to add a field for the preferred alignment, so we can keep the preferred alignment handling together.


================
Comment at: clang/lib/AST/ASTContext.cpp:2518
+      (T->isSpecificBuiltinType(BuiltinType::LongDouble) &&
+       getTargetInfo().getTriple().isOSAIX()))
     // Don't increase the alignment if an alignment attribute was specified on a
----------------
We try to avoid OS-specific checks here.  But I'm not sure what this should look like on other targets.


================
Comment at: clang/lib/AST/ASTContext.cpp:2527
+    // as its first member.
+    if (getTargetInfo().getTriple().isOSAIX()) {
+      const RecordDecl *RD = RT->getDecl();
----------------
I'd prefer to centralize the check for "AIX struct layout" in one place, as opposed to putting checks for AIX targets in multiple places.


================
Comment at: clang/lib/AST/RecordLayoutBuilder.cpp:3438
+                                C.getPreferredTypeAlign(RD->getTypeForDecl()))
+                               .getQuantity());
 
----------------
Please don't make the dumping code lie about the "align".  If you want to dump the preferred alignment in addition, that would be fine.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79719/new/

https://reviews.llvm.org/D79719





More information about the cfe-commits mailing list