From dc3f38050535e8904dce2fd02c6efb6cf91eea3d Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 20 Dec 2017 12:51:57 +0000 Subject: poly_int: dump routines 2017-12-20 Richard Sandiford Alan Hayward David Sherwood gcc/ * dumpfile.h (dump_dec): Declare. * dumpfile.c (dump_dec): New function. * pretty-print.h (pp_wide_integer): Turn into a function and declare a poly_int version. * pretty-print.c (pp_wide_integer): New function for poly_ints. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r255864 --- gcc/pretty-print.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'gcc/pretty-print.c') diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c index 1fbd2fe..0c328d0 100644 --- a/gcc/pretty-print.c +++ b/gcc/pretty-print.c @@ -795,6 +795,30 @@ pp_clear_state (pretty_printer *pp) pp_indentation (pp) = 0; } +/* Print X to PP in decimal. */ +template +void +pp_wide_integer (pretty_printer *pp, const poly_int_pod &x) +{ + if (x.is_constant ()) + pp_wide_integer (pp, x.coeffs[0]); + else + { + pp_left_bracket (pp); + for (unsigned int i = 0; i < N; ++i) + { + if (i != 0) + pp_comma (pp); + pp_wide_integer (pp, x.coeffs[i]); + } + pp_right_bracket (pp); + } +} + +template void pp_wide_integer (pretty_printer *, const poly_uint16_pod &); +template void pp_wide_integer (pretty_printer *, const poly_int64_pod &); +template void pp_wide_integer (pretty_printer *, const poly_uint64_pod &); + /* Flush the formatted text of PRETTY-PRINTER onto the attached stream. */ void pp_write_text_to_stream (pretty_printer *pp) -- cgit v1.1