summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/TargetInfo.cpp
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2012-11-06 04:58:01 +0000
committerManman Ren <mren@apple.com>2012-11-06 04:58:01 +0000
commit8cd99817f9a60cc13847b7e9cdc6d9fdca5f27df (patch)
tree0476af4db6dded5f6c5ab80597d577e319652ef4 /clang/lib/CodeGen/TargetInfo.cpp
parent2ed51255028be06c9d831d8cd5ef489bd008a763 (diff)
downloadbcm5719-llvm-8cd99817f9a60cc13847b7e9cdc6d9fdca5f27df.tar.gz
bcm5719-llvm-8cd99817f9a60cc13847b7e9cdc6d9fdca5f27df.zip
ARM byval: when type alignment is bigger than ABI alignment, instead of
disabling byval, we set realign to true. It will perform an aligned alloca, and call memcpy to copy the byval argument to the local variable. Change the size threshold back to 64 bytes. rdar://12596507 llvm-svn: 167440
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r--clang/lib/CodeGen/TargetInfo.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp
index 90603371805..22292603f69 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -3221,16 +3221,15 @@ ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty, int *VFPRegs,
// Support byval for ARM.
// The ABI alignment for APCS is 4-byte and for AAPCS at least 4-byte and at most 8-byte.
- // Byval can't handle the case where type alignment is bigger than ABI alignment.
- // We also increase the threshold for byval due to its overhead.
+ // We realign the indirect argument if type alignment is bigger than ABI alignment.
uint64_t ABIAlign = 4;
uint64_t TyAlign = getContext().getTypeAlign(Ty) / 8;
if (getABIKind() == ARMABIInfo::AAPCS_VFP ||
getABIKind() == ARMABIInfo::AAPCS)
ABIAlign = std::min(std::max(TyAlign, (uint64_t)4), (uint64_t)8);
- if (getContext().getTypeSizeInChars(Ty) > CharUnits::fromQuantity(64*8) &&
- TyAlign <= ABIAlign) {
- return ABIArgInfo::getIndirect(0, /*ByVal=*/true);
+ if (getContext().getTypeSizeInChars(Ty) > CharUnits::fromQuantity(64)) {
+ return ABIArgInfo::getIndirect(0, /*ByVal=*/true,
+ /*Realign=*/TyAlign <= ABIAlign ? false : true);
}
// Otherwise, pass by coercing to a structure of the appropriate size.
OpenPOWER on IntegriCloud