This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fix splitting calls
- To: gcc-patches at gcc dot gnu dot org
- Subject: fix splitting calls
- From: Richard Henderson <rth at twiddle dot net>
- Date: Wed, 19 Sep 2001 11:30:03 -0700
The verify cfg routines croak if NORETURN is not copied to the
call after the split. While I was at it, I copied the rest.
r~
* emit-rtl.c (try_split): Copy NORETURN, SETJMP, ALWAYS_RETURN
and NON_LOCAL_GOTO notes.
Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.203
diff -c -p -d -r1.203 emit-rtl.c
*** emit-rtl.c 2001/09/16 20:21:23 1.203
--- emit-rtl.c 2001/09/19 18:26:14
*************** try_split (pat, trial, last)
*** 2513,2519 ****
if (GET_CODE (seq) == SEQUENCE)
{
int i, njumps = 0;
- rtx eh_note;
/* Avoid infinite loop if any insn of the result matches
the original pattern. */
--- 2513,2518 ----
*************** try_split (pat, trial, last)
*** 2546,2551 ****
--- 2545,2551 ----
REG_NOTES (insn));
}
}
+
/* If we are splitting a CALL_INSN, look for the CALL_INSN
in SEQ and copy our CALL_INSN_FUNCTION_USAGE to it. */
if (GET_CODE (trial) == CALL_INSN)
*************** try_split (pat, trial, last)
*** 2554,2571 ****
CALL_INSN_FUNCTION_USAGE (XVECEXP (seq, 0, i))
= CALL_INSN_FUNCTION_USAGE (trial);
! /* Copy EH notes. */
! if ((eh_note = find_reg_note (trial, REG_EH_REGION, NULL_RTX)))
! for (i = 0; i < XVECLEN (seq, 0); i++)
! {
! rtx insn = XVECEXP (seq, 0, i);
! if (GET_CODE (insn) == CALL_INSN
! || (flag_non_call_exceptions
! && may_trap_p (PATTERN (insn))))
! REG_NOTES (insn)
! = gen_rtx_EXPR_LIST (REG_EH_REGION, XEXP (eh_note, 0),
! REG_NOTES (insn));
! }
/* If there are LABELS inside the split insns increment the
usage count so we don't delete the label. */
--- 2554,2608 ----
CALL_INSN_FUNCTION_USAGE (XVECEXP (seq, 0, i))
= CALL_INSN_FUNCTION_USAGE (trial);
! /* Copy notes, particularly those related to the CFG. */
! for (note = REG_NOTES (trial); note ; note = XEXP (note, 1))
! {
! switch (REG_NOTE_KIND (note))
! {
! case REG_EH_REGION:
! for (i = XVECLEN (seq, 0) - 1; i >= 0; i--)
! {
! rtx insn = XVECEXP (seq, 0, i);
! if (GET_CODE (insn) == CALL_INSN
! || (flag_non_call_exceptions
! && may_trap_p (PATTERN (insn))))
! REG_NOTES (insn)
! = gen_rtx_EXPR_LIST (REG_EH_REGION,
! XEXP (note, 0),
! REG_NOTES (insn));
! }
! break;
!
! case REG_NORETURN:
! case REG_SETJMP:
! case REG_ALWAYS_RETURN:
! for (i = XVECLEN (seq, 0) - 1; i >= 0; i--)
! {
! rtx insn = XVECEXP (seq, 0, i);
! if (GET_CODE (insn) == CALL_INSN)
! REG_NOTES (insn)
! = gen_rtx_EXPR_LIST (REG_NOTE_KIND (note),
! XEXP (note, 0),
! REG_NOTES (insn));
! }
! break;
!
! case REG_NON_LOCAL_GOTO:
! for (i = XVECLEN (seq, 0) - 1; i >= 0; i--)
! {
! rtx insn = XVECEXP (seq, 0, i);
! if (GET_CODE (insn) == JUMP_INSN)
! REG_NOTES (insn)
! = gen_rtx_EXPR_LIST (REG_NOTE_KIND (note),
! XEXP (note, 0),
! REG_NOTES (insn));
! }
! break;
!
! default:
! break;
! }
! }
/* If there are LABELS inside the split insns increment the
usage count so we don't delete the label. */