[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Small frame optimization: Butterfly -= 90 bytes
From: |
Dmitry K. |
Subject: |
Re: [avr-gcc-list] Small frame optimization: Butterfly -= 90 bytes |
Date: |
Mon, 19 Jan 2004 08:52:22 +1000 |
User-agent: |
KMail/1.5 |
19 Jan 2004 08:33 Dmitry K. wrote:
> It has reduced the size of code Butterfly by 90 bytes (with
> a simultaneous prize in speed).
>
Where the attachment disappeared?
I shall insert it in a body of the letter:
Patch for avr.c:
> ----------------------------------------------------------------------
> FOR LOOCKING OF IDEA ONLY, NOT USE FOR WORK.
> THERE ARE IMPERFECTIONS AND MISTAKES ARE POSSIBLE, DID NOT TEST.
> ----------------------------------------------------------------------
--- avr.c.orig 2002-10-25 07:07:21.000000000 +1100
+++ avr.c 2004-01-18 19:28:24.000000000 +1000
@@ -717,6 +717,7 @@
fprintf (file, "\t" AS1 (push,%s) "\n", avr_regnames[reg]);
}
}
+#if 0
if (frame_pointer_needed)
{
{
@@ -746,6 +747,43 @@
}
}
}
+#else
+ if (frame_pointer_needed)
+ {
+ fputs ("\t" AS1(push,r28) "\n", file);
+ fputs ("\t" AS1(push,r29) "\n", file);
+ prologue_size += 2;
+ if ( size > 10
+ || (size && (interrupt_func_p || signal_func_p)) )
+ {
+ fprintf (file, "\t"
+ AS2(in,r28,__SP_L__) CR_TAB
+ AS2(in,r29,__SP_H__) "\n");
+ prologue_size += 2;
+ fputs ("\t", file);
+ prologue_size += out_adj_frame_ptr (file, size);
+ if (interrupt_func_p)
+ prologue_size += out_set_stack_ptr (file, 1, 1);
+ else if (signal_func_p)
+ prologue_size += out_set_stack_ptr (file, 0, 0);
+ else
+ prologue_size += out_set_stack_ptr (file, -1, -1);
+ } else if (size) {
+ int i;
+ for (i= size/2; i; i--) {
+ fputs ("\t" AS1(rcall,.) "\n", file);
+ prologue_size += 1;
+ }
+ if (size % 2) {
+ fputs ("\t" AS1(push,__zero_reg__) "\n", file);
+ prologue_size += 1;
+ }
+ fputs ("\t" AS2(in,r28,__SP_L__) "\n", file);
+ fputs ("\t" AS2(in,r29,__SP_H__) "\n", file);
+ prologue_size += 2;
+ }
+ }
+#endif
}
out:
@@ -848,6 +886,7 @@
if (frame_pointer_needed)
{
+#if 0
if (size)
{
fputs ("\t", file);
@@ -862,6 +901,24 @@
epilogue_size += out_set_stack_ptr (file, -1, -1);
}
}
+#else
+ if ( size > 5
+ || (size && (interrupt_func_p || signal_func_p)) )
+ {
+ fputs ("\t", file);
+ epilogue_size += out_adj_frame_ptr (file, -size);
+ if (interrupt_func_p || signal_func_p)
+ epilogue_size += out_set_stack_ptr (file, -1, 0);
+ else
+ epilogue_size += out_set_stack_ptr (file, -1, -1);
+ } else if (size) {
+ int i;
+ for (i= size; i; i--) {
+ fputs ("\t" AS1(pop,__tmp_reg__) "\n", file);
+ epilogue_size += 1;
+ }
+ }
+#endif
fprintf (file, "\t"
AS1 (pop,r29) CR_TAB
AS1 (pop,r28) "\n");