This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[3.4-BIB] i386/x86-64 prologues tweek
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, rth at cygnus dot com
- Date: Sat, 30 Nov 2002 19:11:29 +0100
- Subject: [3.4-BIB] i386/x86-64 prologues tweek
Hi,
this patch save some code size by using fast prologues only for hot functions.
Regtested on BIB branch. OK?
Sat Nov 30 19:10:07 CET 2002 Jan Hubicka <jh@suse.cz>
* i386.c (ix86_expand_prologue): Add comment, do not use
fast prologues for cold and normal functions.
Index: i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.447.2.35
diff -c -3 -p -r1.447.2.35 i386.c
*** i386.c 28 Nov 2002 22:58:21 -0000 1.447.2.35
--- i386.c 30 Nov 2002 18:09:43 -0000
*************** ix86_expand_prologue ()
*** 4668,4676 ****
if (!optimize_size)
{
int count = frame.nregs;
if (count)
count = (count - 1) * FAST_PROLOGUE_INSN_COUNT;
! use_fast_prologue_epilogue = !expensive_function_p (count);
if (TARGET_PROLOGUE_USING_MOVE)
use_mov = use_fast_prologue_epilogue;
}
--- 4668,4690 ----
if (!optimize_size)
{
int count = frame.nregs;
+
+ /* The fast prologue uses moves instead of push to save registers. THis
+ is significantly longer, but also executes faster as modern hardware
+ can execute the moves in parallel, but can't do that for push/pop.
+
+ Be curefull about choosing what prologue to emit: When function takes
+ many instructions to execute we may use slow version as well as in case
+ function is known to be outside hot spot (this is known with feedback
+ only) */
if (count)
count = (count - 1) * FAST_PROLOGUE_INSN_COUNT;
! if (cfun->function_frequency < FUNCTION_FREQUENCY_NORMAL
! || (flag_branch_probabilities
! && cfun->function_frequency < FUNCTION_FREQUENCY_HOT))
! use_fast_prologue_epilogue = 0;
! else
! use_fast_prologue_epilogue = !expensive_function_p (count);
if (TARGET_PROLOGUE_USING_MOVE)
use_mov = use_fast_prologue_epilogue;
}