This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
always use pseudo return regs
- To: gcc-patches at gcc dot gnu dot org
- Subject: always use pseudo return regs
- From: Richard Henderson <rth at redhat dot com>
- Date: Wed, 23 May 2001 00:08:58 -0700
I've had this floating about one of my trees for a while...
Since
2000-12-01 Bernd Schmidt <bernds@redhat.co.uk>
* combine.c (cant_combine_insn_p): Only disallow insns involving
hard regs if they are reg-reg moves.
(try_combine, can_combine_p, combinable_i3pat): Delete old
SMALL_REGISTER_CLASSES tests.
we've had a harder time optimizing return values, since
we were using hard registers that we refused to combine.
I'd had a test case, that I've since misplaced, where we
failed to generate cmove instructions in relatively trivial
cases. I couldn't reproduce them this evening while trying
to show an optimization regression from 2.95. Oh well.
Applied to mainline only.
r~
* function.c (expand_function_start): Always use a pseudo
for the function result value.
Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.270
diff -c -p -d -r1.270 function.c
*** function.c 2001/05/18 07:25:50 1.270
--- function.c 2001/05/23 07:00:21
*************** expand_function_start (subr, parms_have_
*** 6366,6378 ****
else if (DECL_MODE (DECL_RESULT (subr)) == VOIDmode)
/* If return mode is void, this decl rtl should not be used. */
SET_DECL_RTL (DECL_RESULT (subr), NULL_RTX);
! else if (parms_have_cleanups
! || current_function_instrument_entry_exit
! || (flag_exceptions && USING_SJLJ_EXCEPTIONS))
{
! /* If function will end with cleanup code for parms, compute the
! return values into a pseudo reg, which we will copy into the
! true return register after the cleanups are done. */
/* In order to figure out what mode to use for the pseudo, we
figure out what the mode of the eventual return register will
--- 6366,6375 ----
else if (DECL_MODE (DECL_RESULT (subr)) == VOIDmode)
/* If return mode is void, this decl rtl should not be used. */
SET_DECL_RTL (DECL_RESULT (subr), NULL_RTX);
! else
{
! /* Compute the return values into a pseudo reg, which we will copy
! into the true return register after the cleanups are done. */
/* In order to figure out what mode to use for the pseudo, we
figure out what the mode of the eventual return register will
*************** expand_function_start (subr, parms_have_
*** 6392,6413 ****
/* Needed because we may need to move this to memory
in case it's a named return value whose address is taken. */
DECL_REGISTER (DECL_RESULT (subr)) = 1;
- }
- else
- {
- /* Scalar, returned in a register. */
- SET_DECL_RTL (DECL_RESULT (subr),
- hard_function_value (TREE_TYPE (DECL_RESULT (subr)),
- subr, 1));
-
- /* Mark this reg as the function's return value. */
- if (GET_CODE (DECL_RTL (DECL_RESULT (subr))) == REG)
- {
- REG_FUNCTION_VALUE_P (DECL_RTL (DECL_RESULT (subr))) = 1;
- /* Needed because we may need to move this to memory
- in case it's a named return value whose address is taken. */
- DECL_REGISTER (DECL_RESULT (subr)) = 1;
- }
}
/* Initialize rtx for parameters and local variables.
--- 6389,6394 ----