diff options
author | nickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-02-10 17:23:40 +0000 |
---|---|---|
committer | nickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-02-10 17:23:40 +0000 |
commit | 36706943f09724df04805d13092fadbb1444359a (patch) | |
tree | 06dd8ac1dbfda4aff2b93dd83128bba0d8e2db5f /gcc/config/mn10300/mn10300.c | |
parent | bf62ed7307453c4f8d35c952fba2c2a5d990b1a4 (diff) | |
download | gcc-36706943f09724df04805d13092fadbb1444359a.tar.gz |
* config/mn10300/mn10300.c (popcount): New function.
(mn10300_expand_prologue): Include saved registers in stack usage
count.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207665 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/mn10300/mn10300.c')
-rw-r--r-- | gcc/config/mn10300/mn10300.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index a2133f21783..eb000776750 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -741,16 +741,31 @@ mn10300_gen_multiple_store (unsigned int mask) F (emit_insn (x)); } +static inline unsigned int +popcount (unsigned int mask) +{ + unsigned int count = 0; + + while (mask) + { + ++ count; + mask &= ~ (mask & - mask); + } + return count; +} + void mn10300_expand_prologue (void) { HOST_WIDE_INT size = mn10300_frame_size (); + unsigned int mask; - if (flag_stack_usage_info) - current_function_static_stack_size = size; - + mask = mn10300_get_live_callee_saved_regs (NULL); /* If we use any of the callee-saved registers, save them now. */ - mn10300_gen_multiple_store (mn10300_get_live_callee_saved_regs (NULL)); + mn10300_gen_multiple_store (mask); + + if (flag_stack_usage_info) + current_function_static_stack_size = size + popcount (mask) * 4; if (TARGET_AM33_2 && fp_regs_to_save ()) { @@ -767,6 +782,9 @@ mn10300_expand_prologue (void) unsigned int strategy_size = (unsigned)-1, this_strategy_size; rtx reg; + if (flag_stack_usage_info) + current_function_static_stack_size += num_regs_to_save * 4; + /* We have several different strategies to save FP registers. We can store them using SP offsets, which is beneficial if there are just a few registers to save, or we can use `a0' in |