Patch AVR: fix call prologue saves for avr6 - commited.
Anatoly Sokolov
aesok@post.ru
Sun May 25 23:40:00 GMT 2008
Hi.
Tristan Gingold wrote:
>
> this is a tiny patch to fix the use of prologue_saves on avr6. As
> EIND is always 0, a stub must be generated (if required) for the return point.
>
>
> 2008-05-21 Tristan Gingold <gingold@adacore.com>
>
> * config/avr/avr.md ("call_prologue_saves"): Use hi8(gs())/lo8(gs())
> instead of pm_lo8/pm_hi8 to makes this call working on avr6.
If function prologue code placed above low 128K code memory then linker add
JMP instruction, the code become on 2 words is longer. Hence "call_prologue"
optimization to become less useful. If for devices with up to 128K code
memory it is useful when it is necessary to store 6 regs in a stack, that for
devices with more memory, 6 regs when function prologue code placed in low
128K and 8 regs when function prologue code placed in high 128K. Location of
code will be known in link time, therefore when choosing of this optimization
should be use average value - 7.
2008-05-26 Tristan Gingold <gingold@adacore.com>
Anatoly Sokolov <aesok@post.ru>
* config/avr/avr.md ("call_prologue_saves"): Use hi8(gs())/lo8(gs())
instead of pm_lo8/pm_hi8 to makes this call working on avr6.
* config/avr/avr.c (expand_prologue): Tune "call_prologue"
optimization for 'avr6' architecture.
Index: gcc/config/avr/avr.c
===================================================================
--- gcc/config/avr/avr.c (revision 135845)
+++ gcc/config/avr/avr.c (working copy)
@@ -682,7 +694,9 @@
/* Prevent any attempt to delete the setting of ZERO_REG! */
emit_insn (gen_rtx_USE (VOIDmode, zero_reg_rtx));
}
- if (minimize && (frame_pointer_needed || live_seq > 6))
+ if (minimize && (frame_pointer_needed
+ || (AVR_2_BYTE_PC && live_seq > 6)
+ || live_seq > 7))
{
insn = emit_move_insn (gen_rtx_REG (HImode, REG_X),
gen_int_mode (size, HImode));
Index: gcc/config/avr/avr.md
===================================================================
--- gcc/config/avr/avr.md (revision 135845)
+++ gcc/config/avr/avr.md (working copy)
@@ -2777,8 +2934,8 @@
(use (reg:HI REG_X))
(clobber (reg:HI REG_Z))]
""
- "ldi r30,pm_lo8(1f)
- ldi r31,pm_hi8(1f)
+ "ldi r30,lo8(gs(1f))
+ ldi r31,hi8(gs(1f))
%~jmp __prologue_saves__+((18 - %0) * 2)
1:"
[(set_attr_alternative "length"
Anatoly.
More information about the Gcc-patches
mailing list