genrecog.c (write_switch): Output if before switch for DT_elt_zero_wide_safe.

* genrecog.c (write_switch):  Output if before switch for
	DT_elt_zero_wide_safe.

From-SVN: r46584
This commit is contained in:
Jan Hubicka 2001-10-28 17:00:22 +01:00 committed by Jan Hubicka
parent d506f6496f
commit 9591d21063
2 changed files with 19 additions and 5 deletions

View File

@ -1,3 +1,8 @@
Sun Oct 28 16:48:09 CET 2001 Jan Hubicka <jh@suse.cz>
* genrecog.c (write_switch): Output if before switch for
DT_elt_zero_wide_safe.
2001-10-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2001-10-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.in (toplev.o, halfpic.o): Depend on halfpic.h * Makefile.in (toplev.o, halfpic.o): Depend on halfpic.h

View File

@ -1909,11 +1909,19 @@ write_switch (start, depth)
|| type == DT_elt_one_int || type == DT_elt_one_int
|| type == DT_elt_zero_wide_safe) || type == DT_elt_zero_wide_safe)
{ {
const char *indent = "";
/* Pmode may not be a compile-time constant. */ /* Pmode may not be a compile-time constant. */
if (type == DT_mode && p->tests->u.mode == Pmode) if (type == DT_mode && p->tests->u.mode == Pmode)
return p; return p;
printf (" switch ("); /* We cast switch parameter to integer, so we must ensure that the value
fits. */
if (type == DT_elt_zero_wide_safe)
{
indent = " ";
printf(" if ((int) XWINT (x%d, 0) == XWINT (x%d, 0))\n", depth, depth);
}
printf ("%s switch (", indent);
switch (type) switch (type)
{ {
case DT_mode: case DT_mode:
@ -1936,7 +1944,7 @@ write_switch (start, depth)
default: default:
abort (); abort ();
} }
printf (")\n {\n"); printf (")\n%s {\n", indent);
do do
{ {
@ -1955,7 +1963,7 @@ write_switch (start, depth)
if (p != start && p->need_label && needs_label == NULL) if (p != start && p->need_label && needs_label == NULL)
needs_label = p; needs_label = p;
printf (" case "); printf ("%s case ", indent);
switch (type) switch (type)
{ {
case DT_mode: case DT_mode:
@ -1973,7 +1981,7 @@ write_switch (start, depth)
default: default:
abort (); abort ();
} }
printf (":\n goto L%d;\n", p->success.first->number); printf (":\n%s goto L%d;\n", indent, p->success.first->number);
p->success.first->need_label = 1; p->success.first->need_label = 1;
p = p->next; p = p->next;
@ -1981,7 +1989,8 @@ write_switch (start, depth)
while (p && p->tests->type == type && !p->tests->next); while (p && p->tests->type == type && !p->tests->next);
case_done: case_done:
printf (" default:\n break;\n }\n"); printf ("%s default:\n%s break;\n%s }\n",
indent, indent, indent);
return needs_label != NULL ? needs_label : p; return needs_label != NULL ? needs_label : p;
} }