This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gimple va_arg for mips


On Fri, Jul 09, 2004 at 11:21:50AM +0100, Richard Sandiford wrote:
> In the case of newabi, we were supposed to pass MUST_PASS_IN_STACK
> arguments in the normal stack area, by value.  And it seemed to work.

It *will* work, for normal argument passing.  But you can't make
va_arg work with this scheme, with just "typedef void *va_list".

> The down padding was supposed to be handled by:
> 
>           ...
> 	  if (BYTES_BIG_ENDIAN)
> 	    addr_rtx = plus_constant (addr_rtx, rsize - size);
>           ...
> 
> for !EABI_FLOAT_VARARGS_P and:
> 
>           ...
> 	  if (BYTES_BIG_ENDIAN && osize > size)
> 	    t = build (PLUS_EXPR, TREE_TYPE (t), t,
> 		       build_int_2 (osize - size, 0));
>           ...

There are two components to padding.  That's one of them.  The other
is how you align the slot.  In particular, 

      if (!PAD_VARARGS_DOWN)
        {
          t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist_tmp,
                      build2 (PLUS_EXPR, TREE_TYPE (valist), valist_tmp,
                              build_int_2 (boundary / BITS_PER_UNIT - 1, 0)));
          gimplify_and_add (t, pre_p);
        }
      t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist_tmp,
                  build2 (BIT_AND_EXPR, TREE_TYPE (valist), valist_tmp,
                          build_int_2 (~(boundary / BITS_PER_UNIT - 1), -1)));

vs

      t = build (PLUS_EXPR, TREE_TYPE (valist), valist,
                 build_int_2 (align - 1, 0));
      t = build (BIT_AND_EXPR, TREE_TYPE (t), t, build_int_2 (-align, -1));

for !EABI.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]