Message ID | 20201002075623.GA27397@kam.mff.cuni.cz |
---|---|
State | New |
Headers | show |
Series | Add streaming of poly_int64 | expand |
On Fri, 2 Oct 2020, Jan Hubicka wrote: > Hi, > this patch implements stremaing for poly int. > > Bootstrapped/regtested x86_64-linux, OK? OK. > gcc/ChangeLog: > > 2020-10-02 Jan Hubicka <hubicka@ucw.cz> > > * data-streamer-in.c (streamer_read_poly_int64): New function. > * data-streamer-out.c (streamer_write_poly_int64): New function. > * data-streamer.h (streamer_write_poly_int64): Declare. > (streamer_read_poly_int64): Declare. > > diff --git a/gcc/data-streamer-in.c b/gcc/data-streamer-in.c > index d3ba634af92..7abb48af9b8 100644 > --- a/gcc/data-streamer-in.c > +++ b/gcc/data-streamer-in.c > @@ -186,6 +186,17 @@ streamer_read_poly_uint64 (class lto_input_block *ib) > return res; > } > > +/* Read a poly_int64 from IB. */ > + > +poly_int64 > +streamer_read_poly_int64 (class lto_input_block *ib) > +{ > + poly_int64 res; > + for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i) > + res.coeffs[i] = streamer_read_hwi (ib); > + return res; > +} > + > /* Read gcov_type value from IB. */ > > gcov_type > diff --git a/gcc/data-streamer-out.c b/gcc/data-streamer-out.c > index 66038390468..fb8a90ab2c0 100644 > --- a/gcc/data-streamer-out.c > +++ b/gcc/data-streamer-out.c > @@ -229,6 +229,15 @@ streamer_write_poly_uint64 (struct output_block *ob, poly_uint64 work) > streamer_write_uhwi_stream (ob->main_stream, work.coeffs[i]); > } > > +/* Write a poly_int64 value WORK to OB->main_stream. */ > + > +void > +streamer_write_poly_int64 (struct output_block *ob, poly_int64 work) > +{ > + for (int i = 0; i < NUM_POLY_INT_COEFFS; ++i) > + streamer_write_hwi_stream (ob->main_stream, work.coeffs[i]); > +} > + > /* Write a gcov counter value WORK to OB->main_stream. */ > > void > diff --git a/gcc/data-streamer.h b/gcc/data-streamer.h > index 61fa3f9ed63..6ab586f8b11 100644 > --- a/gcc/data-streamer.h > +++ b/gcc/data-streamer.h > @@ -54,6 +54,7 @@ void streamer_write_zero (struct output_block *); > void streamer_write_uhwi (struct output_block *, unsigned HOST_WIDE_INT); > void streamer_write_hwi (struct output_block *, HOST_WIDE_INT); > void streamer_write_poly_uint64 (struct output_block *, poly_uint64); > +void streamer_write_poly_int64 (struct output_block *, poly_int64); > void streamer_write_gcov_count (struct output_block *, gcov_type); > void streamer_write_string (struct output_block *, struct lto_output_stream *, > const char *, bool); > @@ -84,6 +85,7 @@ const char *bp_unpack_string (class data_in *, struct bitpack_d *); > unsigned HOST_WIDE_INT streamer_read_uhwi (class lto_input_block *); > HOST_WIDE_INT streamer_read_hwi (class lto_input_block *); > poly_uint64 streamer_read_poly_uint64 (class lto_input_block *); > +poly_int64 streamer_read_poly_int64 (class lto_input_block *); > gcov_type streamer_read_gcov_count (class lto_input_block *); > wide_int streamer_read_wide_int (class lto_input_block *); > widest_int streamer_read_widest_int (class lto_input_block *); >
diff --git a/gcc/data-streamer-in.c b/gcc/data-streamer-in.c index d3ba634af92..7abb48af9b8 100644 --- a/gcc/data-streamer-in.c +++ b/gcc/data-streamer-in.c @@ -186,6 +186,17 @@ streamer_read_poly_uint64 (class lto_input_block *ib) return res; } +/* Read a poly_int64 from IB. */ + +poly_int64 +streamer_read_poly_int64 (class lto_input_block *ib) +{ + poly_int64 res; + for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i) + res.coeffs[i] = streamer_read_hwi (ib); + return res; +} + /* Read gcov_type value from IB. */ gcov_type diff --git a/gcc/data-streamer-out.c b/gcc/data-streamer-out.c index 66038390468..fb8a90ab2c0 100644 --- a/gcc/data-streamer-out.c +++ b/gcc/data-streamer-out.c @@ -229,6 +229,15 @@ streamer_write_poly_uint64 (struct output_block *ob, poly_uint64 work) streamer_write_uhwi_stream (ob->main_stream, work.coeffs[i]); } +/* Write a poly_int64 value WORK to OB->main_stream. */ + +void +streamer_write_poly_int64 (struct output_block *ob, poly_int64 work) +{ + for (int i = 0; i < NUM_POLY_INT_COEFFS; ++i) + streamer_write_hwi_stream (ob->main_stream, work.coeffs[i]); +} + /* Write a gcov counter value WORK to OB->main_stream. */ void diff --git a/gcc/data-streamer.h b/gcc/data-streamer.h index 61fa3f9ed63..6ab586f8b11 100644 --- a/gcc/data-streamer.h +++ b/gcc/data-streamer.h @@ -54,6 +54,7 @@ void streamer_write_zero (struct output_block *); void streamer_write_uhwi (struct output_block *, unsigned HOST_WIDE_INT); void streamer_write_hwi (struct output_block *, HOST_WIDE_INT); void streamer_write_poly_uint64 (struct output_block *, poly_uint64); +void streamer_write_poly_int64 (struct output_block *, poly_int64); void streamer_write_gcov_count (struct output_block *, gcov_type); void streamer_write_string (struct output_block *, struct lto_output_stream *, const char *, bool); @@ -84,6 +85,7 @@ const char *bp_unpack_string (class data_in *, struct bitpack_d *); unsigned HOST_WIDE_INT streamer_read_uhwi (class lto_input_block *); HOST_WIDE_INT streamer_read_hwi (class lto_input_block *); poly_uint64 streamer_read_poly_uint64 (class lto_input_block *); +poly_int64 streamer_read_poly_int64 (class lto_input_block *); gcov_type streamer_read_gcov_count (class lto_input_block *); wide_int streamer_read_wide_int (class lto_input_block *); widest_int streamer_read_widest_int (class lto_input_block *);