Commit c5e0766b by Alan Modra Committed by Alan Modra

aix.h (FP_SAVE_INLINE, [...]): Delete.

	* aix.h (FP_SAVE_INLINE, GP_SAVE_INLINE): Delete.
	* darwin.h (FP_SAVE_INLINE, GP_SAVE_INLINE): Delete.
	* sysv4.h (FP_SAVE_INLINE, GP_SAVE_INLINE, V_SAVE_INLINE): Delete.
	* config/rs6000/rs6000.c (V_SAVE_INLINE): Delete.
	(rs6000_savres_strategy): Reimplement GP/FP/V_SAVE_INLINE logic.
	For ELF targets, use out-of-line restores for -Os and any number
	of regs if the restore exits, and out-of-line gp save for two or
	more regs.  Use save_reg_p to test for holes in reg restore set.
	Replace "#if" with "if".

From-SVN: r187750
parent bbd72c2f
2012-05-22 Alan Modra <amodra@gmail.com> 2012-05-22 Alan Modra <amodra@gmail.com>
* aix.h (FP_SAVE_INLINE, GP_SAVE_INLINE): Delete.
* darwin.h (FP_SAVE_INLINE, GP_SAVE_INLINE): Delete.
* sysv4.h (FP_SAVE_INLINE, GP_SAVE_INLINE, V_SAVE_INLINE): Delete.
* config/rs6000/rs6000.c (V_SAVE_INLINE): Delete.
(rs6000_savres_strategy): Reimplement GP/FP/V_SAVE_INLINE logic.
For ELF targets, use out-of-line restores for -Os and any number
of regs if the restore exits, and out-of-line gp save for two or
more regs. Use save_reg_p to test for holes in reg restore set.
Replace "#if" with "if".
2012-05-22 Alan Modra <amodra@gmail.com>
* config/rs6000/rs6000.c (save_reg_p): New function. * config/rs6000/rs6000.c (save_reg_p): New function.
(first_reg_to_save, first_fp_reg_to_save): Use it here. (first_reg_to_save, first_fp_reg_to_save): Use it here.
(first_altivec_reg_to_save, restore_saved_cr): Likewise. (first_altivec_reg_to_save, restore_saved_cr): Likewise.
......
/* Definitions of target machine for GNU compiler, /* Definitions of target machine for GNU compiler,
for IBM RS/6000 POWER running AIX. for IBM RS/6000 POWER running AIX.
Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010,
2011 Free Software Foundation, Inc. 2011, 2012 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -207,11 +207,6 @@ ...@@ -207,11 +207,6 @@
{ "link_syscalls", LINK_SYSCALLS_SPEC }, \ { "link_syscalls", LINK_SYSCALLS_SPEC }, \
{ "link_libg", LINK_LIBG_SPEC } { "link_libg", LINK_LIBG_SPEC }
/* Define cutoff for using external functions to save floating point. */
#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63)
/* And similarly for general purpose registers. */
#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32)
#define PROFILE_HOOK(LABEL) output_profile_hook (LABEL) #define PROFILE_HOOK(LABEL) output_profile_hook (LABEL)
/* No version of AIX fully supports AltiVec or 64-bit instructions in /* No version of AIX fully supports AltiVec or 64-bit instructions in
......
/* Target definitions for PowerPC running Darwin (Mac OS X). /* Target definitions for PowerPC running Darwin (Mac OS X).
Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2010, Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2010,
2011 Free Software Foundation, Inc. 2011, 2012 Free Software Foundation, Inc.
Contributed by Apple Computer Inc. Contributed by Apple Computer Inc.
This file is part of GCC. This file is part of GCC.
...@@ -173,16 +173,6 @@ extern int darwin_emit_branch_islands; ...@@ -173,16 +173,6 @@ extern int darwin_emit_branch_islands;
(RS6000_ALIGN (crtl->outgoing_args_size, 16) \ (RS6000_ALIGN (crtl->outgoing_args_size, 16) \
+ (STACK_POINTER_OFFSET)) + (STACK_POINTER_OFFSET))
/* Define cutoff for using out-of-line functions to save registers.
Currently on Darwin, we implement FP and GPR out-of-line-saves plus the
special routine for 'save everything'. */
#undef FP_SAVE_INLINE
#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) > 60 && (FIRST_REG) < 64)
#undef GP_SAVE_INLINE
#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) > 29 && (FIRST_REG) < 32)
/* Darwin uses a function call if everything needs to be saved/restored. */ /* Darwin uses a function call if everything needs to be saved/restored. */
#undef WORLD_SAVE_P #undef WORLD_SAVE_P
......
...@@ -17237,10 +17237,6 @@ enum { ...@@ -17237,10 +17237,6 @@ enum {
REST_INLINE_VRS = 0x200 REST_INLINE_VRS = 0x200
}; };
#ifndef V_SAVE_INLINE
#define V_SAVE_INLINE(FIRST_REG) 1
#endif
static int static int
rs6000_savres_strategy (rs6000_stack_t *info, rs6000_savres_strategy (rs6000_stack_t *info,
bool using_static_chain_p) bool using_static_chain_p)
...@@ -17262,7 +17258,6 @@ rs6000_savres_strategy (rs6000_stack_t *info, ...@@ -17262,7 +17258,6 @@ rs6000_savres_strategy (rs6000_stack_t *info,
| SAVE_INLINE_VRS | REST_INLINE_VRS); | SAVE_INLINE_VRS | REST_INLINE_VRS);
if (info->first_fp_reg_save == 64 if (info->first_fp_reg_save == 64
|| FP_SAVE_INLINE (info->first_fp_reg_save)
/* The out-of-line FP routines use double-precision stores; /* The out-of-line FP routines use double-precision stores;
we can't use those routines if we don't have such stores. */ we can't use those routines if we don't have such stores. */
|| (TARGET_HARD_FLOAT && !TARGET_DOUBLE_FLOAT) || (TARGET_HARD_FLOAT && !TARGET_DOUBLE_FLOAT)
...@@ -17270,26 +17265,80 @@ rs6000_savres_strategy (rs6000_stack_t *info, ...@@ -17270,26 +17265,80 @@ rs6000_savres_strategy (rs6000_stack_t *info,
strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS; strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
if (info->first_gp_reg_save == 32 if (info->first_gp_reg_save == 32
|| GP_SAVE_INLINE (info->first_gp_reg_save)
|| (!(strategy & SAVRES_MULTIPLE) || (!(strategy & SAVRES_MULTIPLE)
&& global_regs_p (info->first_gp_reg_save, 32))) && global_regs_p (info->first_gp_reg_save, 32)))
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS; strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
if (info->first_altivec_reg_save == LAST_ALTIVEC_REGNO + 1 if (info->first_altivec_reg_save == LAST_ALTIVEC_REGNO + 1
|| V_SAVE_INLINE (info->first_altivec_reg_save)
|| global_regs_p (info->first_altivec_reg_save, LAST_ALTIVEC_REGNO + 1)) || global_regs_p (info->first_altivec_reg_save, LAST_ALTIVEC_REGNO + 1))
strategy |= SAVE_INLINE_VRS | REST_INLINE_VRS; strategy |= SAVE_INLINE_VRS | REST_INLINE_VRS;
/* Define cutoff for using out-of-line functions to save registers. */
if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
{
if (!optimize_size)
{
strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
strategy |= SAVE_INLINE_VRS | REST_INLINE_VRS;
}
else
{
/* Prefer out-of-line restore if it will exit. */
if (info->first_fp_reg_save > 61)
strategy |= SAVE_INLINE_FPRS;
if (info->first_gp_reg_save > 29)
{
if (info->first_fp_reg_save == 64)
strategy |= SAVE_INLINE_GPRS;
else
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
}
if (info->first_altivec_reg_save == LAST_ALTIVEC_REGNO)
strategy |= SAVE_INLINE_VRS | REST_INLINE_VRS;
}
}
else if (DEFAULT_ABI == ABI_DARWIN)
{
if (info->first_fp_reg_save > 60)
strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
if (info->first_gp_reg_save > 29)
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
strategy |= SAVE_INLINE_VRS | REST_INLINE_VRS;
}
else
{
gcc_checking_assert (DEFAULT_ABI == ABI_AIX);
if (info->first_fp_reg_save > 61)
strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
strategy |= SAVE_INLINE_VRS | REST_INLINE_VRS;
}
/* Don't bother to try to save things out-of-line if r11 is occupied /* Don't bother to try to save things out-of-line if r11 is occupied
by the static chain. It would require too much fiddling and the by the static chain. It would require too much fiddling and the
static chain is rarely used anyway. FPRs are saved w.r.t the stack static chain is rarely used anyway. FPRs are saved w.r.t the stack
pointer on Darwin, and AIX uses r1 or r12. */ pointer on Darwin, and AIX uses r1 or r12. */
if (using_static_chain_p && DEFAULT_ABI != ABI_AIX) if (using_static_chain_p && DEFAULT_ABI != ABI_AIX)
strategy |= ((DEFAULT_ABI == ABI_DARWIN strategy |= ((DEFAULT_ABI == ABI_DARWIN ? 0 : SAVE_INLINE_FPRS)
? 0 : SAVE_INLINE_FPRS | REST_INLINE_FPRS)
| SAVE_INLINE_GPRS | SAVE_INLINE_GPRS
| SAVE_INLINE_VRS | REST_INLINE_VRS); | SAVE_INLINE_VRS | REST_INLINE_VRS);
/* We can only use the out-of-line routines to restore if we've
saved all the registers from first_fp_reg_save in the prologue.
Otherwise, we risk loading garbage. */
if ((strategy & (SAVE_INLINE_FPRS | REST_INLINE_FPRS)) == SAVE_INLINE_FPRS)
{
int i;
for (i = info->first_fp_reg_save; i < 64; i++)
if (!save_reg_p (i))
{
strategy |= REST_INLINE_FPRS;
break;
}
}
/* If we are going to use store multiple, then don't even bother /* If we are going to use store multiple, then don't even bother
with the out-of-line routines, since the store-multiple with the out-of-line routines, since the store-multiple
instruction will always be smaller. */ instruction will always be smaller. */
...@@ -17319,13 +17368,6 @@ rs6000_savres_strategy (rs6000_stack_t *info, ...@@ -17319,13 +17368,6 @@ rs6000_savres_strategy (rs6000_stack_t *info,
|| info->first_fp_reg_save != 64)) || info->first_fp_reg_save != 64))
strategy |= REST_INLINE_GPRS; strategy |= REST_INLINE_GPRS;
/* We can only use load multiple or the out-of-line routines to
restore if we've used store multiple or out-of-line routines
in the prologue, i.e. if we've saved all the registers from
first_gp_reg_save. Otherwise, we risk loading garbage. */
if ((strategy & (SAVE_INLINE_GPRS | SAVRES_MULTIPLE)) == SAVE_INLINE_GPRS)
strategy |= REST_INLINE_GPRS;
/* Saving CR interferes with the exit routines used on the SPE, so /* Saving CR interferes with the exit routines used on the SPE, so
just punt here. */ just punt here. */
if (TARGET_SPE_ABI if (TARGET_SPE_ABI
...@@ -17333,8 +17375,24 @@ rs6000_savres_strategy (rs6000_stack_t *info, ...@@ -17333,8 +17375,24 @@ rs6000_savres_strategy (rs6000_stack_t *info,
&& info->cr_save_p) && info->cr_save_p)
strategy |= REST_INLINE_GPRS; strategy |= REST_INLINE_GPRS;
#if defined (POWERPC_LINUX) || defined (POWERPC_FREEBSD) /* We can only use load multiple or the out-of-line routines to
if (TARGET_64BIT) restore if we've used store multiple or out-of-line routines
in the prologue, i.e. if we've saved all the registers from
first_gp_reg_save. Otherwise, we risk loading garbage. */
if ((strategy & (SAVE_INLINE_GPRS | REST_INLINE_GPRS | SAVRES_MULTIPLE))
== SAVE_INLINE_GPRS)
{
int i;
for (i = info->first_gp_reg_save; i < 32; i++)
if (!save_reg_p (i))
{
strategy |= REST_INLINE_GPRS;
break;
}
}
if (TARGET_ELF && TARGET_64BIT)
{ {
if (!(strategy & SAVE_INLINE_FPRS)) if (!(strategy & SAVE_INLINE_FPRS))
strategy |= SAVE_NOINLINE_FPRS_SAVES_LR; strategy |= SAVE_NOINLINE_FPRS_SAVES_LR;
...@@ -17342,10 +17400,9 @@ rs6000_savres_strategy (rs6000_stack_t *info, ...@@ -17342,10 +17400,9 @@ rs6000_savres_strategy (rs6000_stack_t *info,
&& info->first_fp_reg_save == 64) && info->first_fp_reg_save == 64)
strategy |= SAVE_NOINLINE_GPRS_SAVES_LR; strategy |= SAVE_NOINLINE_GPRS_SAVES_LR;
} }
#else else if (TARGET_AIX && !(strategy & REST_INLINE_FPRS))
if (TARGET_AIX && !(strategy & REST_INLINE_FPRS))
strategy |= REST_NOINLINE_FPRS_DOESNT_RESTORE_LR; strategy |= REST_NOINLINE_FPRS_DOESNT_RESTORE_LR;
#endif
if (TARGET_MACHO && !(strategy & SAVE_INLINE_FPRS)) if (TARGET_MACHO && !(strategy & SAVE_INLINE_FPRS))
strategy |= SAVE_NOINLINE_FPRS_SAVES_LR; strategy |= SAVE_NOINLINE_FPRS_SAVES_LR;
......
/* Target definitions for GNU compiler for PowerPC running System V.4 /* Target definitions for GNU compiler for PowerPC running System V.4
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc. Free Software Foundation, Inc.
Contributed by Cygnus Support. Contributed by Cygnus Support.
...@@ -243,19 +243,6 @@ do { \ ...@@ -243,19 +243,6 @@ do { \
#define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN) #define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
#define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN) #define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
/* Define cutoff for using external functions to save floating point.
When optimizing for size, use external functions when profitable. */
#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 \
|| (FIRST_REG) == 63 \
|| !optimize_size)
/* And similarly for general purpose registers. */
#define GP_SAVE_INLINE(FIRST_REG) (!optimize_size)
/* And vector registers. */
#define V_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == LAST_ALTIVEC_REGNO \
|| !optimize_size)
/* Put jump tables in read-only memory, rather than in .text. */ /* Put jump tables in read-only memory, rather than in .text. */
#define JUMP_TABLES_IN_TEXT_SECTION 0 #define JUMP_TABLES_IN_TEXT_SECTION 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment