[PATCH] Fix AAPCS-VFP non-compliance when returning HFA from variadic function

Oliver Stannard oliver.stannard at arm.com
Thu Jan 16 08:02:41 PST 2014


I had another look, and it turns out that there is a very similar bug
affecting HFA function arguments to variadic functions. I have attached an
updated version of my patch which fixes this.

 

I had a look through the rest of the source, and cannot find any other cases
which look like they need fixing. In the ARM backend, variadic functions are
marshalled by the same code as base AAPCS functions
(lib/Target/ARM/ARMISelLowering.cpp:1295).

 

The code that caused these bugs is in clang, and performs transformations on
function arguments such as converting a one argument of type "struct
containing 4 doubles" into 4 arguments, each of type double. This has added
complexities, as it has to track how arguments will be marshalled and insert
"padding" arguments, to avoid splitting a struct between the VFP registers
and the stack. This seems like a fairly fragile way to do things. Does
anyone know what the rationale behind doing this in clang is?

 

Oliver

 

From: Renato Golin [mailto:renato.golin at linaro.org] 
Sent: 16 January 2014 14:39
To: Tim Northover
Cc: Oliver Stannard; cfe-commits at cs.uiuc.edu
Subject: Re: [PATCH] Fix AAPCS-VFP non-compliance when returning HFA from
variadic function

 

On 16 January 2014 12:03, Tim Northover <t.p.northover at gmail.com> wrote:

Which seems to mean the correct change is basically replacing any
check for "AAPCS_VFP" with "AAPCS_VFP && !isVariadic" (with any
simplifications that might be possible).

 

Yes, *every* variadic function uses the base standard, so that could be used
as a shortcut on any function that marshals arguments or return values,
independent on the VFP status.

 

--renato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140116/ff225e5c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arm-hfa-variadic-vfp-calling-convention.patch
Type: application/octet-stream
Size: 4360 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140116/ff225e5c/attachment.obj>


More information about the cfe-commits mailing list