Commit 4f2ca7f5 by Richard Henderson Committed by Richard Henderson

genrecog.c (print_host_wide_int): New.

        * genrecog.c (print_host_wide_int): New.
        (write_switch, write_cond): Use it.

From-SVN: r74806
parent 0b667ed8
2003-12-18 Richard Henderson <rth@redhat.com> 2003-12-18 Richard Henderson <rth@redhat.com>
* genrecog.c (print_host_wide_int): New.
(write_switch, write_cond): Use it.
2003-12-18 Richard Henderson <rth@redhat.com>
* c-decl.c (check_bitfield_type_and_width): Remove enum special * c-decl.c (check_bitfield_type_and_width): Remove enum special
case suppression of pedwarn. case suppression of pedwarn.
* system.h (ENUM_BITFIELD): Use __extension__. * system.h (ENUM_BITFIELD): Use __extension__.
......
...@@ -1734,6 +1734,20 @@ write_afterward (struct decision *start, struct decision *afterward, ...@@ -1734,6 +1734,20 @@ write_afterward (struct decision *start, struct decision *afterward,
} }
} }
/* Emit a HOST_WIDE_INT as an integer constant expression. We need to take
special care to avoid "decimal constant is so large that it is unsigned"
warnings in the resulting code. */
static void
print_host_wide_int (HOST_WIDE_INT val)
{
HOST_WIDE_INT min = (unsigned HOST_WIDE_INT)1 << (HOST_BITS_PER_WIDE_INT-1);
if (val == min)
printf ("(" HOST_WIDE_INT_PRINT_DEC_C "-1)", val + 1);
else
printf (HOST_WIDE_INT_PRINT_DEC_C, val);
}
/* Emit a switch statement, if possible, for an initial sequence of /* Emit a switch statement, if possible, for an initial sequence of
nodes at START. Return the first node yet untested. */ nodes at START. Return the first node yet untested. */
...@@ -1907,7 +1921,7 @@ write_switch (struct decision *start, int depth) ...@@ -1907,7 +1921,7 @@ write_switch (struct decision *start, int depth)
case DT_elt_one_int: case DT_elt_one_int:
case DT_elt_zero_wide: case DT_elt_zero_wide:
case DT_elt_zero_wide_safe: case DT_elt_zero_wide_safe:
printf (HOST_WIDE_INT_PRINT_DEC_C, p->tests->u.intval); print_host_wide_int (p->tests->u.intval);
break; break;
default: default:
abort (); abort ();
...@@ -1964,7 +1978,7 @@ write_cond (struct decision_test *p, int depth, ...@@ -1964,7 +1978,7 @@ write_cond (struct decision_test *p, int depth,
case DT_elt_zero_wide: case DT_elt_zero_wide:
case DT_elt_zero_wide_safe: case DT_elt_zero_wide_safe:
printf ("XWINT (x%d, 0) == ", depth); printf ("XWINT (x%d, 0) == ", depth);
printf (HOST_WIDE_INT_PRINT_DEC_C, p->u.intval); print_host_wide_int (p->u.intval);
break; break;
case DT_veclen_ge: case DT_veclen_ge:
......
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