Fix PR15293: ARM codegen ice - expected larger existing stack allocation

Stepan Dyatkovskiy stpworld at narod.ru
Sat Apr 27 00:39:01 PDT 2013


Hello, Renato.

According to AAPCS:

"7 ARM C AND C++ LANGUAGE MAPPINGS" ->
   "7.2 Argument Passing Conventions"

and

"6 THE STANDARD VARIANTS" ->
   "6.1 VFP and Advanced SIMD Register Arguments" ->
     "6.1.2 Procedure Calling"

I've concluded the next points:

* VarArg function uses the same regulations for parameter passing as 
regular ones (5.5 Parameters Passing).
* Exception #1: float is converted to double.
* Exception #2: There is no CPRCs for VA function. That means: all float 
and doubles goes to unallocated GPRs first, and then to stack.

So, then for example, in next call of "foo(.../*var-args*/)":

"foo(uint32_t_p0, uint32_t_p1, uint32_t_p2, double_d0)"

the parameters assignment should be as below:

uint32_t_p0 -> r0
uint32_t_p1 -> r1
uint32_t_p2 -> r2
double_d0   -> SP+0, align = 8; according to
                alignment rules we waste r3.

And, for example, this call:

"foo(uint32_t_p0, double_d0, double_d1)"

uint32_t_p0 -> r0
double_d0   -> r2,r3, align = 0; according to
                alignment rules we waste r1
double_d1   -> SP+0, align = 8.

-Stepan

Renato Golin wrote:
> Hi Stepan,
>
> +  // Case #2. Var-args function, that doesn't contain byval parameters.
> +  //          The same: eat all remained unallocated registers,
> +  //          initialize stack frame.
>
> Doesn't var-arg functions *always* use the stack? Why do you need to
> consume the other registers?
>
> cheers,
> --renato




More information about the llvm-commits mailing list