This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Minor tweak to SPARC back-end
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 4 Jul 2004 23:39:35 +0200
- Subject: Minor tweak to SPARC back-end
The patch renames SIBCALL_SLOT_EMPTY_P into LEAF_SIBCALL_SLOT_RESERVED_P
(modulo a negation) and tweaks output_restore to let it accept a PATTERN
instead of the whole INSN.
Bootstrapped/regtested on sparc64-sun-solaris2.9 and sparc-sun-solaris2.8.
I also verified that there is no change in the gcc.c-torture/compile
testsuite at -O2.
Applied to mainline.
2004-07-04 Eric Botcazou <ebotcazou@libertysurf.fr>
* config/sparc/sparc.c (SIBCALL_SLOT_EMPTY_P): Rename
into LEAF_SIBCALL_SLOT_RESERVED_P after negation.
(eligible_for_sibcall_delay): Adjust use of SIBCALL_SLOT_EMPTY_P.
(output_restore): Change parameter from 'insn' to 'pat'.
(output_return): Adjust call to output_restore.
(output_sibcall): Adjust use of SIBCALL_SLOT_EMPTY_P.
Adjust call to output_restore.
--
Eric Botcazou
Index: config/sparc/sparc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.c,v
retrieving revision 1.307
diff -c -p -r1.307 sparc.c
*** config/sparc/sparc.c 30 Jun 2004 21:45:28 -0000 1.307
--- config/sparc/sparc.c 3 Jul 2004 07:21:00 -0000
*************** Boston, MA 02111-1307, USA. */
*** 54,63 ****
"or %o7,%g0,X; call Y; or X,%g0,%o7" always, so that it can be optimized.
With sethi/jmp, neither 'as' nor 'ld' has an easy way how to find out if
somebody does not branch between the sethi and jmp. */
! #define SIBCALL_SLOT_EMPTY_P 0
#else
! #define SIBCALL_SLOT_EMPTY_P \
! ((TARGET_ARCH32 || TARGET_CM_MEDLOW) && ! flag_pic)
#endif
/* Global variables for machine-dependent things. */
--- 54,63 ----
"or %o7,%g0,X; call Y; or X,%g0,%o7" always, so that it can be optimized.
With sethi/jmp, neither 'as' nor 'ld' has an easy way how to find out if
somebody does not branch between the sethi and jmp. */
! #define LEAF_SIBCALL_SLOT_RESERVED_P 1
#else
! #define LEAF_SIBCALL_SLOT_RESERVED_P \
! ((TARGET_ARCH64 && !TARGET_CM_MEDLOW) || flag_pic)
#endif
/* Global variables for machine-dependent things. */
*************** eligible_for_sibcall_delay (rtx trial)
*** 2946,2952 ****
{
/* If the tail call is done using the call instruction,
we have to restore %o7 in the delay slot. */
! if (! SIBCALL_SLOT_EMPTY_P)
return 0;
/* %g1 is used to build the function address */
--- 2946,2952 ----
{
/* If the tail call is done using the call instruction,
we have to restore %o7 in the delay slot. */
! if (LEAF_SIBCALL_SLOT_RESERVED_P)
return 0;
/* %g1 is used to build the function address */
*************** sparc_asm_function_epilogue (FILE *file,
*** 4355,4371 ****
/* Output a 'restore' instruction. */
static void
! output_restore (rtx insn)
{
! rtx operands[3], pat;
! if (! insn)
{
fputs ("\t restore\n", asm_out_file);
return;
}
- pat = PATTERN (insn);
if (GET_CODE (pat) != SET)
abort ();
--- 4355,4370 ----
/* Output a 'restore' instruction. */
static void
! output_restore (rtx pat)
{
! rtx operands[3];
! if (! pat)
{
fputs ("\t restore\n", asm_out_file);
return;
}
if (GET_CODE (pat) != SET)
abort ();
*************** output_return (rtx insn)
*** 4483,4489 ****
{
fprintf (asm_out_file, "\tjmp\t%%i7+%d\n",
sparc_skip_caller_unimp ? 12 : 8);
! output_restore (delay);
}
PATTERN (delay) = gen_blockage ();
--- 4482,4488 ----
{
fprintf (asm_out_file, "\tjmp\t%%i7+%d\n",
sparc_skip_caller_unimp ? 12 : 8);
! output_restore (pat);
}
PATTERN (delay) = gen_blockage ();
*************** output_sibcall (rtx insn, rtx call_opera
*** 4521,4527 ****
register window. We simply output the jump to the function and
the insn in the delay slot (if any). */
! if (! SIBCALL_SLOT_EMPTY_P && delay_slot_filled_p)
abort();
if (delay_slot_filled_p)
--- 4520,4526 ----
register window. We simply output the jump to the function and
the insn in the delay slot (if any). */
! if (LEAF_SIBCALL_SLOT_RESERVED_P && delay_slot_filled_p)
abort();
if (delay_slot_filled_p)
*************** output_sibcall (rtx insn, rtx call_opera
*** 4560,4572 ****
if (! delay)
abort ();
! output_restore (delay);
PATTERN (delay) = gen_blockage ();
INSN_CODE (delay) = -1;
}
else
! output_restore (0);
}
return "";
--- 4559,4571 ----
if (! delay)
abort ();
! output_restore (PATTERN (delay));
PATTERN (delay) = gen_blockage ();
INSN_CODE (delay) = -1;
}
else
! output_restore (NULL_RTX);
}
return "";