diff options
author | Georg-Johann Lay <avr@gjlay.de> | 2011-02-27 08:36:55 +0000 |
---|---|---|
committer | Denis Chertykov <denisc@gcc.gnu.org> | 2011-02-27 11:36:55 +0300 |
commit | 6609216ea928a99d667df90d4fe976872bcd745a (patch) | |
tree | acb0e40b7c8c43b8bca49678c8f728c770575479 | |
parent | e7dc5734a82ce4794027871556dfdd4bf1be2c25 (diff) | |
download | gcc-6609216ea928a99d667df90d4fe976872bcd745a.zip gcc-6609216ea928a99d667df90d4fe976872bcd745a.tar.gz gcc-6609216ea928a99d667df90d4fe976872bcd745a.tar.bz2 |
re PR target/42240 (wrong epilogue on naked function)
2011-02-22 Georg-Johann Lay <avr@gjlay.de>
PR target/42240
* config/avr/avr.c (avr_cannot_modify_jumps_p): New function.
(TARGET_CANNOT_MODIFY_JUMPS_P): Define.
From-SVN: r170534
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/avr/avr.c | 25 |
2 files changed, 31 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 684fad1..88d3edd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-02-22 Georg-Johann Lay <avr@gjlay.de> + + PR target/42240 + * config/avr/avr.c (avr_cannot_modify_jumps_p): New function. + (TARGET_CANNOT_MODIFY_JUMPS_P): Define. + 2011-02-26 Gerald Pfeifer <gerald@pfeifer.com> * doc/invoke.texi (ARC Options): Use CPU instead of cpu. diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 30e4626..c6f60b4 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -73,6 +73,7 @@ static void avr_file_end (void); static bool avr_legitimate_address_p (enum machine_mode, rtx, bool); static void avr_asm_function_end_prologue (FILE *); static void avr_asm_function_begin_epilogue (FILE *); +static bool avr_cannot_modify_jumps_p (void); static rtx avr_function_value (const_tree, const_tree, bool); static void avr_insert_attributes (tree, tree *); static void avr_asm_init_sections (void); @@ -217,6 +218,9 @@ static const struct default_options avr_option_optimization_table[] = #undef TARGET_OPTION_OPTIMIZATION_TABLE #define TARGET_OPTION_OPTIMIZATION_TABLE avr_option_optimization_table +#undef TARGET_CANNOT_MODIFY_JUMPS_P +#define TARGET_CANNOT_MODIFY_JUMPS_P avr_cannot_modify_jumps_p + struct gcc_target targetm = TARGET_INITIALIZER; static void @@ -980,6 +984,27 @@ avr_asm_function_begin_epilogue (FILE *file) fprintf (file, "/* epilogue start */\n"); } + +/* Implement TARGET_CANNOT_MODITY_JUMPS_P */ + +static bool +avr_cannot_modify_jumps_p (void) +{ + + /* Naked Functions must not have any instructions after + their epilogue, see PR42240 */ + + if (reload_completed + && cfun->machine + && cfun->machine->is_naked) + { + return true; + } + + return false; +} + + /* Return nonzero if X (an RTX) is a legitimate memory address on the target machine for a memory operand of mode MODE. */ |