This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[AVR, Committed] Optimize prologue/epilogue code for function with 'OS_task' attribute
- From: "Anatoly Sokolov" <aesok at post dot ru>
- To: <gcc-patches at gcc dot gnu dot org>
- Cc: <aesok at post dot ru>, <eweddington at cso dot atmel dot com>
- Date: Fri, 11 Jan 2008 23:25:51 +0300
- Subject: [AVR, Committed] Optimize prologue/epilogue code for function with 'OS_task' attribute
Hello.
This patch optimize prologue/epilogue code for function with 'OS_task' attribute:
1. Don't save/restore frame pointer register in stack;
2. Don't use 'call-prologues' optimization.
2007-01-11 Anatoly Sokolov <aesok@post.ru>
* config/avr/avr.c (expand_prologue, expand_epilogue): Don't
save/restore frame pointer register and don't use 'call-prologues'
optimization in function with "OS_task" attribute.
Index: gcc/config/avr/avr.c
===================================================================
--- gcc/config/avr/avr.c (revision 131472)
+++ gcc/config/avr/avr.c (working copy)
@@ -607,7 +607,9 @@
live_seq = sequent_regs_live ();
minimize = (TARGET_CALL_PROLOGUES
- && !(cfun->machine->is_interrupt || cfun->machine->is_signal)
+ && !cfun->machine->is_interrupt
+ && !cfun->machine->is_signal
+ && !cfun->machine->is_OS_task
&& live_seq);
if (cfun->machine->is_interrupt || cfun->machine->is_signal)
@@ -668,9 +670,13 @@
}
if (frame_pointer_needed)
{
- /* Push frame pointer. */
- insn = emit_move_insn (pushword, frame_pointer_rtx);
- RTX_FRAME_RELATED_P (insn) = 1;
+ if(!cfun->machine->is_OS_task)
+ {
+ /* Push frame pointer. */
+ insn = emit_move_insn (pushword, frame_pointer_rtx);
+ RTX_FRAME_RELATED_P (insn) = 1;
+ }
+
if (!size)
{
insn = emit_move_insn (frame_pointer_rtx, stack_pointer_rtx);
@@ -813,7 +819,9 @@
live_seq = sequent_regs_live ();
minimize = (TARGET_CALL_PROLOGUES
- && !(cfun->machine->is_interrupt || cfun->machine->is_signal)
+ && !cfun->machine->is_interrupt
+ && !cfun->machine->is_signal
+ && !cfun->machine->is_OS_task
&& live_seq);
if (minimize && (frame_pointer_needed || live_seq > 4))
@@ -876,9 +884,11 @@
emit_move_insn (stack_pointer_rtx, frame_pointer_rtx);
}
}
-
- /* Restore previous frame_pointer. */
- emit_insn (gen_pophi (frame_pointer_rtx));
+ if(!cfun->machine->is_OS_task)
+ {
+ /* Restore previous frame_pointer. */
+ emit_insn (gen_pophi (frame_pointer_rtx));
+ }
}
/* Restore used registers. */
HARD_REG_SET set;
Anatoly.