summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/TargetInfo.cpp
diff options
context:
space:
mode:
authorPetar Jovanovic <petar.jovanovic@imgtec.com>2017-05-10 14:28:18 +0000
committerPetar Jovanovic <petar.jovanovic@imgtec.com>2017-05-10 14:28:18 +0000
commit6f4cdb89122d3a2036f17c81e8398bd4bc302e0f (patch)
tree1862c82b3985ac9b0bdf8ade70a1022befa6d4d2 /clang/lib/CodeGen/TargetInfo.cpp
parent3d8905f3a03275f517340e5dd3c362f1b3147511 (diff)
downloadbcm5719-llvm-6f4cdb89122d3a2036f17c81e8398bd4bc302e0f.tar.gz
bcm5719-llvm-6f4cdb89122d3a2036f17c81e8398bd4bc302e0f.zip
Reland: [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 with minor changes (use regexp instead of the hardcoded values) to the test. llvm-svn: 302670
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 4ceb336d175..33d6a6ff414 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -6693,6 +6693,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