diff options
| author | Oliver Stannard <oliver.stannard@arm.com> | 2014-05-19 13:10:05 +0000 |
|---|---|---|
| committer | Oliver Stannard <oliver.stannard@arm.com> | 2014-05-19 13:10:05 +0000 |
| commit | a3afc69b949768a3aa01865132d9e5bf22a7fe2d (patch) | |
| tree | 7cb308e58eaa2e61f9d46ea5faa7560da1512672 /clang/lib/CodeGen | |
| parent | 6cb47a083bf52d2bea227ab2da5cb00c6b7eb816 (diff) | |
| download | bcm5719-llvm-a3afc69b949768a3aa01865132d9e5bf22a7fe2d.tar.gz bcm5719-llvm-a3afc69b949768a3aa01865132d9e5bf22a7fe2d.zip | |
ARM: PCS non-compliance when struct is padded to avoid register/stack split, and requires internal padding
When we were padding a struct to avoid splitting it between registers and
the stack, we were throwing away the type which the argument should be coerced
to.
llvm-svn: 209122
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index a9cad6511f9..4b49c17c302 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -3869,16 +3869,20 @@ void ARMABIInfo::computeInfo(CGFunctionInfo &FI) const { // If we have allocated some arguments onto the stack (due to running // out of VFP registers), we cannot split an argument between GPRs and // the stack. If this situation occurs, we add padding to prevent the - // GPRs from being used. In this situiation, the current argument could + // GPRs from being used. In this situation, the current argument could // only be allocated by rule C.8, so rule C.6 would mark these GPRs as // unusable anyway. const bool StackUsed = PreAllocationGPRs > NumGPRs || PreAllocationVFPs > NumVFPs; if (!IsCPRC && PreAllocationGPRs < NumGPRs && AllocatedGPRs > NumGPRs && StackUsed) { llvm::Type *PaddingTy = llvm::ArrayType::get( llvm::Type::getInt32Ty(getVMContext()), NumGPRs - PreAllocationGPRs); - I.info = ABIArgInfo::getDirect(nullptr /* type */, 0 /* offset */, - PaddingTy); - + if (I.info.canHaveCoerceToType()) { + I.info = ABIArgInfo::getDirect(I.info.getCoerceToType() /* type */, 0 /* offset */, + PaddingTy); + } else { + I.info = ABIArgInfo::getDirect(nullptr /* type */, 0 /* offset */, + PaddingTy); + } } } |

