Commit 0a2c5149 by Jakub Jelinek Committed by Jakub Jelinek

recog.c (store_data_bypass_p_1): New function.

	* recog.c (store_data_bypass_p_1): New function.
	(store_data_bypass_p): Handle USE in a PARALLEL like CLOBBER.  Use
	store_data_bypass_p_1 to avoid code duplication.  Formatting fixes.

From-SVN: r255553
parent 9221f990
2017-12-11 Jakub Jelinek <jakub@redhat.com>
* recog.c (store_data_bypass_p_1): New function.
(store_data_bypass_p): Handle USE in a PARALLEL like CLOBBER. Use
store_data_bypass_p_1 to avoid code duplication. Formatting fixes.
2017-12-11 Segher Boessenkool <segher@kernel.crashing.org> 2017-12-11 Segher Boessenkool <segher@kernel.crashing.org>
PR rtl-optimization/83361 PR rtl-optimization/83361
...@@ -3657,93 +3657,65 @@ peephole2_optimize (void) ...@@ -3657,93 +3657,65 @@ peephole2_optimize (void)
/* Common predicates for use with define_bypass. */ /* Common predicates for use with define_bypass. */
/* True if the dependency between OUT_INSN and IN_INSN is on the store /* Helper function for store_data_bypass_p, handle just a single SET
data not the address operand(s) of the store. IN_INSN and OUT_INSN IN_SET. */
must be either a single_set or a PARALLEL with SETs inside. */
int static bool
store_data_bypass_p (rtx_insn *out_insn, rtx_insn *in_insn) store_data_bypass_p_1 (rtx_insn *out_insn, rtx in_set)
{ {
rtx out_set, in_set; if (!MEM_P (SET_DEST (in_set)))
rtx out_pat, in_pat; return false;
rtx out_exp, in_exp;
int i, j;
in_set = single_set (in_insn); rtx out_set = single_set (out_insn);
if (in_set) if (out_set)
return !reg_mentioned_p (SET_DEST (out_set), SET_DEST (in_set));
rtx out_pat = PATTERN (out_insn);
if (GET_CODE (out_pat) != PARALLEL)
return false;
for (int i = 0; i < XVECLEN (out_pat, 0); i++)
{ {
if (!MEM_P (SET_DEST (in_set))) rtx out_exp = XVECEXP (out_pat, 0, i);
return false;
out_set = single_set (out_insn); if (GET_CODE (out_exp) == CLOBBER || GET_CODE (out_exp) == USE)
if (out_set) continue;
{
if (reg_mentioned_p (SET_DEST (out_set), SET_DEST (in_set)))
return false;
}
else
{
out_pat = PATTERN (out_insn);
if (GET_CODE (out_pat) != PARALLEL) gcc_assert (GET_CODE (out_exp) == SET);
return false;
for (i = 0; i < XVECLEN (out_pat, 0); i++) if (reg_mentioned_p (SET_DEST (out_exp), SET_DEST (in_set)))
{ return false;
out_exp = XVECEXP (out_pat, 0, i); }
if (GET_CODE (out_exp) == CLOBBER) return true;
continue; }
gcc_assert (GET_CODE (out_exp) == SET); /* True if the dependency between OUT_INSN and IN_INSN is on the store
data not the address operand(s) of the store. IN_INSN and OUT_INSN
must be either a single_set or a PARALLEL with SETs inside. */
if (reg_mentioned_p (SET_DEST (out_exp), SET_DEST (in_set))) int
return false; store_data_bypass_p (rtx_insn *out_insn, rtx_insn *in_insn)
} {
} rtx in_set = single_set (in_insn);
} if (in_set)
else return store_data_bypass_p_1 (out_insn, in_set);
{
in_pat = PATTERN (in_insn);
gcc_assert (GET_CODE (in_pat) == PARALLEL);
for (i = 0; i < XVECLEN (in_pat, 0); i++) rtx in_pat = PATTERN (in_insn);
{ if (GET_CODE (in_pat) != PARALLEL)
in_exp = XVECEXP (in_pat, 0, i); return false;
if (GET_CODE (in_exp) == CLOBBER) for (int i = 0; i < XVECLEN (in_pat, 0); i++)
continue; {
rtx in_exp = XVECEXP (in_pat, 0, i);
gcc_assert (GET_CODE (in_exp) == SET); if (GET_CODE (in_exp) == CLOBBER || GET_CODE (in_exp) == USE)
continue;
if (!MEM_P (SET_DEST (in_exp))) gcc_assert (GET_CODE (in_exp) == SET);
return false;
out_set = single_set (out_insn); if (!store_data_bypass_p_1 (out_insn, in_exp))
if (out_set) return false;
{
if (reg_mentioned_p (SET_DEST (out_set), SET_DEST (in_exp)))
return false;
}
else
{
out_pat = PATTERN (out_insn);
gcc_assert (GET_CODE (out_pat) == PARALLEL);
for (j = 0; j < XVECLEN (out_pat, 0); j++)
{
out_exp = XVECEXP (out_pat, 0, j);
if (GET_CODE (out_exp) == CLOBBER)
continue;
gcc_assert (GET_CODE (out_exp) == SET);
if (reg_mentioned_p (SET_DEST (out_exp), SET_DEST (in_exp)))
return false;
}
}
}
} }
return true; return true;
......
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