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]

Re: [RFC] RTL prologue/epilogue for SPARC


> 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


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