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:[email protected]] Sent: 16 January 2014 14:39 To: Tim Northover Cc: Oliver Stannard; [email protected] Subject: Re: [PATCH] Fix AAPCS-VFP non-compliance when returning HFA from variadic function On 16 January 2014 12:03, Tim Northover <[email protected]> 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
arm-hfa-variadic-vfp-calling-convention.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
