Commit f345f21a by Jan Hubicka Committed by Jan Hubicka

reload.c (find_reloads): Reorganize if seqeunce to switch.


	* reload.c (find_reloads): Reorganize if seqeunce to switch.

	* cfgrtl.c (rtl_redirect_edge_and_branch):  Set the source BB as dirty.
	(cfglayout_redirect_edge_and_branch):  Set the source BB as dirty.

From-SVN: r78936
parent aa42f99d
2004-03-04 Jan Hubicka <jh@suse.cz>
* reload.c (find_reloads): Reorganize if seqeunce to switch.
* cfgrtl.c (rtl_redirect_edge_and_branch): Set the source BB as dirty.
(cfglayout_redirect_edge_and_branch): Set the source BB as dirty.
2004-03-04 Steve Ellcey <sje@cup.hp.com> 2004-03-04 Steve Ellcey <sje@cup.hp.com>
* config/ia64/ia64.md (divdf3_internal_thr): Fix algorithm. * config/ia64/ia64.md (divdf3_internal_thr): Fix algorithm.
......
...@@ -933,6 +933,8 @@ redirect_branch_edge (edge e, basic_block target) ...@@ -933,6 +933,8 @@ redirect_branch_edge (edge e, basic_block target)
static bool static bool
rtl_redirect_edge_and_branch (edge e, basic_block target) rtl_redirect_edge_and_branch (edge e, basic_block target)
{ {
basic_block src = e->src;
if (e->flags & (EDGE_ABNORMAL_CALL | EDGE_EH)) if (e->flags & (EDGE_ABNORMAL_CALL | EDGE_EH))
return false; return false;
...@@ -940,11 +942,15 @@ rtl_redirect_edge_and_branch (edge e, basic_block target) ...@@ -940,11 +942,15 @@ rtl_redirect_edge_and_branch (edge e, basic_block target)
return true; return true;
if (try_redirect_by_replacing_jump (e, target, false)) if (try_redirect_by_replacing_jump (e, target, false))
return true; {
src->flags |= BB_DIRTY;
return true;
}
if (!redirect_branch_edge (e, target)) if (!redirect_branch_edge (e, target))
return false; return false;
src->flags |= BB_DIRTY;
return true; return true;
} }
...@@ -2379,7 +2385,10 @@ cfg_layout_redirect_edge_and_branch (edge e, basic_block dest) ...@@ -2379,7 +2385,10 @@ cfg_layout_redirect_edge_and_branch (edge e, basic_block dest)
if (e->src != ENTRY_BLOCK_PTR if (e->src != ENTRY_BLOCK_PTR
&& try_redirect_by_replacing_jump (e, dest, true)) && try_redirect_by_replacing_jump (e, dest, true))
return true; {
src->flags |= BB_DIRTY;
return true;
}
if (e->src == ENTRY_BLOCK_PTR if (e->src == ENTRY_BLOCK_PTR
&& (e->flags & EDGE_FALLTHRU) && !(e->flags & EDGE_COMPLEX)) && (e->flags & EDGE_FALLTHRU) && !(e->flags & EDGE_COMPLEX))
...@@ -2388,6 +2397,7 @@ cfg_layout_redirect_edge_and_branch (edge e, basic_block dest) ...@@ -2388,6 +2397,7 @@ cfg_layout_redirect_edge_and_branch (edge e, basic_block dest)
fprintf (dump_file, "Redirecting entry edge from bb %i to %i\n", fprintf (dump_file, "Redirecting entry edge from bb %i to %i\n",
e->src->index, dest->index); e->src->index, dest->index);
e->src->flags |= BB_DIRTY;
redirect_edge_succ (e, dest); redirect_edge_succ (e, dest);
return true; return true;
} }
...@@ -2411,6 +2421,7 @@ cfg_layout_redirect_edge_and_branch (edge e, basic_block dest) ...@@ -2411,6 +2421,7 @@ cfg_layout_redirect_edge_and_branch (edge e, basic_block dest)
if (!redirect_branch_edge (e, dest)) if (!redirect_branch_edge (e, dest))
abort (); abort ();
e->flags |= EDGE_FALLTHRU; e->flags |= EDGE_FALLTHRU;
e->src->flags |= BB_DIRTY;
return true; return true;
} }
/* In case we are redirecting fallthru edge to the branch edge /* In case we are redirecting fallthru edge to the branch edge
...@@ -2438,6 +2449,7 @@ cfg_layout_redirect_edge_and_branch (edge e, basic_block dest) ...@@ -2438,6 +2449,7 @@ cfg_layout_redirect_edge_and_branch (edge e, basic_block dest)
if (simplejump_p (BB_END (src))) if (simplejump_p (BB_END (src)))
abort (); abort ();
src->flags |= BB_DIRTY;
return ret; return ret;
} }
......
...@@ -2610,62 +2610,71 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, ...@@ -2610,62 +2610,71 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
while ((c = *p)) while ((c = *p))
{ {
p += CONSTRAINT_LEN (c, p); p += CONSTRAINT_LEN (c, p);
if (c == '=') switch (c)
modified[i] = RELOAD_WRITE;
else if (c == '+')
modified[i] = RELOAD_READ_WRITE;
else if (c == '%')
{ {
/* The last operand should not be marked commutative. */ case '=':
if (i == noperands - 1) modified[i] = RELOAD_WRITE;
abort (); break;
case '+':
/* We currently only support one commutative pair of modified[i] = RELOAD_READ_WRITE;
operands. Some existing asm code currently uses more break;
than one pair. Previously, that would usually work, case '%':
but sometimes it would crash the compiler. We {
continue supporting that case as well as we can by /* The last operand should not be marked commutative. */
silently ignoring all but the first pair. In the if (i == noperands - 1)
future we may handle it correctly. */ abort ();
if (commutative < 0)
commutative = i;
else if (!this_insn_is_asm)
abort ();
}
else if (ISDIGIT (c))
{
c = strtoul (p - 1, &p, 10);
operands_match[c][i] /* We currently only support one commutative pair of
= operands_match_p (recog_data.operand[c], operands. Some existing asm code currently uses more
recog_data.operand[i]); than one pair. Previously, that would usually work,
but sometimes it would crash the compiler. We
continue supporting that case as well as we can by
silently ignoring all but the first pair. In the
future we may handle it correctly. */
if (commutative < 0)
commutative = i;
else if (!this_insn_is_asm)
abort ();
}
break;
/* Use of ISDIGIT is tempting here, but it may get expensive because
of locale support we don't want. */
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
{
c = strtoul (p - 1, &p, 10);
/* An operand may not match itself. */ operands_match[c][i]
if (c == i) = operands_match_p (recog_data.operand[c],
abort (); recog_data.operand[i]);
/* If C can be commuted with C+1, and C might need to match I, /* An operand may not match itself. */
then C+1 might also need to match I. */ if (c == i)
if (commutative >= 0) abort ();
{
if (c == commutative || c == commutative + 1) /* If C can be commuted with C+1, and C might need to match I,
{ then C+1 might also need to match I. */
int other = c + (c == commutative ? 1 : -1); if (commutative >= 0)
operands_match[other][i] {
= operands_match_p (recog_data.operand[other], if (c == commutative || c == commutative + 1)
recog_data.operand[i]); {
} int other = c + (c == commutative ? 1 : -1);
if (i == commutative || i == commutative + 1) operands_match[other][i]
{ = operands_match_p (recog_data.operand[other],
int other = i + (i == commutative ? 1 : -1); recog_data.operand[i]);
operands_match[c][other] }
= operands_match_p (recog_data.operand[c], if (i == commutative || i == commutative + 1)
recog_data.operand[other]); {
} int other = i + (i == commutative ? 1 : -1);
/* Note that C is supposed to be less than I. operands_match[c][other]
No need to consider altering both C and I because in = operands_match_p (recog_data.operand[c],
that case we would alter one into the other. */ recog_data.operand[other]);
} }
/* Note that C is supposed to be less than I.
No need to consider altering both C and I because in
that case we would alter one into the other. */
}
}
} }
} }
} }
......
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