summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/RecordLayout.cpp
diff options
context:
space:
mode:
authorMomchil Velikov <momchil.velikov@arm.com>2018-07-30 17:48:23 +0000
committerMomchil Velikov <momchil.velikov@arm.com>2018-07-30 17:48:23 +0000
commit20208cc046c206a1436edb714e94bd52a0bc8572 (patch)
tree24548919809d313e32c81ace99e7da457dbf1d1b /clang/lib/AST/RecordLayout.cpp
parentfa3bee47569b1583e4319bbdbcd3f129345caa25 (diff)
downloadbcm5719-llvm-20208cc046c206a1436edb714e94bd52a0bc8572.tar.gz
bcm5719-llvm-20208cc046c206a1436edb714e94bd52a0bc8572.zip
[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
Diffstat (limited to 'clang/lib/AST/RecordLayout.cpp')
-rw-r--r--clang/lib/AST/RecordLayout.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/AST/RecordLayout.cpp b/clang/lib/AST/RecordLayout.cpp
index 37fe029f53b..af3d0af8bbb 100644
--- a/clang/lib/AST/RecordLayout.cpp
+++ b/clang/lib/AST/RecordLayout.cpp
@@ -30,10 +30,12 @@ void ASTRecordLayout::Destroy(ASTContext &Ctx) {
ASTRecordLayout::ASTRecordLayout(const ASTContext &Ctx, CharUnits size,
CharUnits alignment,
+ CharUnits unadjustedAlignment,
CharUnits requiredAlignment,
CharUnits datasize,
ArrayRef<uint64_t> fieldoffsets)
: Size(size), DataSize(datasize), Alignment(alignment),
+ UnadjustedAlignment(unadjustedAlignment),
RequiredAlignment(requiredAlignment) {
FieldOffsets.append(Ctx, fieldoffsets.begin(), fieldoffsets.end());
}
@@ -41,6 +43,7 @@ ASTRecordLayout::ASTRecordLayout(const ASTContext &Ctx, CharUnits size,
// Constructor for C++ records.
ASTRecordLayout::ASTRecordLayout(const ASTContext &Ctx,
CharUnits size, CharUnits alignment,
+ CharUnits unadjustedAlignment,
CharUnits requiredAlignment,
bool hasOwnVFPtr, bool hasExtendableVFPtr,
CharUnits vbptroffset,
@@ -57,6 +60,7 @@ ASTRecordLayout::ASTRecordLayout(const ASTContext &Ctx,
const BaseOffsetsMapTy& BaseOffsets,
const VBaseOffsetsMapTy& VBaseOffsets)
: Size(size), DataSize(datasize), Alignment(alignment),
+ UnadjustedAlignment(unadjustedAlignment),
RequiredAlignment(requiredAlignment), CXXInfo(new (Ctx) CXXRecordLayoutInfo)
{
FieldOffsets.append(Ctx, fieldoffsets.begin(), fieldoffsets.end());
OpenPOWER on IntegriCloud