[ARM, AArch64]: Use unadjusted alignment when passing composites as arguments
authorMomchil Velikov <momchil.velikov@arm.com>
Mon, 30 Jul 2018 17:48:23 +0000 (17:48 +0000)
committerMomchil Velikov <momchil.velikov@arm.com>
Mon, 30 Jul 2018 17:48:23 +0000 (17:48 +0000)
commit20208cc046c206a1436edb714e94bd52a0bc8572
tree24548919809d313e32c81ace99e7da457dbf1d1b
parentfa3bee47569b1583e4319bbdbcd3f129345caa25
[ARM, AArch64]: Use unadjusted alignment when passing composites as arguments

The "Procedure Call Procedure Call Standard for the ARMĀ® Architecture"
(https://static.docs.arm.com/ihi0042/f/IHI0042F_aapcs.pdf), specifies that
composite types are passed according to their "natural alignment", i.e. the
alignment before alignment adjustment on the entire composite is applied.

The same applies for AArch64 ABI.

Clang, however, used the adjusted alignment.

GCC already implements the ABI correctly. With this patch Clang becomes
compatible with GCC and passes such arguments in accordance with AAPCS.

Differential Revision: https://reviews.llvm.org/D46013

llvm-svn: 338279
clang/include/clang/AST/ASTContext.h
clang/include/clang/AST/RecordLayout.h
clang/lib/AST/ASTContext.cpp
clang/lib/AST/RecordLayout.cpp
clang/lib/AST/RecordLayoutBuilder.cpp
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/aapcs-align.cc [new file with mode: 0644]
clang/test/CodeGen/aapcs64-align.cc [new file with mode: 0644]
clang/test/CodeGen/arm-arguments.c