[cfe-commits] [patch][pr13436] Fix some uses of regparm on X86

John McCall rjmccall at apple.com
Mon Jul 30 17:58:52 PDT 2012

On Jul 24, 2012, at 2:24 PM, Rafael EspĂ­ndola wrote:
> I found that clang's implementation of regparm doesn't match gcc's
> when the argument is a struct. Clang just skips the struct, gcc splits
> it in 32 bit chunks that are passed in registers. Not too different
> from the x86-64 abi.
> In a bit more detail, it looks like gcc does the following:
> * Arguments of type float, double, {float} and {double} are classified as
> Float, and every other argument type is classified as Integer.
> * Float arguments are passed on the stack and don't consume registers.
> * If an integer argument fits completely in the remaining registers, it is
> passed in registers, otherwise it goes to the stack.
> * Integer arguments consume registers even if they don't fit, so once an
> argument goes to the stack every other argument goes to the stack.
> * A struct return is still done indirectly, but the pointer is passed
> as the first argument in registers.
> This patch implements this. Note that it depends on the patch I just
> posted to the llvm list.

Looks fine to me.


More information about the cfe-commits mailing list