This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] RTL prologue/epilogue for SPARC
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: Joern Rennecke <joern dot rennecke at superh dot com>
- Cc: davem at redhat dot com (David S. Miller),gcc-patches at gcc dot gnu dot org
- Date: Mon, 21 Jun 2004 17:11:58 +0200
- Subject: Re: [RFC] RTL prologue/epilogue for SPARC
- References: <200406211419.i5LEJ2v23114@chloe.uk.w2k.superh.com>
> It avoids tearing random basic blocks apart before reload in
> fixup_fallthru_exit_predecessor, because that can separate a call
> from the insn that copies the return value (that is in a separate
> basic block if the call is not pure and exception handling is enabled).
>
> Instead, before the epilogue is emitted, a fall-through edge to the exit
> block pointer is considered to be a placeholder for the epilogue itself.
> Therefore, one such edge can appear anywhere in the code where there is
> no other fall-through edge.
>
> When the time comes to emit the epilogue, and we find that we can't
> emit an epilogue after all, we fix up such an edge so that the
> fall through to the exit block is indeed at the end of the function.
Ok, thanks for the explanation. My problem comes from emitting the
prologue/epilogue later than usual (because of the register window).
The following change solves it:
Index: cfglayout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfglayout.c,v
retrieving revision 1.62
diff -u -p -r1.62 cfglayout.c
--- cfglayout.c 16 Jun 2004 16:49:22 -0000 1.62
+++ cfglayout.c 21 Jun 2004 15:09:03 -0000
@@ -1208,7 +1208,7 @@ cfg_layout_finalize (void)
rtl_register_cfg_hooks ();
if (reload_completed
#ifdef HAVE_epilogue
- && !HAVE_epilogue
+ && (!HAVE_epilogue || !epilogue_completed)
#endif
)
fixup_fallthru_exit_predecessor ();
Does it look correct to you?
> Incidentally, your sparc patch violates the requirement that the
> "epilogue" pattern should emit the return instruction.
I think you misread:
! (define_expand "epilogue"
! [(return)]
! ""
! {
! sparc_expand_epilogue ();
! })
--
Eric Botcazou