This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Another sibcall fix
- To: egcs-patches at egcs dot cygnus dot com, rth at cygnus dot com
- Subject: Another sibcall fix
- From: Jan Hubicka <hubicka at atrey dot karlin dot mff dot cuni dot cz>
- Date: Sat, 25 Mar 2000 23:29:37 +0100
Hi
When sibcall sequence contains nested call, the sibcall is never done
due to failure in identify_call.
While looking for it I found anouther bug causing tail calls never to be
detected in -mno-defer-pop compilation.
Honza
Sat Mar 25 23:18:56 CET 2000 Jan Hubicka <jh@suse.cz>
* sibcall.c (indentify_call_return_value): Find last call in the chain;
Allow stack adjustment after function call.
*** sibcall.c.old Sat Mar 25 22:58:20 2000
--- sibcall.c Sat Mar 25 22:58:24 2000
*************** identify_call_return_value (cp, p_hard_r
*** 53,62 ****
{
rtx insn, set, hard, soft;
- /* Search forward through the "normal" call sequence to the CALL insn. */
insn = XEXP (cp, 0);
! while (GET_CODE (insn) != CALL_INSN)
insn = NEXT_INSN (insn);
/* Assume the pattern is (set (dest) (call ...)), or that the first
member of a parallel is. This is the hard return register used
--- 53,64 ----
{
rtx insn, set, hard, soft;
insn = XEXP (cp, 0);
! /* Search backward through the "normal" call sequence to the CALL insn. */
! while (NEXT_INSN (insn))
insn = NEXT_INSN (insn);
+ while (GET_CODE (insn) != CALL_INSN)
+ insn = PREV_INSN (insn);
/* Assume the pattern is (set (dest) (call ...)), or that the first
member of a parallel is. This is the hard return register used
*************** identify_call_return_value (cp, p_hard_r
*** 75,80 ****
--- 77,87 ----
if (GET_CODE (hard) != REG)
return 0;
+ /* Stack adjustment done after call may appear here. */
+ insn = skip_stack_adjustment (insn);
+ if (! insn)
+ return 0;
+
/* If there's nothing after, there's no soft return value. */
insn = NEXT_INSN (insn);
if (! insn)