From: Jeff Law Date: Mon, 18 Apr 1994 15:19:57 +0000 (-0600) Subject: reorg.c (redirect_with_delay_list_safe_p): New function, similar to redirect_with_del... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b304ad476c745f8b62607de0f35f042dfa5bc46d;p=gcc.git reorg.c (redirect_with_delay_list_safe_p): New function, similar to redirect_with_delay_slots_safe_p. * reorg.c (redirect_with_delay_list_safe_p): New function, similar to redirect_with_delay_slots_safe_p. (fill_slots_from_thread): Do not redirect a jump if doing so would invalidate the delay list for the jump. From-SVN: r7063 --- diff --git a/gcc/reorg.c b/gcc/reorg.c index 6b8ec2f7fd7..3f6a992e672 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -259,6 +259,8 @@ static rtx fill_slots_from_thread PROTO((rtx, rtx, rtx, rtx, int, int, static void fill_eager_delay_slots PROTO((rtx)); static void relax_delay_slots PROTO((rtx)); static void make_return_insns PROTO((rtx)); +static int redirect_with_delay_slots_safe_p PROTO ((rtx, rtx, rtx)); +static int redirect_with_delay_list_safe_p PROTO ((rtx, rtx, rtx)); /* Given X, some rtl, and RES, a pointer to a `struct resource', mark which resources are references by the insn. If INCLUDE_CALLED_ROUTINE @@ -1494,6 +1496,39 @@ redirect_with_delay_slots_safe_p (jump, newlabel, seq) return (i == XVECLEN (pat, 0)); } +/* Return non-zero if redirecting JUMP to NEWLABEL does not invalidate + any insns we wish to place in the delay slot of JUMP. */ + +static int +redirect_with_delay_list_safe_p (jump, newlabel, delay_list) + rtx jump, newlabel, delay_list; +{ + int flags, i; + rtx li; + + /* Make sure all the insns in DELAY_LIST would still be + valid after threading the jump. If they are still + valid, then return non-zero. */ + + flags = get_jump_flags (jump, newlabel); + for (li = delay_list, i = 0; li; li = XEXP (li, 1), i++) + if (! ( +#ifdef ANNUL_IFFALSE_SLOTS + (INSN_ANNULLED_BRANCH_P (jump) + && INSN_FROM_TARGET_P (XEXP (li, 0))) + ? eligible_for_annul_false (jump, i - 1, XEXP (li, 0), flags) : +#endif +#ifdef ANNUL_IFTRUE_SLOTS + (INSN_ANNULLED_BRANCH_P (jump) + && ! INSN_FROM_TARGET_P (XEXP (li, 0))) + ? eligible_for_annul_true (jump, i - 1, XEXP (li, 0), flags) : +#endif + eligible_for_delay (jump, i - 1, XEXP (li, 0), flags))) + break; + + return (li == NULL); +} + /* INSN branches to an insn whose pattern SEQ is a SEQUENCE. Given that the condition tested by INSN is CONDITION and the resources shown in @@ -3462,7 +3497,10 @@ fill_slots_from_thread (insn, condition, thread, opposite_thread, likely, if (new_thread && GET_CODE (new_thread) == JUMP_INSN && (simplejump_p (new_thread) - || GET_CODE (PATTERN (new_thread)) == RETURN)) + || GET_CODE (PATTERN (new_thread)) == RETURN) + && redirect_with_delay_list_safe_p (insn, + JUMP_LABEL (new_thread), + delay_list)) new_thread = follow_jumps (JUMP_LABEL (new_thread)); if (new_thread == 0)