Commit d781a164 by Richard Henderson Committed by Richard Henderson

jump.c: Fix typos and clarify commentary from last change.

        * jump.c: Fix typos and clarify commentary from last change.
        (any_condjump_p): Verify SET_SRC is an IF_THEN_ELSE.
        (safe_to_remove_jump_p): Remove.
        (condjump_label): Use pc_set.

From-SVN: r33924
parent 7f9d9ea1
2000-05-15 Richard Henderson <rth@cygnus.com> 2000-05-15 Richard Henderson <rth@cygnus.com>
* jump.c: Fix typos and clarify commentary from last change.
(any_condjump_p): Verify SET_SRC is an IF_THEN_ELSE.
(safe_to_remove_jump_p): Remove.
(condjump_label): Use pc_set.
2000-05-15 Richard Henderson <rth@cygnus.com>
* ifcvt.c (cond_exec_process_insns): Drop USE and CLOBBER insns * ifcvt.c (cond_exec_process_insns): Drop USE and CLOBBER insns
that get in the way after reload. that get in the way after reload.
(cond_exec_process_if_block): Skip a label heading THEN block. (cond_exec_process_if_block): Skip a label heading THEN block.
......
...@@ -2099,10 +2099,8 @@ simplejump_p (insn) ...@@ -2099,10 +2099,8 @@ simplejump_p (insn)
/* Return nonzero if INSN is a (possibly) conditional jump /* Return nonzero if INSN is a (possibly) conditional jump
and nothing more. and nothing more.
Use this function is depreached, since we need to support Use this function is deprecated, since we need to support combined
branch and compare insns. Use nontrivial_condjump_p instead branch and compare insns. Use any_condjump_p instead whenever possible. */
whenever possible.
*/
int int
condjump_p (insn) condjump_p (insn)
...@@ -2131,10 +2129,8 @@ condjump_p (insn) ...@@ -2131,10 +2129,8 @@ condjump_p (insn)
/* Return nonzero if INSN is a (possibly) conditional jump inside a /* Return nonzero if INSN is a (possibly) conditional jump inside a
PARALLEL. PARALLEL.
Use this function is depreached, since we need to support Use this function is deprecated, since we need to support combined
branch and compare insns. Use any_condjump_p instead branch and compare insns. Use any_condjump_p instead whenever possible. */
whenever possible.
*/
int int
condjump_in_parallel_p (insn) condjump_in_parallel_p (insn)
...@@ -2166,30 +2162,30 @@ condjump_in_parallel_p (insn) ...@@ -2166,30 +2162,30 @@ condjump_in_parallel_p (insn)
return 0; return 0;
} }
/* Return set of PC if available NULL otherwise. */ /* Return set of PC, otherwise NULL. */
rtx rtx
pc_set (insn) pc_set (insn)
rtx insn; rtx insn;
{ {
rtx pat; rtx pat;
if (GET_CODE (insn) != JUMP_INSN) if (GET_CODE (insn) != JUMP_INSN)
return NULL; return NULL_RTX;
pat = PATTERN (insn); pat = PATTERN (insn);
/* The set is allowed to appear eighter as insn pattern or the first in
PARALLEL expression. */ /* The set is allowed to appear either as the insn pattern or
the first set in a PARALLEL. */
if (GET_CODE (pat) == PARALLEL)
pat = XVECEXP (pat, 0, 0);
if (GET_CODE (pat) == SET && GET_CODE (SET_DEST (pat)) == PC) if (GET_CODE (pat) == SET && GET_CODE (SET_DEST (pat)) == PC)
return pat; return pat;
if (GET_CODE (pat) == PARALLEL)
{ return NULL_RTX;
rtx set = XVECEXP (pat, 0, 0);
if (GET_CODE (set) == SET && GET_CODE (SET_DEST (set)) == PC)
return set;
}
return NULL;
} }
/* Return true when insn in unconditional jump possibly boundled inside /* Return true when insn is an unconditional direct jump,
PARALLEL. */ possibly bundled inside a PARALLEL. */
int int
any_uncondjump_p (insn) any_uncondjump_p (insn)
rtx insn; rtx insn;
...@@ -2202,41 +2198,30 @@ any_uncondjump_p (insn) ...@@ -2202,41 +2198,30 @@ any_uncondjump_p (insn)
return 1; return 1;
} }
/* Return true when insn is conditional jump. This function work for /* Return true when insn is a conditional jump. This function works for
instructions containing PC sets in PARALLELs. The instruction may have instructions containing PC sets in PARALLELs. The instruction may have
various other effects so before removing the jump you must verify various other effects so before removing the jump you must verify
safe_to_remove_jump_p. safe_to_remove_jump_p.
Note that unlike condjump_p it returns 0 for unconditionals jumps. Note that unlike condjump_p it returns false for unconditional jumps. */
*/
int int
any_condjump_p (insn) any_condjump_p (insn)
rtx insn; rtx insn;
{ {
rtx x = pc_set (insn); rtx x = pc_set (insn);
enum rtx_code a, b;
if (!x) if (!x)
return 0; return 0;
if (XEXP (SET_SRC (x), 2) == pc_rtx if (GET_CODE (SET_SRC (x)) != IF_THEN_ELSE)
&& (GET_CODE (XEXP (SET_SRC (x), 1)) == LABEL_REF return 0;
|| GET_CODE (XEXP (SET_SRC (x), 1)) == RETURN))
return 1;
if (XEXP (SET_SRC (x), 1) == pc_rtx
&& (GET_CODE (XEXP (SET_SRC (x), 2)) == LABEL_REF
|| GET_CODE (XEXP (SET_SRC (x), 2)) == RETURN))
return 1;
return 0;
}
a = GET_CODE (XEXP (SET_SRC (x), 1));
b = GET_CODE (XEXP (SET_SRC (x), 2));
/* Return true when the condjump is safe to remove. */ return ((b == PC && (a == LABEL_REF || a == RETURN))
int || (a == PC && (b == LABEL_REF || b == RETURN)));
safe_to_remove_jump_p (insn)
rtx insn;
{
/* For non-single set insns we may remove set of the other registers. */
if (!pc_set (insn) || !single_set (insn))
return 0;
return 1;
} }
/* Return the label of a conditional jump. */ /* Return the label of a conditional jump. */
...@@ -2245,13 +2230,9 @@ rtx ...@@ -2245,13 +2230,9 @@ rtx
condjump_label (insn) condjump_label (insn)
rtx insn; rtx insn;
{ {
register rtx x = PATTERN (insn); rtx x = pc_set (insn);
if (GET_CODE (x) == PARALLEL) if (!x)
x = XVECEXP (x, 0, 0);
if (GET_CODE (x) != SET)
return NULL_RTX;
if (GET_CODE (SET_DEST (x)) != PC)
return NULL_RTX; return NULL_RTX;
x = SET_SRC (x); x = SET_SRC (x);
if (GET_CODE (x) == LABEL_REF) if (GET_CODE (x) == LABEL_REF)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment