diff options
| author | Oliver Stannard <oliver.stannard@arm.com> | 2014-05-09 15:14:56 +0000 |
|---|---|---|
| committer | Oliver Stannard <oliver.stannard@arm.com> | 2014-05-09 15:14:56 +0000 |
| commit | fd754157c9567390f724a496fe87103b321074a8 (patch) | |
| tree | 73278a7653103925f5a9f5fff497e493dcb31e9d /lib/CodeGen/TargetInfo.cpp | |
| parent | 63b00e2fde26dc817f50cade6da136be387f87af (diff) | |
| download | clang-fd754157c9567390f724a496fe87103b321074a8.tar.gz clang-fd754157c9567390f724a496fe87103b321074a8.tar.bz2 clang-fd754157c9567390f724a496fe87103b321074a8.tar.xz | |
ARM: HFAs must be passed in consecutive registers
This is the clang counterpart to 208413, which ensures that Homogeneous
Floating-point Aggregates are passed in consecutive registers on ARM.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208417 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/TargetInfo.cpp')
| -rw-r--r-- | lib/CodeGen/TargetInfo.cpp | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index d539ffc517..64f9e7b544 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -3796,7 +3796,7 @@ public: private: ABIArgInfo classifyReturnType(QualType RetTy, bool isVariadic) const; - ABIArgInfo classifyArgumentType(QualType RetTy, bool &IsHA, bool isVariadic, + ABIArgInfo classifyArgumentType(QualType RetTy, bool isVariadic, bool &IsCPRC) const; bool isIllegalVectorType(QualType Ty) const; @@ -3901,22 +3901,10 @@ void ARMABIInfo::computeInfo(CGFunctionInfo &FI) const { for (auto &I : FI.arguments()) { unsigned PreAllocationVFPs = AllocatedVFPs; unsigned PreAllocationGPRs = AllocatedGPRs; - bool IsHA = false; bool IsCPRC = false; // 6.1.2.3 There is one VFP co-processor register class using registers // s0-s15 (d0-d7) for passing arguments. - I.info = classifyArgumentType(I.type, IsHA, FI.isVariadic(), IsCPRC); - assert((IsCPRC || !IsHA) && "Homogeneous aggregates must be CPRCs"); - // If we do not have enough VFP registers for the HA, any VFP registers - // that are unallocated are marked as unavailable. To achieve this, we add - // padding of (NumVFPs - PreAllocationVFP) floats. - // Note that IsHA will only be set when using the AAPCS-VFP calling convention, - // and the callee is not variadic. - if (IsHA && AllocatedVFPs > NumVFPs && PreAllocationVFPs < NumVFPs) { - llvm::Type *PaddingTy = llvm::ArrayType::get( - llvm::Type::getFloatTy(getVMContext()), NumVFPs - PreAllocationVFPs); - I.info = ABIArgInfo::getExpandWithPadding(false, PaddingTy); - } + I.info = classifyArgumentType(I.type, FI.isVariadic(), IsCPRC); // If we have allocated some arguments onto the stack (due to running // out of VFP registers), we cannot split an argument between GPRs and @@ -3930,6 +3918,7 @@ void ARMABIInfo::computeInfo(CGFunctionInfo &FI) const { llvm::Type::getInt32Ty(getVMContext()), NumGPRs - PreAllocationGPRs); I.info = ABIArgInfo::getDirect(nullptr /* type */, 0 /* offset */, PaddingTy); + } } @@ -4113,8 +4102,7 @@ void ARMABIInfo::resetAllocatedRegs(void) const { VFPRegs[i] = 0; } -ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty, bool &IsHA, - bool isVariadic, +ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty, bool isVariadic, bool &IsCPRC) const { // We update number of allocated VFPs according to // 6.1.2.1 The following argument types are VFP CPRCs: @@ -4226,9 +4214,8 @@ ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty, bool &IsHA, Base->isSpecificBuiltinType(BuiltinType::LongDouble)); markAllocatedVFPs(2, Members * 2); } - IsHA = true; IsCPRC = true; - return ABIArgInfo::getExpand(); + return ABIArgInfo::getDirect(); } } @@ -4242,7 +4229,7 @@ ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty, bool &IsHA, getABIKind() == ARMABIInfo::AAPCS) ABIAlign = std::min(std::max(TyAlign, (uint64_t)4), (uint64_t)8); if (getContext().getTypeSizeInChars(Ty) > CharUnits::fromQuantity(64)) { - // Update Allocated GPRs + // Update Allocated GPRs markAllocatedGPRs(1, 1); return ABIArgInfo::getIndirect(TyAlign, /*ByVal=*/true, /*Realign=*/TyAlign > ABIAlign); |
