Commit cc6b9196 by Richard Sandiford Committed by Richard Sandiford

frv.c (frv_registers_conflict_p_1): Take an rtx rather than an rtx *.

gcc/
	* config/frv/frv.c (frv_registers_conflict_p_1): Take an rtx rather
	than an rtx *.  Take the regstate_t directly rather than via a void *.
	Return a bool rather than an int.  Iterate over all subrtxes here.
	(frv_registers_conflict_p): Update accordingly.

From-SVN: r217310
parent cc665e56
2014-11-10 Richard Sandiford <richard.sandiford@arm.com> 2014-11-10 Richard Sandiford <richard.sandiford@arm.com>
* config/frv/frv.c (frv_registers_conflict_p_1): Take an rtx rather
than an rtx *. Take the regstate_t directly rather than via a void *.
Return a bool rather than an int. Iterate over all subrtxes here.
(frv_registers_conflict_p): Update accordingly.
2014-11-10 Richard Sandiford <richard.sandiford@arm.com>
* config/frv/frv.c: Include rtl-iter.h. * config/frv/frv.c: Include rtl-iter.h.
(frv_acc_group_1): Delete. (frv_acc_group_1): Delete.
(frv_acc_group): Use FOR_EACH_SUBRTX. (frv_acc_group): Use FOR_EACH_SUBRTX.
...@@ -343,7 +343,6 @@ static unsigned int frv_insn_unit (rtx_insn *); ...@@ -343,7 +343,6 @@ static unsigned int frv_insn_unit (rtx_insn *);
static bool frv_issues_to_branch_unit_p (rtx_insn *); static bool frv_issues_to_branch_unit_p (rtx_insn *);
static int frv_cond_flags (rtx); static int frv_cond_flags (rtx);
static bool frv_regstate_conflict_p (regstate_t, regstate_t); static bool frv_regstate_conflict_p (regstate_t, regstate_t);
static int frv_registers_conflict_p_1 (rtx *, void *);
static bool frv_registers_conflict_p (rtx); static bool frv_registers_conflict_p (rtx);
static void frv_registers_update_1 (rtx, const_rtx, void *); static void frv_registers_update_1 (rtx, const_rtx, void *);
static void frv_registers_update (rtx); static void frv_registers_update (rtx);
...@@ -7171,53 +7170,49 @@ frv_regstate_conflict_p (regstate_t cond1, regstate_t cond2) ...@@ -7171,53 +7170,49 @@ frv_regstate_conflict_p (regstate_t cond1, regstate_t cond2)
} }
/* A for_each_rtx callback. Return 1 if *X depends on an instruction in /* Return true if an instruction with pattern PAT depends on an
the current packet. DATA points to a regstate_t that describes the instruction in the current packet. COND describes the condition
condition under which *X might be set or used. */ under which PAT might be set or used. */
static int static bool
frv_registers_conflict_p_1 (rtx *x, void *data) frv_registers_conflict_p_1 (rtx pat, regstate_t cond)
{ {
unsigned int regno, i; subrtx_var_iterator::array_type array;
regstate_t cond; FOR_EACH_SUBRTX_VAR (iter, array, pat, NONCONST)
cond = *(regstate_t *) data;
if (GET_CODE (*x) == REG)
FOR_EACH_REGNO (regno, *x)
if ((frv_packet.regstate[regno] & REGSTATE_MODIFIED) != 0)
if (frv_regstate_conflict_p (frv_packet.regstate[regno], cond))
return 1;
if (GET_CODE (*x) == MEM)
{ {
/* If we ran out of memory slots, assume a conflict. */ rtx x = *iter;
if (frv_packet.num_mems > ARRAY_SIZE (frv_packet.mems)) if (GET_CODE (x) == REG)
return 1; {
unsigned int regno;
FOR_EACH_REGNO (regno, x)
if ((frv_packet.regstate[regno] & REGSTATE_MODIFIED) != 0)
if (frv_regstate_conflict_p (frv_packet.regstate[regno], cond))
return true;
}
else if (GET_CODE (x) == MEM)
{
/* If we ran out of memory slots, assume a conflict. */
if (frv_packet.num_mems > ARRAY_SIZE (frv_packet.mems))
return 1;
/* Check for output or true dependencies with earlier MEMs. */ /* Check for output or true dependencies with earlier MEMs. */
for (i = 0; i < frv_packet.num_mems; i++) for (unsigned int i = 0; i < frv_packet.num_mems; i++)
if (frv_regstate_conflict_p (frv_packet.mems[i].cond, cond)) if (frv_regstate_conflict_p (frv_packet.mems[i].cond, cond))
{ {
if (true_dependence (frv_packet.mems[i].mem, VOIDmode, *x)) if (true_dependence (frv_packet.mems[i].mem, VOIDmode, x))
return 1; return true;
if (output_dependence (frv_packet.mems[i].mem, *x)) if (output_dependence (frv_packet.mems[i].mem, x))
return 1; return true;
} }
} }
/* The return values of calls aren't significant: they describe /* The return values of calls aren't significant: they describe
the effect of the call as a whole, not of the insn itself. */ the effect of the call as a whole, not of the insn itself. */
if (GET_CODE (*x) == SET && GET_CODE (SET_SRC (*x)) == CALL) else if (GET_CODE (x) == SET && GET_CODE (SET_SRC (x)) == CALL)
{ iter.substitute (SET_SRC (x));
if (for_each_rtx (&SET_SRC (*x), frv_registers_conflict_p_1, data))
return 1;
return -1;
} }
return false;
/* Check subexpressions. */
return 0;
} }
...@@ -7232,13 +7227,13 @@ frv_registers_conflict_p (rtx x) ...@@ -7232,13 +7227,13 @@ frv_registers_conflict_p (rtx x)
flags = 0; flags = 0;
if (GET_CODE (x) == COND_EXEC) if (GET_CODE (x) == COND_EXEC)
{ {
if (for_each_rtx (&XEXP (x, 0), frv_registers_conflict_p_1, &flags)) if (frv_registers_conflict_p_1 (XEXP (x, 0), flags))
return true; return true;
flags |= frv_cond_flags (XEXP (x, 0)); flags |= frv_cond_flags (XEXP (x, 0));
x = XEXP (x, 1); x = XEXP (x, 1);
} }
return for_each_rtx (&x, frv_registers_conflict_p_1, &flags); return frv_registers_conflict_p_1 (x, flags);
} }
......
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