Patchwork Add static size report when using -fstack-usage for ARM targets

login
register
mail settings
Submitter Thomas Klein
Date Nov. 24, 2010, 4:50 p.m.
Message ID <4CED423F.2020508@web.de>
Download mbox | patch
Permalink /patch/72909/
State New
Headers show

Comments

Thomas Klein - Nov. 24, 2010, 4:50 p.m.
Hello

Sorry for sending this previously to the wrong mailing list.
I've tried to correct and reduce the lines of code here.
The static size is in both cases "outgoing_args - saved_args".

regards
   Thomas

2010-11-24  Thomas Klein <th.r.klein@web.de>

     * config/arm/arm.c (arm_expand_prologue): Report the static stack 
size if -fstack-usage is used
     * config/arm/arm.c (thumb1_expand_prologue): Report the static 
stack size if -fstack-usage is used
Richard Earnshaw - Nov. 26, 2010, 3:14 p.m.
On Wed, 2010-11-24 at 16:50 +0000, Thomas Klein wrote:
> Hello
> 
> Sorry for sending this previously to the wrong mailing list.
> I've tried to correct and reduce the lines of code here.
> The static size is in both cases "outgoing_args - saved_args".
> 
> regards
>    Thomas
> 
> 2010-11-24  Thomas Klein <th.r.klein@web.de>
> 
>      * config/arm/arm.c (arm_expand_prologue): Report the static stack 
> size if -fstack-usage is used
>      * config/arm/arm.c (thumb1_expand_prologue): Report the static 
> stack size if -fstack-usage is used
> 

ChangeLog entries should be manually wrapped to keep them below 80
columns.

> Index: gcc/config/arm/arm.c
> ===================================================================
> --- gcc/config/arm/arm.c        (revision 167110)
> +++ gcc/config/arm/arm.c        (working copy)
> @@ -15726,6 +15726,10 @@ arm_expand_prologue (void)
>          }
>       }
> 
> +  if (flag_stack_usage)
> +    current_function_static_stack_size = offsets->outgoing_args
> +                                       - offsets->saved_args;
> +

Either this should be written as

  if (flag_stack_usage)
    current_function_static_stack_size
      = offsets->outgoing_args - offsets->saved_args;

Or you should put brackets around the expression to keep the indentation
correct.  Think: will GNU "reindent" change the indentation of my code?
If the answer is yes, then you've not got the indentation correct.

> 
>     if (offsets->outgoing_args != offsets->saved_args + saved_regs)
>       {
>         /* This add can produce multiple insns for a large constant, so we
> @@ -20538,6 +20542,10 @@ thumb1_expand_prologue (void)
>       emit_move_insn (gen_rtx_REG (Pmode, ARM_HARD_FRAME_POINTER_REGNUM),
>                      stack_pointer_rtx);
> 
> +  if (flag_stack_usage)
> +    current_function_static_stack_size = offsets->outgoing_args
> +                                       - offsets->saved_args;
> +

Same here.

Otherwise OK.

Patch

Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c        (revision 167110)
+++ gcc/config/arm/arm.c        (working copy)
@@ -15726,6 +15726,10 @@  arm_expand_prologue (void)
         }
      }

+  if (flag_stack_usage)
+    current_function_static_stack_size = offsets->outgoing_args
+                                       - offsets->saved_args;
+
    if (offsets->outgoing_args != offsets->saved_args + saved_regs)
      {
        /* This add can produce multiple insns for a large constant, so we
@@ -20538,6 +20542,10 @@  thumb1_expand_prologue (void)
      emit_move_insn (gen_rtx_REG (Pmode, ARM_HARD_FRAME_POINTER_REGNUM),
                     stack_pointer_rtx);

+  if (flag_stack_usage)
+    current_function_static_stack_size = offsets->outgoing_args
+                                       - offsets->saved_args;
+
    amount = offsets->outgoing_args - offsets->saved_regs;
    amount -= 4 * thumb1_extra_regs_pushed (offsets, true);
    if (amount)