This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
"fix" alpha register allocation
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 15 Jan 2004 01:59:36 -0800
- Subject: "fix" alpha register allocation
This has been bugging me for a while...
GCC's register preferencing for ev6 leaves a lot to be desired.
What we wind up with is lots of pointers being allocated to fp
registers, just because there's a moderately cheap int<->fp move
instruction. Which leads to some pretty horrible looking code.
I can imagine that this reordering might have the opposite effect
for some specific numeric-heavy test cases, but for the nonce,
text data bss dec hex filename
5284225 33232 260080 5577537 551b41 old/gcc/cc1plus
5237385 33232 260080 5530697 546449 new/gcc/cc1plus
saving >45k on a sample application is nothing to be ignored.
It merely reinforces exactly how bad we are doing here...
r~
* config/alpha/alpha.h (REG_ALLOC_ORDER): Reorder fp regs after
integer regs of the same call-savedness.
Index: alpha.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.h,v
retrieving revision 1.212
diff -c -p -d -r1.212 alpha.h
*** alpha.h 14 Jan 2004 20:16:57 -0000 1.212
--- alpha.h 15 Jan 2004 09:49:25 -0000
*************** extern const char *alpha_tls_size_string
*** 579,622 ****
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
/* List the order in which to allocate registers. Each register must be
! listed once, even those in FIXED_REGISTERS.
!
! We allocate in the following order:
! $f10-$f15 (nonsaved floating-point register)
! $f22-$f30 (likewise)
! $f21-$f16 (likewise, but input args)
! $f0 (nonsaved, but return value)
! $f1 (nonsaved, but immediate before saved)
! $f2-$f9 (saved floating-point registers)
! $1-$8 (nonsaved integer registers)
! $22-$25 (likewise)
! $28 (likewise)
! $0 (likewise, but return value)
! $21-$16 (likewise, but input args)
! $27 (procedure value in OSF, nonsaved in NT)
! $9-$14 (saved integer registers)
! $26 (return PC)
! $15 (frame pointer)
! $29 (global pointer)
! $30, $31, $f31 (stack pointer and always zero/ap & fp) */
! #define REG_ALLOC_ORDER \
! {42, 43, 44, 45, 46, 47, \
! 54, 55, 56, 57, 58, 59, 60, 61, 62, \
! 53, 52, 51, 50, 49, 48, \
! 32, 33, \
! 34, 35, 36, 37, 38, 39, 40, 41, \
! 1, 2, 3, 4, 5, 6, 7, 8, \
! 22, 23, 24, 25, \
! 28, \
! 0, \
! 21, 20, 19, 18, 17, 16, \
! 27, \
! 9, 10, 11, 12, 13, 14, \
! 26, \
! 15, \
! 29, \
! 30, 31, 63 }
/* Return number of consecutive hard regs needed starting at reg REGNO
to hold something of mode MODE.
--- 579,608 ----
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
/* List the order in which to allocate registers. Each register must be
! listed once, even those in FIXED_REGISTERS. */
! #define REG_ALLOC_ORDER { \
! 1, 2, 3, 4, 5, 6, 7, 8, /* nonsaved integer registers */ \
! 22, 23, 24, 25, 28, /* likewise */ \
! 0, /* likewise, but return value */ \
! 21, 20, 19, 18, 17, 16, /* likewise, but input args */ \
! 27, /* likewise, but OSF procedure value */ \
! \
! 42, 43, 44, 45, 46, 47, /* nonsaved floating-point registers */ \
! 54, 55, 56, 57, 58, 59, /* likewise */ \
! 60, 61, 62, /* likewise */ \
! 32, 33, /* likewise, but return values */ \
! 53, 52, 51, 50, 49, 48, /* likewise, but input args */ \
! \
! 9, 10, 11, 12, 13, 14, /* saved integer registers */ \
! 26, /* return address */ \
! 15, /* hard frame pointer */ \
! \
! 34, 35, 36, 37, 38, 39, /* saved floating-point registers */ \
! 40, 41, /* likewise */ \
! \
! 29, 30, 31, 63 /* gp, sp, ap, sfp */ \
! }
/* Return number of consecutive hard regs needed starting at reg REGNO
to hold something of mode MODE.