rs6000.c (emit_allocate_stack): Add copy_r11 parameter.

* config/rs6000/rs6000.c (emit_allocate_stack): Add copy_r11
	parameter.  Copy stack_reg to r11 where appropriate.
	(no_global_regs_above): Add gpr parameter.
	(rs6000_stack_info): Only add padding for SPE save area if we
	are saving SPE GPRs and CR.
	(saveres_routine_syms): New variable.
	(FIRST_SAVRES_REGISTER, LAST_SAVRES_REGISTER, N_SAVRES_REGISTERS):
	Define.
	(rs6000_savres_routine_sym): New function.
	(rs6000_emit_stack_reset, rs6000_restore_saved_cr): New functions,
	split out of...
	(rs6000_emit_epilogue): ...here.  Use rs6000_use_multiple_p and
	rs6000_savres_strategy.  Restore GPRs out-of-line if appropriate.
	Tweak FPR out-of-line saving.
	(rs6000_make_savres_rtx): New function.
	(rs6000_use_multiple_p): New function.
	(rs6000_savres_strategy): New function.
	(rs6000_emit_prologue): Use rs6000_savres_strategy.  Save GPRs
	out-of-line if appropriate.
	* config/rs6000/sysv4.h (FP_SAVE_INLINE): Save FPRs out-of-line
	if we are optimizing for size.
	(GP_SAVE_INLINE): Define.
	(SAVE_FP_SUFFIX, RESTORE_FP_SUFFIX): Only use _l on 64-bit targets.
	* config/rs6000/darwin.h (GP_SAVE_INLINE): Define.
	* config/rs6000/aix.h (GP_SAVE_INLINE): Define.
	* config/rs6000/rs6000.md (*save_gpregs_<mode>): New insn.
	(*save_fpregs_<mode>): Add use of r11.
	(*restore_gpregs_<mode>): New insn.
	(*return_and_restore_gpregs_<mode>): New insn.
	(*return_and_restore_fpregs_<mode>): Adjust to clobber LR and
	use r11.
	* config/rs6000/spe.md (*save_gpregs_spe): New insn.
	(*restore_gpregs_spe): New insn.
	(*return_and_restore_gpregs_spe): New insn.
	* config/rs6000/predicates.md (save_world_operation): Fix check.

From-SVN: r137160
This commit is contained in:
Nathan Froyd 2008-06-26 20:12:41 +00:00 committed by Nathan Froyd
parent e24c4814fd
commit f78c3290cd
9 changed files with 760 additions and 415 deletions

View file

@ -1,3 +1,41 @@
2008-06-26 Nathan Froyd <froydnj@codesourcery.com>
* config/rs6000/rs6000.c (emit_allocate_stack): Add copy_r11
parameter. Copy stack_reg to r11 where appropriate.
(no_global_regs_above): Add gpr parameter.
(rs6000_stack_info): Only add padding for SPE save area if we
are saving SPE GPRs and CR.
(saveres_routine_syms): New variable.
(FIRST_SAVRES_REGISTER, LAST_SAVRES_REGISTER, N_SAVRES_REGISTERS):
Define.
(rs6000_savres_routine_sym): New function.
(rs6000_emit_stack_reset, rs6000_restore_saved_cr): New functions,
split out of...
(rs6000_emit_epilogue): ...here. Use rs6000_use_multiple_p and
rs6000_savres_strategy. Restore GPRs out-of-line if appropriate.
Tweak FPR out-of-line saving.
(rs6000_make_savres_rtx): New function.
(rs6000_use_multiple_p): New function.
(rs6000_savres_strategy): New function.
(rs6000_emit_prologue): Use rs6000_savres_strategy. Save GPRs
out-of-line if appropriate.
* config/rs6000/sysv4.h (FP_SAVE_INLINE): Save FPRs out-of-line
if we are optimizing for size.
(GP_SAVE_INLINE): Define.
(SAVE_FP_SUFFIX, RESTORE_FP_SUFFIX): Only use _l on 64-bit targets.
* config/rs6000/darwin.h (GP_SAVE_INLINE): Define.
* config/rs6000/aix.h (GP_SAVE_INLINE): Define.
* config/rs6000/rs6000.md (*save_gpregs_<mode>): New insn.
(*save_fpregs_<mode>): Add use of r11.
(*restore_gpregs_<mode>): New insn.
(*return_and_restore_gpregs_<mode>): New insn.
(*return_and_restore_fpregs_<mode>): Adjust to clobber LR and
use r11.
* config/rs6000/spe.md (*save_gpregs_spe): New insn.
(*restore_gpregs_spe): New insn.
(*return_and_restore_gpregs_spe): New insn.
* config/rs6000/predicates.md (save_world_operation): Fix check.
2008-06-26 Steven Bosscher <steven@gcc.gnu.org>
* tree-into-ssa (insert_phi_nodes_for): 'var' must be a DECL at

View file

@ -201,6 +201,8 @@
/* 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)
/* __throw will restore its own return address to be the same as the
return address of the function that the throw is being made to.

View file

@ -191,6 +191,8 @@
#undef FP_SAVE_INLINE
#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
#undef GP_SAVE_INLINE
#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32)
/* Darwin uses a function call if everything needs to be saved/restored. */
#undef WORLD_SAVE_P

View file

@ -912,7 +912,7 @@
rtx elt;
int count = XVECLEN (op, 0);
if (count != 55)
if (count != 54)
return 0;
index = 0;
@ -961,9 +961,8 @@
|| GET_MODE (SET_SRC (elt)) != Pmode)
return 0;
if (GET_CODE (XVECEXP (op, 0, index++)) != USE
|| GET_CODE (XVECEXP (op, 0, index++)) != USE
|| GET_CODE (XVECEXP (op, 0, index++)) != CLOBBER)
if (GET_CODE (XVECEXP (op, 0, index++)) != SET
|| GET_CODE (XVECEXP (op, 0, index++)) != SET)
return 0;
return 1;
})

File diff suppressed because it is too large Load diff

View file

@ -14421,12 +14421,25 @@
"{stm|stmw} %2,%1"
[(set_attr "type" "store_ux")])
(define_insn "*save_gpregs_<mode>"
[(match_parallel 0 "any_parallel_operand"
[(clobber (reg:P 65))
(use (match_operand:P 1 "symbol_ref_operand" "s"))
(use (match_operand:P 2 "gpc_reg_operand" "r"))
(set (match_operand:P 3 "memory_operand" "=m")
(match_operand:P 4 "gpc_reg_operand" "r"))])]
""
"bl %z1"
[(set_attr "type" "branch")
(set_attr "length" "4")])
(define_insn "*save_fpregs_<mode>"
[(match_parallel 0 "any_parallel_operand"
[(clobber (reg:P 65))
(use (match_operand:P 1 "call_operand" "s"))
(set (match_operand:DF 2 "memory_operand" "=m")
(match_operand:DF 3 "gpc_reg_operand" "f"))])]
(use (match_operand:P 1 "symbol_ref_operand" "s"))
(use (match_operand:P 2 "gpc_reg_operand" "r"))
(set (match_operand:DF 3 "memory_operand" "=m")
(match_operand:DF 4 "gpc_reg_operand" "f"))])]
""
"bl %z1"
[(set_attr "type" "branch")
@ -14514,15 +14527,43 @@
; FIXME: This would probably be somewhat simpler if the Cygnus sibcall
; stuff was in GCC. Oh, and "any_parallel_operand" is a bit flexible...
(define_insn "*restore_gpregs_<mode>"
[(match_parallel 0 "any_parallel_operand"
[(clobber (match_operand:P 1 "register_operand" "=l"))
(use (match_operand:P 2 "symbol_ref_operand" "s"))
(use (match_operand:P 3 "gpc_reg_operand" "r"))
(set (match_operand:P 4 "gpc_reg_operand" "=r")
(match_operand:P 5 "memory_operand" "m"))])]
""
"bl %z2"
[(set_attr "type" "branch")
(set_attr "length" "4")])
(define_insn "*return_and_restore_gpregs_<mode>"
[(match_parallel 0 "any_parallel_operand"
[(return)
(clobber (match_operand:P 1 "register_operand" "=l"))
(use (match_operand:P 2 "symbol_ref_operand" "s"))
(use (match_operand:P 3 "gpc_reg_operand" "r"))
(set (match_operand:P 4 "gpc_reg_operand" "=r")
(match_operand:P 5 "memory_operand" "m"))])]
""
"b %z2"
[(set_attr "type" "branch")
(set_attr "length" "4")])
(define_insn "*return_and_restore_fpregs_<mode>"
[(match_parallel 0 "any_parallel_operand"
[(return)
(use (reg:P 65))
(use (match_operand:P 1 "call_operand" "s"))
(set (match_operand:DF 2 "gpc_reg_operand" "=f")
(match_operand:DF 3 "memory_operand" "m"))])]
(clobber (match_operand:P 1 "register_operand" "=l"))
(use (match_operand:P 2 "symbol_ref_operand" "s"))
(use (match_operand:P 3 "gpc_reg_operand" "r"))
(set (match_operand:DF 4 "gpc_reg_operand" "=f")
(match_operand:DF 5 "memory_operand" "m"))])]
""
"b %z1")
"b %z2"
[(set_attr "type" "branch")
(set_attr "length" "4")])
; This is used in compiling the unwind routines.
(define_expand "eh_return"

View file

@ -3138,3 +3138,41 @@
"TARGET_E500"
"cror 4*%0+gt,4*%1+gt,4*%2+gt"
[(set_attr "type" "cr_logical")])
;; Out-of-line prologues and epilogues.
(define_insn "*save_gpregs_spe"
[(match_parallel 0 "any_parallel_operand"
[(clobber (reg:P 65))
(use (match_operand:P 1 "symbol_ref_operand" "s"))
(use (match_operand:P 2 "gpc_reg_operand" "r"))
(set (match_operand:V2SI 3 "memory_operand" "=m")
(match_operand:V2SI 4 "gpc_reg_operand" "r"))])]
"TARGET_SPE_ABI"
"bl %z1"
[(set_attr "type" "branch")
(set_attr "length" "4")])
(define_insn "*restore_gpregs_spe"
[(match_parallel 0 "any_parallel_operand"
[(clobber (reg:P 65))
(use (match_operand:P 1 "symbol_ref_operand" "s"))
(use (match_operand:P 2 "gpc_reg_operand" "r"))
(set (match_operand:V2SI 3 "gpc_reg_operand" "=r")
(match_operand:V2SI 4 "memory_operand" "m"))])]
"TARGET_SPE_ABI"
"bl %z1"
[(set_attr "type" "branch")
(set_attr "length" "4")])
(define_insn "*return_and_restore_gpregs_spe"
[(match_parallel 0 "any_parallel_operand"
[(return)
(clobber (reg:P 65))
(use (match_operand:P 1 "symbol_ref_operand" "s"))
(use (match_operand:P 2 "gpc_reg_operand" "r"))
(set (match_operand:V2SI 3 "gpc_reg_operand" "=r")
(match_operand:V2SI 4 "memory_operand" "m"))])]
"TARGET_SPE_ABI"
"b %z1"
[(set_attr "type" "branch")
(set_attr "length" "4")])

View file

@ -266,19 +266,27 @@ do { \
#endif
/* Define cutoff for using external functions to save floating point.
Currently on V.4, always use inline stores. */
#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64)
Currently on 64-bit V.4, always use inline stores. When optimizing
for size on 32-bit targets, use external functions when
profitable. */
#define FP_SAVE_INLINE(FIRST_REG) (optimize_size && !TARGET_64BIT \
? ((FIRST_REG) == 62 \
|| (FIRST_REG) == 63) \
: (FIRST_REG) < 64)
/* And similarly for general purpose registers. */
#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32 \
&& (TARGET_64BIT || !optimize_size))
/* Put jump tables in read-only memory, rather than in .text. */
#define JUMP_TABLES_IN_TEXT_SECTION 0
/* Prefix and suffix to use to saving floating point. */
#define SAVE_FP_PREFIX "_savefpr_"
#define SAVE_FP_SUFFIX "_l"
#define SAVE_FP_SUFFIX (TARGET_64BIT ? "_l" : "")
/* Prefix and suffix to use to restoring floating point. */
#define RESTORE_FP_PREFIX "_restfpr_"
#define RESTORE_FP_SUFFIX "_l"
#define RESTORE_FP_SUFFIX (TARGET_64BIT ? "_l" : "")
/* Type used for ptrdiff_t, as a string used in a declaration. */
#define PTRDIFF_TYPE "int"

View file

@ -3,23 +3,7 @@
LIB2FUNCS_EXTRA += tramp.S $(srcdir)/config/rs6000/darwin-ldouble.c
# These can't end up in shared libgcc
LIB2FUNCS_STATIC_EXTRA = eabi.S \
crtsavfpr.S crtresfpr.S \
crtsavgpr.S crtresgpr.S \
crtresxfpr.S crtresxgpr.S \
e500crtres32gpr.S \
e500crtres64gpr.S \
e500crtres64gprctr.S \
e500crtrest32gpr.S \
e500crtrest64gpr.S \
e500crtresx32gpr.S \
e500crtresx64gpr.S \
e500crtsav32gpr.S \
e500crtsav64gpr.S \
e500crtsav64gprctr.S \
e500crtsavg32gpr.S \
e500crtsavg64gpr.S \
e500crtsavg64gprctr.S
LIB2FUNCS_STATIC_EXTRA = eabi.S
eabi.S: $(srcdir)/config/rs6000/eabi.asm
cat $(srcdir)/config/rs6000/eabi.asm > eabi.S
@ -52,63 +36,6 @@ ncrti.S: $(srcdir)/config/rs6000/sol-ci.asm
ncrtn.S: $(srcdir)/config/rs6000/sol-cn.asm
cat $(srcdir)/config/rs6000/sol-cn.asm >ncrtn.S
crtsavfpr.S: $(srcdir)/config/rs6000/crtsavfpr.asm
cat $(srcdir)/config/rs6000/crtsavfpr.asm >crtsavfpr.S
crtresfpr.S: $(srcdir)/config/rs6000/crtresfpr.asm
cat $(srcdir)/config/rs6000/crtresfpr.asm >crtresfpr.S
crtsavgpr.S: $(srcdir)/config/rs6000/crtsavgpr.asm
cat $(srcdir)/config/rs6000/crtsavgpr.asm >crtsavgpr.S
crtresgpr.S: $(srcdir)/config/rs6000/crtresgpr.asm
cat $(srcdir)/config/rs6000/crtresgpr.asm >crtresgpr.S
crtresxfpr.S: $(srcdir)/config/rs6000/crtresxfpr.asm
cat $(srcdir)/config/rs6000/crtresxfpr.asm >crtresxfpr.S
crtresxgpr.S: $(srcdir)/config/rs6000/crtresxgpr.asm
cat $(srcdir)/config/rs6000/crtresxgpr.asm >crtresxgpr.S
e500crtres32gpr.S: $(srcdir)/config/rs6000/e500crtres32gpr.asm
cat $(srcdir)/config/rs6000/e500crtres32gpr.asm >e500crtres32gpr.S
e500crtres64gpr.S: $(srcdir)/config/rs6000/e500crtres64gpr.asm
cat $(srcdir)/config/rs6000/e500crtres64gpr.asm >e500crtres64gpr.S
e500crtres64gprctr.S: $(srcdir)/config/rs6000/e500crtres64gprctr.asm
cat $(srcdir)/config/rs6000/e500crtres64gprctr.asm >e500crtres64gprctr.S
e500crtrest32gpr.S: $(srcdir)/config/rs6000/e500crtrest32gpr.asm
cat $(srcdir)/config/rs6000/e500crtrest32gpr.asm >e500crtrest32gpr.S
e500crtrest64gpr.S: $(srcdir)/config/rs6000/e500crtrest64gpr.asm
cat $(srcdir)/config/rs6000/e500crtrest64gpr.asm >e500crtrest64gpr.S
e500crtresx32gpr.S: $(srcdir)/config/rs6000/e500crtresx32gpr.asm
cat $(srcdir)/config/rs6000/e500crtresx32gpr.asm >e500crtresx32gpr.S
e500crtresx64gpr.S: $(srcdir)/config/rs6000/e500crtresx64gpr.asm
cat $(srcdir)/config/rs6000/e500crtresx64gpr.asm >e500crtresx64gpr.S
e500crtsav32gpr.S: $(srcdir)/config/rs6000/e500crtsav32gpr.asm
cat $(srcdir)/config/rs6000/e500crtsav32gpr.asm >e500crtsav32gpr.S
e500crtsav64gpr.S: $(srcdir)/config/rs6000/e500crtsav64gpr.asm
cat $(srcdir)/config/rs6000/e500crtsav64gpr.asm >e500crtsav64gpr.S
e500crtsav64gprctr.S: $(srcdir)/config/rs6000/e500crtsav64gprctr.asm
cat $(srcdir)/config/rs6000/e500crtsav64gprctr.asm >e500crtsav64gprctr.S
e500crtsavg32gpr.S: $(srcdir)/config/rs6000/e500crtsavg32gpr.asm
cat $(srcdir)/config/rs6000/e500crtsavg32gpr.asm >e500crtsavg32gpr.S
e500crtsavg64gpr.S: $(srcdir)/config/rs6000/e500crtsavg64gpr.asm
cat $(srcdir)/config/rs6000/e500crtsavg64gpr.asm >e500crtsavg64gpr.S
e500crtsavg64gprctr.S: $(srcdir)/config/rs6000/e500crtsavg64gprctr.asm
cat $(srcdir)/config/rs6000/e500crtsavg64gprctr.asm >e500crtsavg64gprctr.S
# Build multiple copies of ?crt{i,n}.o, one for each target switch.
$(T)ecrti$(objext): ecrti.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c ecrti.S -o $(T)ecrti$(objext)
@ -122,63 +49,6 @@ $(T)ncrti$(objext): ncrti.S
$(T)ncrtn$(objext): ncrtn.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c ncrtn.S -o $(T)ncrtn$(objext)
$(T)crtsavfpr$(objext): crtsavfpr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtsavfpr.S -o $(T)crtsavfpr$(objext)
$(T)crtresfpr$(objext): crtresfpr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresfpr.S -o $(T)crtresfpr$(objext)
$(T)crtsavgpr$(objext): crtsavgpr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtsavgpr.S -o $(T)crtsavgpr$(objext)
$(T)crtresgpr$(objext): crtresgpr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresgpr.S -o $(T)crtresgpr$(objext)
$(T)crtresxfpr$(objext): crtresxfpr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresxfpr.S -o $(T)crtresxfpr$(objext)
$(T)crtresxgpr$(objext): crtresxgpr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtresxgpr.S -o $(T)crtresxgpr$(objext)
$(T)e500crtres32gpr$(objext): e500crtres32gpr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtres32gpr.S -o $(T)e500crtres32gpr$(objext)
$(T)e500crtres64gpr$(objext): e500crtres64gpr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtres64gpr.S -o $(T)e500crtres64gpr$(objext)
$(T)e500crtres64gprctr$(objext): e500crtres64gprctr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtres64gprctr.S -o $(T)e500crtres64gprctr$(objext)
$(T)e500crtrest32gpr$(objext): e500crtrest32gpr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtrest32gpr.S -o $(T)e500crtrest32gpr$(objext)
$(T)e500crtrest64gpr$(objext): e500crtrest64gpr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtrest64gpr.S -o $(T)e500crtrest64gpr$(objext)
$(T)e500crtresx32gpr$(objext): e500crtresx32gpr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtresx32gpr.S -o $(T)e500crtresx32gpr$(objext)
$(T)e500crtresx64gpr$(objext): e500crtresx64gpr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtresx64gpr.S -o $(T)e500crtresx64gpr$(objext)
$(T)e500crtsav32gpr$(objext): e500crtsav32gpr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsav32gpr.S -o $(T)e500crtsav32gpr$(objext)
$(T)e500crtsav64gpr$(objext): e500crtsav64gpr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsav64gpr.S -o $(T)e500crtsav64gpr$(objext)
$(T)e500crtsav64gprctr$(objext): e500crtsav64gprctr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsav64gprctr.S -o $(T)e500crtsav64gprctr$(objext)
$(T)e500crtsavg32gpr$(objext): e500crtsavg32gpr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsavg32gpr.S -o $(T)e500crtsavg32gpr$(objext)
$(T)e500crtsavg64gpr$(objext): e500crtsavg64gpr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsavg64gpr.S -o $(T)e500crtsavg64gpr$(objext)
$(T)e500crtsavg64gprctr$(objext): e500crtsavg64gprctr.S
$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c e500crtsavg64gprctr.S -o $(T)e500crtsavg64gprctr$(objext)
# It is important that crtbegin.o, etc., aren't surprised by stuff in .sdata.
CRTSTUFF_T_CFLAGS = -msdata=none
# Make sure crt*.o are built with -fPIC even if configured with