Add poly_int64 streaming support
authorJan Hubicka <jh@suse.cz>
Fri, 2 Oct 2020 11:01:01 +0000 (13:01 +0200)
committerJan Hubicka <jh@suse.cz>
Fri, 2 Oct 2020 11:01:01 +0000 (13:01 +0200)
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.

gcc/data-streamer-in.c
gcc/data-streamer-out.c
gcc/data-streamer.h

index d3ba634af92ae0b9c9ce0313ad4d1ede78982a43..7abb48af9b8703a28912c02846b1ee50076cfd7c 100644 (file)
@@ -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
index 660383904689acccf4577e6db2a74ff583ccf606..fb8a90ab2c0bcec50b9696ee830e16a6693ecd8d 100644 (file)
@@ -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
index 61fa3f9ed6302f9fd1eb484d690a04b19ffc15ba..6ab586f8b1175adce80ab70f06a305fe4b63a765 100644 (file)
@@ -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 *);