data-streamer-in.c (streamer_read_wide_int): New.
authorKugan Vivekanandarajah <kuganv@linaro.org>
Sat, 6 Aug 2016 21:11:26 +0000 (21:11 +0000)
committerKugan Vivekanandarajah <kugan@gcc.gnu.org>
Sat, 6 Aug 2016 21:11:26 +0000 (21:11 +0000)
gcc/ChangeLog:

2016-08-07  Kugan Vivekanandarajah  <kuganv@linaro.org>

* data-streamer-in.c (streamer_read_wide_int): New.
(streamer_read_widest_int): Renamed function.
* data-streamer-out.c (streamer_write_wide_int): New
(streamer_write_widest_int): Renamed function.
* lto-streamer-in.c (streamer_read_wi): Renamed and moved to
data-stream-in.c.
(input_cfg): Call renamed function.
* lto-streamer-out.c (streamer_write_wi): Renamed and moved to
data-stream-out.c.
(output_cfg): Call renamed function.
* data-streamer.h: Add declarations.

From-SVN: r239213

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

index 6a669e6576139a554651af03c1a7c8261ad48d42..2193fda0f818e05ba62b7efd9e69658549607439 100644 (file)
@@ -1,3 +1,17 @@
+2016-08-07  Kugan Vivekanandarajah  <kuganv@linaro.org>
+
+       * data-streamer-in.c (streamer_read_wide_int): New.
+       (streamer_read_widest_int): Renamed function.
+       * data-streamer-out.c (streamer_write_wide_int): New
+       (streamer_write_widest_int): Renamed function.
+       * lto-streamer-in.c (streamer_read_wi): Renamed and moved to
+       data-stream-in.c.
+       (input_cfg): Call renamed function.
+       * lto-streamer-out.c (streamer_write_wi): Renamed and moved to
+       data-stream-out.c.
+       (output_cfg): Call renamed function.
+       * data-streamer.h: Add declarations.
+
 2016-08-08  Prathamesh Kulkarni  <prathamesh.kulkarni@linaro.org>
 
        * tree-ssa-ccp.c (extend_mask): New param sgn.
index 2625af6470e21ab66652bc342cc17a47b7fc9bb8..2a49fe2aaa3141fd3cf92920f1d2edeb64f7637d 100644 (file)
@@ -184,3 +184,34 @@ streamer_read_gcov_count (struct lto_input_block *ib)
   gcc_assert (ret >= 0);
   return ret;
 }
+
+/* Read the physical representation of a wide_int val from
+   input block IB.  */
+
+wide_int
+streamer_read_wide_int (struct lto_input_block *ib)
+{
+  HOST_WIDE_INT a[WIDE_INT_MAX_ELTS];
+  int i;
+  int prec = streamer_read_uhwi (ib);
+  int len = streamer_read_uhwi (ib);
+  for (i = 0; i < len; i++)
+    a[i] = streamer_read_hwi (ib);
+  return wide_int::from_array (a, len, prec);
+}
+
+/* Read the physical representation of a widest_int val from
+   input block IB.  */
+
+widest_int
+streamer_read_widest_int (struct lto_input_block *ib)
+{
+  HOST_WIDE_INT a[WIDE_INT_MAX_ELTS];
+  int i;
+  int prec ATTRIBUTE_UNUSED = streamer_read_uhwi (ib);
+  int len = streamer_read_uhwi (ib);
+  for (i = 0; i < len; i++)
+    a[i] = streamer_read_hwi (ib);
+  return widest_int::from_array (a, len);
+}
+
index e476530579d6c218bc141f6a87d333b570815c96..3dd423bd59cce8b8c30fe13a50146e08fe311d75 100644 (file)
@@ -375,3 +375,30 @@ streamer_write_data_stream (struct lto_output_stream *obs, const void *data,
     }
 }
 
+/* Emit the physical representation of wide_int VAL to output block OB.  */
+
+void
+streamer_write_wide_int (struct output_block *ob, const wide_int &val)
+{
+  int len = val.get_len ();
+
+  streamer_write_uhwi (ob, val.get_precision ());
+  streamer_write_uhwi (ob, len);
+  for (int i = 0; i < len; i++)
+    streamer_write_hwi (ob, val.elt (i));
+}
+
+/* Emit the physical representation of widest_int W to output block OB.  */
+
+void
+streamer_write_widest_int (struct output_block *ob,
+                          const widest_int &w)
+{
+  int len = w.get_len ();
+
+  streamer_write_uhwi (ob, w.get_precision ());
+  streamer_write_uhwi (ob, len);
+  for (int i = 0; i < len; i++)
+    streamer_write_hwi (ob, w.elt (i));
+}
+
index 0048f6646c02b95da6e58b64cd82c5b4999908bd..ff479a661c203b37ecb5cccd259da8df173f3eeb 100644 (file)
@@ -69,6 +69,8 @@ void streamer_write_hwi_stream (struct lto_output_stream *, HOST_WIDE_INT);
 void streamer_write_gcov_count_stream (struct lto_output_stream *, gcov_type);
 void streamer_write_data_stream (struct lto_output_stream *, const void *,
                                 size_t);
+void streamer_write_wide_int (struct output_block *, const wide_int &);
+void streamer_write_widest_int (struct output_block *, const widest_int &);
 
 /* In data-streamer-in.c  */
 const char *streamer_read_string (struct data_in *, struct lto_input_block *);
@@ -81,6 +83,8 @@ const char *bp_unpack_string (struct data_in *, struct bitpack_d *);
 unsigned HOST_WIDE_INT streamer_read_uhwi (struct lto_input_block *);
 HOST_WIDE_INT streamer_read_hwi (struct lto_input_block *);
 gcov_type streamer_read_gcov_count (struct lto_input_block *);
+wide_int streamer_read_wide_int (struct lto_input_block *);
+widest_int streamer_read_widest_int (struct lto_input_block *);
 
 /* Returns a new bit-packing context for bit-packing into S.  */
 static inline struct bitpack_d
index 1d56d21fcfdd3c22b38f510bc9da30cad9340164..5075b5672724276549dd1a0e9f0afdfc13b90ba7 100644 (file)
@@ -710,21 +710,6 @@ make_new_block (struct function *fn, unsigned int index)
 }
 
 
-/* Read a wide-int.  */
-
-static widest_int
-streamer_read_wi (struct lto_input_block *ib)
-{
-  HOST_WIDE_INT a[WIDE_INT_MAX_ELTS];
-  int i;
-  int prec ATTRIBUTE_UNUSED = streamer_read_uhwi (ib);
-  int len = streamer_read_uhwi (ib);
-  for (i = 0; i < len; i++)
-    a[i] = streamer_read_hwi (ib);
-  return widest_int::from_array (a, len);
-}
-
-
 /* Read the CFG for function FN from input block IB.  */
 
 static void
@@ -834,13 +819,13 @@ input_cfg (struct lto_input_block *ib, struct data_in *data_in,
       loop->estimate_state = streamer_read_enum (ib, loop_estimation, EST_LAST);
       loop->any_upper_bound = streamer_read_hwi (ib);
       if (loop->any_upper_bound)
-       loop->nb_iterations_upper_bound = streamer_read_wi (ib);
+       loop->nb_iterations_upper_bound = streamer_read_widest_int (ib);
       loop->any_likely_upper_bound = streamer_read_hwi (ib);
       if (loop->any_likely_upper_bound)
-       loop->nb_iterations_likely_upper_bound = streamer_read_wi (ib);
+       loop->nb_iterations_likely_upper_bound = streamer_read_widest_int (ib);
       loop->any_estimate = streamer_read_hwi (ib);
       if (loop->any_estimate)
-       loop->nb_iterations_estimate = streamer_read_wi (ib);
+       loop->nb_iterations_estimate = streamer_read_widest_int (ib);
 
       /* Read OMP SIMD related info.  */
       loop->safelen = streamer_read_hwi (ib);
index aa6b5892ea5955cdfcfe34df7d2b1e6a0f5c6905..bc45721f0777655004e867556725a174afdd7c7c 100644 (file)
@@ -1828,20 +1828,6 @@ output_ssa_names (struct output_block *ob, struct function *fn)
 }
 
 
-/* Output a wide-int.  */
-
-static void
-streamer_write_wi (struct output_block *ob,
-                  const widest_int &w)
-{
-  int len = w.get_len ();
-
-  streamer_write_uhwi (ob, w.get_precision ());
-  streamer_write_uhwi (ob, len);
-  for (int i = 0; i < len; i++)
-    streamer_write_hwi (ob, w.elt (i));
-}
-
 
 /* Output the cfg.  */
 
@@ -1915,13 +1901,13 @@ output_cfg (struct output_block *ob, struct function *fn)
                           loop_estimation, EST_LAST, loop->estimate_state);
       streamer_write_hwi (ob, loop->any_upper_bound);
       if (loop->any_upper_bound)
-       streamer_write_wi (ob, loop->nb_iterations_upper_bound);
+       streamer_write_widest_int (ob, loop->nb_iterations_upper_bound);
       streamer_write_hwi (ob, loop->any_likely_upper_bound);
       if (loop->any_likely_upper_bound)
-       streamer_write_wi (ob, loop->nb_iterations_likely_upper_bound);
+       streamer_write_widest_int (ob, loop->nb_iterations_likely_upper_bound);
       streamer_write_hwi (ob, loop->any_estimate);
       if (loop->any_estimate)
-       streamer_write_wi (ob, loop->nb_iterations_estimate);
+       streamer_write_widest_int (ob, loop->nb_iterations_estimate);
 
       /* Write OMP SIMD related info.  */
       streamer_write_hwi (ob, loop->safelen);