[PATCH] D86790: [FE] Use preferred alignment instead of ABI alignment for complete object when applicable Summary: On some targets, preferred alignment is larger than ABI alignment in some cases. For example, on AIX we have special power alignment rules which...

Xiangling Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 28 08:50:03 PDT 2020


Xiangling_L created this revision.
Xiangling_L added reviewers: hubert.reinterpretcast, jasonliu, efriedma, jyknight, rnk, rsmith.
Herald added subscribers: cfe-commits, martong, jfb.
Herald added a reviewer: aaron.ballman.
Herald added a project: clang.
Xiangling_L requested review of this revision.

...would cause that. Previously, to support those cases, we added a “PreferredAlignment” field in the `RecordLayout` to store the AIX special alignment values in “PreferredAlignment” as the community suggested.

However, that patch alone is not enough. There are places in the Clang where `PreferredAlignment`
should have been used instead of ABI-specified alignment. This patch is aimed at fixing those
spots.

And the migration strategy we are using is:

- Adding an extra flag without default argument for functions currently returning ABI-specified

alignment. By doing this, we would expect developers to consciously know and also patch reviewers
consciously agree on which alignment needs to be used.

- Later, when we finish the migration process(probably in a few months), we may remove the

flag and replace the "true" flag with invoking "getPreferredTypeAlign" directly.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86790

Files:
  clang/include/clang/AST/ASTContext.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/AST/Expr.cpp
  clang/lib/AST/ExprConstant.cpp
  clang/lib/AST/RecordLayoutBuilder.cpp
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBlocks.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGCUDANV.cpp
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CGClass.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprAgg.cpp
  clang/lib/CodeGen/CGExprCXX.cpp
  clang/lib/CodeGen/CGExprConstant.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CGObjCGNU.cpp
  clang/lib/CodeGen/CGOpenCLRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CodeGenFunction.cpp
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/lib/CodeGen/MicrosoftCXXABI.cpp
  clang/lib/CodeGen/SwiftCallingConv.cpp
  clang/lib/CodeGen/TargetInfo.cpp
  clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
  clang/lib/Sema/SemaChecking.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaDeclObjC.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/lib/Sema/SemaOpenMP.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/lib/StaticAnalyzer/Checkers/CastToStructChecker.cpp
  clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp
  clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp
  clang/test/CodeGen/aix-alignment.c
  clang/test/CodeGenCXX/aix-alignment.cpp
  clang/tools/libclang/CXType.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86790.288622.patch
Type: text/x-patch
Size: 114519 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200828/411b4372/attachment-0001.bin>


More information about the cfe-commits mailing list