This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH,rs6000] add support for generating out-of-line register saves/restores


[Jack, Stan, Dominique, I have a favor to ask of one of you, please read
on for details]

The psABI for PowerPC specifies several procedures for out-of-line
register saves and restores, which reduce code size by factoring out
common bits of prologues and epilogues.  This patch adds support to GCC
for generating calls to such functions for 32-bit targets.  (The 64-bit
psABI specifies the procedures a little differently and optimizing code
size seems like less of a concern on 64-bit machines as well.  If
desired by the maintainers, adding the necessary support is
straightforward and quite a bit easier due to niceties in the 64-bit
psABI.)

For E500 targets, this patch is dependent upon my previous "split up
crtsavres into individual files" patch:

http://gcc.gnu.org/ml/gcc-patches/2008-03/msg01294.html

as that patch adds the necessary out-of-line functions for E500 targets.

Bootstrapped and regtested on powerpc-none-linux-gnuspe with no
regressions.  I plan to start regtesting on powerpc64-unknown-linux-gnu
to ensure that I haven't botched anything.  If somebody would be so kind
to do test cycles on AIX and Darwin with this patch to ensure that
nothing goes awry there, that'd be great.  David, could you take care of
the AIX run?  And one of Jack, Stan, or Dominique, could you do the run
on Darwin, with a followup message to indicate that you have the ball on
that?  (I think all of you have access to PPC Darwin machines; if you
don't, my apologies for including you in the email.)

OK to commit, assuming tests pass on the necessary platforms?

-Nathan

2008-04-22  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.

Attachment: ool-logues.patch.gz
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]