summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/TargetInfo.cpp
diff options
context:
space:
mode:
authorPetar Jovanovic <petar.jovanovic@imgtec.com>2017-05-09 16:24:03 +0000
committerPetar Jovanovic <petar.jovanovic@imgtec.com>2017-05-09 16:24:03 +0000
commit125c03070edbe7ee8b4f66879a08dc80cd280584 (patch)
treee3a5ba9111ce1dc828a0d8dc0f65f5d7bea7911b /clang/lib/CodeGen/TargetInfo.cpp
parent0c42d8c35ba6acd4d3620915c64af5a7badc1e73 (diff)
downloadbcm5719-llvm-125c03070edbe7ee8b4f66879a08dc80cd280584.tar.gz
bcm5719-llvm-125c03070edbe7ee8b4f66879a08dc80cd280584.zip
[mips] Impose a threshold for coercion of aggregates
Modified MipsABIInfo::classifyArgumentType so that it now coerces aggregate structures only if the size of said aggregate is less than 16/64 bytes, depending on the ABI. Patch by Stefan Maksimovic. Differential Revision: https://reviews.llvm.org/D32900 llvm-svn: 302547
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
-rw-r--r--clang/lib/CodeGen/TargetInfo.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp
index 4ebbef7dfb5..5d3ccb86ff8 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -6695,6 +6695,14 @@ MipsABIInfo::classifyArgumentType(QualType Ty, uint64_t &Offset) const {
return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory);
}
+ // Use indirect if the aggregate cannot fit into registers for
+ // passing arguments according to the ABI
+ unsigned Threshold = IsO32 ? 16 : 64;
+
+ if(getContext().getTypeSizeInChars(Ty) > CharUnits::fromQuantity(Threshold))
+ return ABIArgInfo::getIndirect(CharUnits::fromQuantity(Align), true,
+ getContext().getTypeAlign(Ty) / 8 > Align);
+
// If we have reached here, aggregates are passed directly by coercing to
// another structure type. Padding is inserted if the offset of the
// aggregate is unaligned.
OpenPOWER on IntegriCloud