This is the mail archive of the gcc@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: Problem with ARM_DOUBLEWORD_ALIGN on ARM


Geert Bosch wrote:

> Nested functions aren't used that much in C indeed... :)

Paul, would you please review this patch?

> --- arm.c.orig  2007-11-20 16:27:04.000000000 -0500
> +++ arm.c       2007-11-21 18:15:18.000000000 -0500
> @@ -10448,6 +10448,14 @@ arm_get_frame_offsets (void)
>    /* Saved registers include the stack frame.  */
>    offsets->saved_regs = offsets->saved_args + saved;
>    offsets->soft_frame = offsets->saved_regs + CALLER_INTERWORKING_SLOT_SIZE;
> +
> +  /* Allow for storage of static chain when it needs its own space in the
> +     frame. */
> +  if (IS_NESTED (arm_current_func_type ())
> +      && regs_ever_live[3]
> +      && offsets->saved_args == 0)
> +    offsets->soft_frame += 4;
> +
>    /* A leaf function does not need any stack alignment if it has nothing
>       on the stack.  */
>    if (leaf && frame_size == 0)
> @@ -10569,6 +10577,7 @@ arm_expand_prologue (void)
>    unsigned long live_regs_mask;
>    unsigned long func_type;
>    int fp_offset = 0;
> +  int static_chain_size = 0;
>    int saved_pretend_args = 0;
>    int saved_regs = 0;
>    unsigned HOST_WIDE_INT args_to_push;
> @@ -10643,6 +10652,7 @@ arm_expand_prologue (void)
>               insn = emit_insn (insn);
>  
>               fp_offset = 4;
> +             static_chain_size = 4;
>  
>               /* Just tell the dwarf backend that we adjusted SP.  */
>               dwarf = gen_rtx_SET (VOIDmode, stack_pointer_rtx,
> @@ -10836,14 +10846,15 @@ arm_expand_prologue (void)
>      }
>  
>    offsets = arm_get_frame_offsets ();
> -  if (offsets->outgoing_args != offsets->saved_args + saved_regs)
> +  if (offsets->outgoing_args != offsets->saved_args + saved_regs
> +      + static_chain_size)
>      {
>        /* This add can produce multiple insns for a large constant, so we
>          need to get tricky.  */
>        rtx last = get_last_insn ();
>  
>        amount = GEN_INT (offsets->saved_args + saved_regs
> -                       - offsets->outgoing_args);
> +                        + static_chain_size - offsets->outgoing_args);
>  
>        insn = emit_insn (gen_addsi3 (stack_pointer_rtx, stack_pointer_rtx,
>                                     amount));
> 


-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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