aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/TargetInfo.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-08-09 00:31:40 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-08-09 00:31:40 +0000
commit79f30981fcd25c6ff88807372a2744af02a7690e (patch)
treec0c022e60742a758ad24e02fc035db4f815a3ca6 /lib/CodeGen/TargetInfo.cpp
parente90d3f847dcce76237078b67db8895eb7a24189e (diff)
Fix AAPCS ABI. I can't actually test this, but it restores the behavior from before r159168. PR13562.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161554 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TargetInfo.cpp')
-rw-r--r--lib/CodeGen/TargetInfo.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
index c8ec392bd1..4aa98d2fd8 100644
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -2757,21 +2757,24 @@ ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty) const {
}
}
+ // FIXME: byval for AAPCS is not yet supported; we need it for performance
+ // and to support large alignment.
+ if (getABIKind() == ARMABIInfo::APCS) {
+ if (getContext().getTypeSizeInChars(Ty) > CharUnits::fromQuantity(64) ||
+ getContext().getTypeAlign(Ty) > 64) {
+ return ABIArgInfo::getIndirect(0, /*ByVal=*/true);
+ }
+ }
+
// Otherwise, pass by coercing to a structure of the appropriate size.
- //
- // FIXME: This doesn't handle alignment > 64 bits.
llvm::Type* ElemTy;
unsigned SizeRegs;
- if (getContext().getTypeSizeInChars(Ty) <= CharUnits::fromQuantity(64)) {
+ // FIXME: Try to match the types of the arguments more accurately where
+ // we can.
+ if (getContext().getTypeAlign(Ty) <= 32) {
ElemTy = llvm::Type::getInt32Ty(getVMContext());
SizeRegs = (getContext().getTypeSize(Ty) + 31) / 32;
- } else if (getABIKind() == ARMABIInfo::APCS) {
- // Initial ARM ByVal support is APCS-only.
- return ABIArgInfo::getIndirect(0, /*ByVal=*/true);
} else {
- // FIXME: This is kind of nasty... but there isn't much choice
- // because most of the ARM calling conventions don't yet support
- // byval.
ElemTy = llvm::Type::getInt64Ty(getVMContext());
SizeRegs = (getContext().getTypeSize(Ty) + 63) / 64;
}