diff options
author | Marek Michalkiewicz <marekm@amelek.gda.pl> | 2002-06-08 19:25:43 +0200 |
---|---|---|
committer | Marek Michalkiewicz <marekm@gcc.gnu.org> | 2002-06-08 17:25:43 +0000 |
commit | e52b6b63daa2f2467e2a615534071bd050f97f48 (patch) | |
tree | a26651fcf497b750618bc37c8f67153a3421fb0e /gcc | |
parent | 1569d6700c4616964e7514228207664c04ea24c3 (diff) | |
download | gcc-e52b6b63daa2f2467e2a615534071bd050f97f48.zip gcc-e52b6b63daa2f2467e2a615534071bd050f97f48.tar.gz gcc-e52b6b63daa2f2467e2a615534071bd050f97f48.tar.bz2 |
avr.c (avr_regs_to_save): No need to save any registers in a noreturn function.
* config/avr/avr.c (avr_regs_to_save): No need to save any registers
in a noreturn function.
(avr_output_function_prologue, avr_output_function_epilogue):
Correct function size calculation. Do not crash on empty function.
(avr_output_function_epilogue): No need for epilogue after a BARRIER.
From-SVN: r54386
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config/avr/avr.c | 54 |
2 files changed, 46 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2bfaaf4..79f4ae5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2002-06-08 Marek Michalkiewicz <marekm@amelek.gda.pl> + + * config/avr/avr.c (avr_regs_to_save): No need to save any registers + in a noreturn function. + (avr_output_function_prologue, avr_output_function_epilogue): + Correct function size calculation. Do not crash on empty function. + (avr_output_function_epilogue): No need for epilogue after a BARRIER. + 2002-06-08 Jason Thorpe <thorpej@wasabisystems.com> * config/mips/netbsd.h (SUBTARGET_EXTRA_SPECS): Add diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index c23059c..41dcfbc 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -395,6 +395,11 @@ avr_regs_to_save (set) if (set) CLEAR_HARD_REG_SET (*set); count = 0; + + /* No need to save any registers if the function never returns. */ + if (TREE_THIS_VOLATILE (current_function_decl)) + return 0; + for (reg = 0; reg < 32; reg++) { /* Do not push/pop __tmp_reg__, __zero_reg__, as well as @@ -609,11 +614,16 @@ avr_output_function_prologue (file, size) int main_p; int live_seq; int minimize; - + + last_insn_address = 0; + jump_tables_size = 0; + prologue_size = 0; + fprintf (file, "/* prologue: frame size=%d */\n", size); + if (avr_naked_function_p (current_function_decl)) { - fprintf (file, "/* prologue: naked */\n"); - return; + fputs ("/* prologue: naked */\n", file); + goto out; } interrupt_func_p = interrupt_function_p (current_function_decl); @@ -623,11 +633,6 @@ avr_output_function_prologue (file, size) minimize = (TARGET_CALL_PROLOGUES && !interrupt_func_p && !signal_func_p && live_seq); - last_insn_address = 0; - jump_tables_size = 0; - prologue_size = 0; - fprintf (file, "/* prologue: frame size=%d */\n", size); - if (interrupt_func_p) { fprintf (file,"\tsei\n"); @@ -722,6 +727,8 @@ avr_output_function_prologue (file, size) } } } + + out: fprintf (file, "/* prologue end (size=%d) */\n", prologue_size); } @@ -739,25 +746,39 @@ avr_output_function_epilogue (file, size) int function_size; int live_seq; int minimize; + rtx last = get_last_nonnote_insn (); + + function_size = jump_tables_size; + if (last) + { + rtx first = get_first_nonnote_insn (); + function_size += (INSN_ADDRESSES (INSN_UID (last)) - + INSN_ADDRESSES (INSN_UID (first))); + function_size += get_attr_length (last); + } + + fprintf (file, "/* epilogue: frame size=%d */\n", size); + epilogue_size = 0; if (avr_naked_function_p (current_function_decl)) { - fprintf (file, "/* epilogue: naked */\n"); - return; + fputs ("/* epilogue: naked */\n", file); + goto out; + } + + if (last && GET_CODE (last) == BARRIER) + { + fputs ("/* epilogue: noreturn */\n", file); + goto out; } interrupt_func_p = interrupt_function_p (current_function_decl); signal_func_p = signal_function_p (current_function_decl); main_p = MAIN_NAME_P (DECL_NAME (current_function_decl)); - function_size = (INSN_ADDRESSES (INSN_UID (get_last_nonnote_insn ())) - - INSN_ADDRESSES (INSN_UID (get_first_nonnote_insn ()))); - function_size += jump_tables_size; live_seq = sequent_regs_live (); minimize = (TARGET_CALL_PROLOGUES && !interrupt_func_p && !signal_func_p && live_seq); - epilogue_size = 0; - fprintf (file, "/* epilogue: frame size=%d */\n", size); if (main_p) { /* Return value from main() is already in the correct registers @@ -850,7 +871,8 @@ avr_output_function_epilogue (file, size) fprintf (file, "\tret\n"); ++epilogue_size; } - + + out: fprintf (file, "/* epilogue end (size=%d) */\n", epilogue_size); fprintf (file, "/* function %s size %d (%d) */\n", current_function_name, prologue_size + function_size + epilogue_size, function_size); |