Commit a8393d5d by Richard Henderson Committed by Richard Henderson

rtlanal.c (insn_dependant_p, [...]): New.

        * rtlanal.c (insn_dependant_p, insn_dependant_p_1): New.
        * rtl.h (insn_dependant_p): Declare it.
        * loop.c (strength_reduce): Use it.

From-SVN: r34010
parent 14806ff1
2000-05-18 Richard Henderson <rth@cygnus.com>
* rtlanal.c (insn_dependant_p, insn_dependant_p_1): New.
* rtl.h (insn_dependant_p): Declare it.
* loop.c (strength_reduce): Use it.
2000-05-18 Alexandre Oliva <aoliva@cygnus.com> 2000-05-18 Alexandre Oliva <aoliva@cygnus.com>
* config/mn10300/mn10300.c (expand_prologue, expand_epilogue): * config/mn10300/mn10300.c (expand_prologue, expand_epilogue):
......
...@@ -4119,10 +4119,9 @@ strength_reduce (loop, insn_count, flags) ...@@ -4119,10 +4119,9 @@ strength_reduce (loop, insn_count, flags)
for (next = NEXT_INSN (dominator); ; next = NEXT_INSN (next)) for (next = NEXT_INSN (dominator); ; next = NEXT_INSN (next))
{ {
if ((INSN_P (next) if (GET_CODE (next) == JUMP_INSN
&& (reg_mentioned_p (giv, PATTERN (next)) || (INSN_P (next)
|| reg_set_p (bl2->biv->src_reg, next))) && insn_dependant_p (giv_insn, next)))
|| GET_CODE (next) == JUMP_INSN)
break; break;
#ifdef HAVE_cc0 #ifdef HAVE_cc0
if (! INSN_P (next) if (! INSN_P (next)
......
...@@ -1212,6 +1212,7 @@ extern int modified_between_p PARAMS ((rtx, rtx, rtx)); ...@@ -1212,6 +1212,7 @@ extern int modified_between_p PARAMS ((rtx, rtx, rtx));
extern int no_labels_between_p PARAMS ((rtx, rtx)); extern int no_labels_between_p PARAMS ((rtx, rtx));
extern int no_jumps_between_p PARAMS ((rtx, rtx)); extern int no_jumps_between_p PARAMS ((rtx, rtx));
extern int modified_in_p PARAMS ((rtx, rtx)); extern int modified_in_p PARAMS ((rtx, rtx));
extern int insn_dependant_p PARAMS ((rtx, rtx));
extern int reg_set_p PARAMS ((rtx, rtx)); extern int reg_set_p PARAMS ((rtx, rtx));
extern rtx single_set PARAMS ((rtx)); extern rtx single_set PARAMS ((rtx));
extern int multiple_sets PARAMS ((rtx)); extern int multiple_sets PARAMS ((rtx));
......
...@@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA. */
static int rtx_addr_can_trap_p PARAMS ((rtx)); static int rtx_addr_can_trap_p PARAMS ((rtx));
static void reg_set_p_1 PARAMS ((rtx, rtx, void *)); static void reg_set_p_1 PARAMS ((rtx, rtx, void *));
static void insn_dependant_p_1 PARAMS ((rtx, rtx, void *));
static void reg_set_last_1 PARAMS ((rtx, rtx, void *)); static void reg_set_last_1 PARAMS ((rtx, rtx, void *));
...@@ -688,6 +689,45 @@ modified_in_p (x, insn) ...@@ -688,6 +689,45 @@ modified_in_p (x, insn)
return 0; return 0;
} }
/* Return true if anything in insn X is (anti,output,true) dependant on
anything in insn Y. */
int
insn_dependant_p (x, y)
rtx x, y;
{
rtx tmp;
if (! INSN_P (x) || ! INSN_P (y))
abort ();
tmp = PATTERN (y);
note_stores (PATTERN (x), insn_dependant_p_1, &tmp);
if (tmp == NULL_RTX)
return 1;
tmp = PATTERN (x);
note_stores (PATTERN (y), insn_dependant_p_1, &tmp);
if (tmp == NULL_RTX)
return 1;
return 0;
}
/* A helper routine for insn_dependant_p called through note_stores. */
static void
insn_dependant_p_1 (x, pat, data)
rtx x;
rtx pat ATTRIBUTE_UNUSED;
void *data;
{
rtx * pinsn = (rtx *) data;
if (*pinsn && reg_mentioned_p (x, *pinsn))
*pinsn = NULL_RTX;
}
/* Given an INSN, return a SET expression if this insn has only a single SET. /* Given an INSN, return a SET expression if this insn has only a single SET.
It may also have CLOBBERs, USEs, or SET whose output It may also have CLOBBERs, USEs, or SET whose output
will not be used, which we ignore. */ will not be used, which we ignore. */
......
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