Skip to content

Commit

Permalink
or1k: Support -fstack-usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Henderson authored and stffrdhrn committed Dec 3, 2017
1 parent 388cb6f commit 0dc5c5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gcc/config/or1k/or1k.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@

static struct
{
HOST_WIDE_INT static_size;
HOST_WIDE_INT total_size;
int save_size;
unsigned int save_mask;
Expand Down Expand Up @@ -174,6 +175,8 @@ or1k_compute_frame_size ()
vars_size = OR1K_ALIGN (vars_size, UNITS_PER_WORD);
args_size = crtl->outgoing_args_size;
total_size = vars_size + save_size + args_size;

frame_info.static_size = total_size;
if (crtl->is_leaf && !cfun->calls_alloca)
{
if (total_size > or1k_redzone)
Expand Down Expand Up @@ -1354,6 +1357,9 @@ or1k_expand_prologue (void)
unsigned int save_mask = frame_info.save_mask;
rtx insn;

if (flag_stack_usage_info)
current_function_static_stack_size = frame_info.static_size;

if (total_size == 0 && save_mask == 0)
goto fini;

Expand Down
2 changes: 2 additions & 0 deletions gcc/testsuite/gcc.dg/stack-usage-1.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
#define SIZE 252
#elif defined (__M32R__)
#define SIZE 252
#elif defined (__OR1K__) || defined(__OR1KND__)
#define SIZE 252
#else
# define SIZE 256
#endif
Expand Down

0 comments on commit 0dc5c5c

Please sign in to comment.