]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* data-streamer.h (streamer_write_zero): Rename from output_zero.
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 12 Aug 2011 16:42:13 +0000 (16:42 +0000)
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 12 Aug 2011 16:42:13 +0000 (16:42 +0000)
  (streamer_write_uhwi): Rename from lto_output_uleb128.
  (streamer_write_hwi): Rename from output_sleb128.
  (streamer_write_string): Rename from lto_output_string.
  (streamer_string_index): Rename from lto_string_index.
  (streamer_write_string_with_length): Rename from
  lto_output_string_with_length.
  (streamer_write_uhwi_stream): Rename from lto_output_uleb128_stream.
  (streamer_write_hwi_stream): Rename from lto_output_sleb128_stream.
  (streamer_read_string): Rename from lto_input_string.
  (streamer_read_indexed_string): Rename from input_string_internal.
  (streamer_read_uhwi): Rename from lto_input_uleb128.
  (streamer_read_hwi): Rename from lto_input_sleb128.
  (streamer_write_hwi_in_range): Rename from lto_output_int_in_range.
  (streamer_read_hwi_in_range): Rename from lto_input_int_in_range.
  (streamer_write_enum): Rename from lto_output_enum.
  (streamer_read_enum): Rename from lto_input_enum.
  (streamer_write_record_start): Rename from output_record_start.
  (streamer_read_record_start): Rename from input_record_start.
  (streamer_write_bitpack): Rename from lto_output_bitpack.
  (streamer_read_bitpack): Rename from lto_input_bitpack.
  (streamer_write_char_stream): Rename from lto_output_1_stream.
  (streamer_read_uchar): Rename from lto_input_1_unsigned.
  * tree-streamer.h (streamer_cache_d): Rename from lto_streamer_cache_d.
  (streamer_handle_as_builtin_p): Rename from lto_stream_as_builtin_p.
  (streamer_read_string_cst): Rename from input_string_cst.
  (streamer_read_chain): Rename from lto_input_chain.
  (streamer_alloc_tree): Rename from lto_materialize_tree.
  (streamer_read_tree_body): Rename from lto_input_tree_pointers.
  (streamer_get_pickled_tree): Rename from lto_get_pickled_tree.
  (streamer_get_builtin_tree): Rename from lto_get_builtin_tree.
  (streamer_read_integer_cst): Rename from lto_input_integer_cst.
  (streamer_read_tree_bitfields): Rename from tree_read_bitfields.
  (streamer_write_chain): Rename from lto_output_chain.
  (streamer_write_tree_header): Rename from lto_output_tree_header.
  (streamer_pack_tree_bitfields): Rename from pack_value_fields.
  (streamer_write_tree_body): Rename from lto_output_tree_pointers.
  (streamer_write_integer_cst): Rename from lto_output_integer_cst.
  (streamer_write_builtin): Rename from lto_output_builtin_tree.
  (streamer_check_handled_ts_structures): Rename from
  check_handled_ts_structures.
  (streamer_tree_cache_insert): Rename from lto_streamer_cache_insert.
  (streamer_tree_cache_insert_at): Rename from
  lto_streamer_cache_insert_at.
  (streamer_tree_cache_append): Rename from lto_streamer_cache_append.
  (streamer_tree_cache_lookup): Rename from lto_streamer_cache_lookup.
  (streamer_tree_cache_get): Rename from lto_streamer_cache_get.
  (streamer_tree_cache_create): Rename from lto_streamer_cache_create.
  (streamer_tree_cache_delete): Rename from lto_streamer_cache_delete.
  * tree-streamer-out.c (write_string_cst): Rename from output_string_cst.
  (write_identifier): Rename from output_identifier.
  (write_ts_common_tree_pointers): Rename from
  lto_output_ts_common_tree_pointers.
  (write_ts_vector_tree_pointers): Rename from
  lto_output_ts_vector_tree_pointers.
  (write_ts_complex_tree_pointers): Rename from
  lto_output_ts_complex_tree_pointers.
  (write_ts_decl_minimal_tree_pointers): Rename from
  lto_output_ts_decl_minimal_tree_pointers.
  (write_ts_decl_common_tree_pointers): Rename from
  lto_output_ts_decl_common_tree_pointers.
  (write_ts_decl_non_common_tree_pointers): Rename from
  lto_output_ts_decl_non_common_tree_pointers.
  (write_ts_decl_with_vis_tree_pointers): Rename from
  lto_output_ts_decl_with_vis_tree_pointers.
  (write_ts_field_decl_tree_pointers): Rename from
  lto_output_ts_field_decl_tree_pointers.
  (write_ts_function_decl_tree_pointers): Rename from
  lto_output_ts_function_decl_tree_pointers.
  (write_ts_type_common_tree_pointers): Rename from
  lto_output_ts_type_common_tree_pointers.
  (write_ts_type_non_common_tree_pointers): Rename from
  lto_output_ts_type_non_common_tree_pointers.
  (write_ts_list_tree_pointers): Rename from
  lto_output_ts_list_tree_pointers.
  (write_ts_vec_tree_pointers): Rename from
  lto_output_ts_vec_tree_pointers.
  (write_ts_exp_tree_pointers): Rename from
  lto_output_ts_exp_tree_pointers.
  (write_ts_block_tree_pointers): Rename from
  lto_output_ts_block_tree_pointers.
  (write_ts_binfo_tree_pointers): Rename from
  lto_output_ts_binfo_tree_pointers.
  (write_ts_constructor_tree_pointers): Rename from
  lto_output_ts_constructor_tree_pointers.
  (write_ts_target_option): Rename from
  lto_output_ts_target_option.
  (write_ts_translation_unit_decl_tree_pointers): Rename from
  lto_output_ts_translation_unit_decl_tree_pointers.
  * tree-streamer.c (streamer_tree_cache_add_to_node_array):
  Rename from lto_streamer_cache_add_to_node_array.
  (streamer_tree_cache_insert_1): Rename from lto_streamer_cache_insert_1.
  (record_common_node): Rename from lto_record_common_node.

* streamer-hooks.h (bitpack_d, lto_streamer_cache_d): Remove forward
declarations.
* data-streamer-in.c (lto_input_widest_uint_uleb128): Remove unused
function.
* data-streamer-out.c (lto_output_widest_uint_uleb128_stream): Remove
unused function.
* Makefile.in (lto-section-out.o): Add dependency on DATA_STREAMER_H.
(ipa-reference.o): Likewise.
* lto-section-out.c: Include data-streamer.h.
* ipa-reference.c: Include data-streamer.h.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177704 138bc75d-0d04-0410-961f-82ee72b054a4

23 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/data-streamer-in.c
gcc/data-streamer-out.c
gcc/data-streamer.h
gcc/gimple-streamer-in.c
gcc/gimple-streamer-out.c
gcc/ipa-inline-analysis.c
gcc/ipa-prop.c
gcc/ipa-pure-const.c
gcc/ipa-reference.c
gcc/lto-cgraph.c
gcc/lto-section-out.c
gcc/lto-streamer-in.c
gcc/lto-streamer-out.c
gcc/lto-streamer.c
gcc/lto-streamer.h
gcc/lto/lto.c
gcc/streamer-hooks.h
gcc/tree-streamer-in.c
gcc/tree-streamer-out.c
gcc/tree-streamer.c
gcc/tree-streamer.h

index de9fb5e66c8f2f9d49b3081c59943865f5d5cb72..7b2c447b955c9a38aaf28ab13a454925d3c2e810 100644 (file)
@@ -1,3 +1,110 @@
+2011-08-12   Diego Novillo  <dnovillo@google.com>
+
+       * data-streamer.h (streamer_write_zero): Rename from output_zero.
+       (streamer_write_uhwi): Rename from lto_output_uleb128.
+       (streamer_write_hwi): Rename from output_sleb128.
+       (streamer_write_string): Rename from lto_output_string.
+       (streamer_string_index): Rename from lto_string_index.
+       (streamer_write_string_with_length): Rename from
+       lto_output_string_with_length.
+       (streamer_write_uhwi_stream): Rename from lto_output_uleb128_stream.
+       (streamer_write_hwi_stream): Rename from lto_output_sleb128_stream.
+       (streamer_read_string): Rename from lto_input_string.
+       (streamer_read_indexed_string): Rename from input_string_internal.
+       (streamer_read_uhwi): Rename from lto_input_uleb128.
+       (streamer_read_hwi): Rename from lto_input_sleb128.
+       (streamer_write_hwi_in_range): Rename from lto_output_int_in_range.
+       (streamer_read_hwi_in_range): Rename from lto_input_int_in_range.
+       (streamer_write_enum): Rename from lto_output_enum.
+       (streamer_read_enum): Rename from lto_input_enum.
+       (streamer_write_record_start): Rename from output_record_start.
+       (streamer_read_record_start): Rename from input_record_start.
+       (streamer_write_bitpack): Rename from lto_output_bitpack.
+       (streamer_read_bitpack): Rename from lto_input_bitpack.
+       (streamer_write_char_stream): Rename from lto_output_1_stream.
+       (streamer_read_uchar): Rename from lto_input_1_unsigned.
+       * tree-streamer.h (streamer_cache_d): Rename from lto_streamer_cache_d.
+       (streamer_handle_as_builtin_p): Rename from lto_stream_as_builtin_p.
+       (streamer_read_string_cst): Rename from input_string_cst.
+       (streamer_read_chain): Rename from lto_input_chain.
+       (streamer_alloc_tree): Rename from lto_materialize_tree.
+       (streamer_read_tree_body): Rename from lto_input_tree_pointers.
+       (streamer_get_pickled_tree): Rename from lto_get_pickled_tree.
+       (streamer_get_builtin_tree): Rename from lto_get_builtin_tree.
+       (streamer_read_integer_cst): Rename from lto_input_integer_cst.
+       (streamer_read_tree_bitfields): Rename from tree_read_bitfields.
+       (streamer_write_chain): Rename from lto_output_chain.
+       (streamer_write_tree_header): Rename from lto_output_tree_header.
+       (streamer_pack_tree_bitfields): Rename from pack_value_fields.
+       (streamer_write_tree_body): Rename from lto_output_tree_pointers.
+       (streamer_write_integer_cst): Rename from lto_output_integer_cst.
+       (streamer_write_builtin): Rename from lto_output_builtin_tree.
+       (streamer_check_handled_ts_structures): Rename from
+       check_handled_ts_structures.
+       (streamer_tree_cache_insert): Rename from lto_streamer_cache_insert.
+       (streamer_tree_cache_insert_at): Rename from
+       lto_streamer_cache_insert_at.
+       (streamer_tree_cache_append): Rename from lto_streamer_cache_append.
+       (streamer_tree_cache_lookup): Rename from lto_streamer_cache_lookup.
+       (streamer_tree_cache_get): Rename from lto_streamer_cache_get.
+       (streamer_tree_cache_create): Rename from lto_streamer_cache_create.
+       (streamer_tree_cache_delete): Rename from lto_streamer_cache_delete.
+       * tree-streamer-out.c (write_string_cst): Rename from output_string_cst.
+       (write_identifier): Rename from output_identifier.
+       (write_ts_common_tree_pointers): Rename from
+       lto_output_ts_common_tree_pointers.
+       (write_ts_vector_tree_pointers): Rename from
+       lto_output_ts_vector_tree_pointers.
+       (write_ts_complex_tree_pointers): Rename from
+       lto_output_ts_complex_tree_pointers.
+       (write_ts_decl_minimal_tree_pointers): Rename from
+       lto_output_ts_decl_minimal_tree_pointers.
+       (write_ts_decl_common_tree_pointers): Rename from
+       lto_output_ts_decl_common_tree_pointers.
+       (write_ts_decl_non_common_tree_pointers): Rename from
+       lto_output_ts_decl_non_common_tree_pointers.
+       (write_ts_decl_with_vis_tree_pointers): Rename from
+       lto_output_ts_decl_with_vis_tree_pointers.
+       (write_ts_field_decl_tree_pointers): Rename from
+       lto_output_ts_field_decl_tree_pointers.
+       (write_ts_function_decl_tree_pointers): Rename from
+       lto_output_ts_function_decl_tree_pointers.
+       (write_ts_type_common_tree_pointers): Rename from
+       lto_output_ts_type_common_tree_pointers.
+       (write_ts_type_non_common_tree_pointers): Rename from
+       lto_output_ts_type_non_common_tree_pointers.
+       (write_ts_list_tree_pointers): Rename from
+       lto_output_ts_list_tree_pointers.
+       (write_ts_vec_tree_pointers): Rename from
+       lto_output_ts_vec_tree_pointers.
+       (write_ts_exp_tree_pointers): Rename from
+       lto_output_ts_exp_tree_pointers.
+       (write_ts_block_tree_pointers): Rename from
+       lto_output_ts_block_tree_pointers.
+       (write_ts_binfo_tree_pointers): Rename from
+       lto_output_ts_binfo_tree_pointers.
+       (write_ts_constructor_tree_pointers): Rename from
+       lto_output_ts_constructor_tree_pointers.
+       (write_ts_target_option): Rename from
+       lto_output_ts_target_option.
+       (write_ts_translation_unit_decl_tree_pointers): Rename from
+       lto_output_ts_translation_unit_decl_tree_pointers.
+       * tree-streamer.c (streamer_tree_cache_add_to_node_array):
+       Rename from lto_streamer_cache_add_to_node_array.
+       (streamer_tree_cache_insert_1): Rename from lto_streamer_cache_insert_1.
+       (record_common_node): Rename from lto_record_common_node.
+
+       * streamer-hooks.h (bitpack_d, lto_streamer_cache_d): Remove forward
+       declarations.
+       * data-streamer-in.c (lto_input_widest_uint_uleb128): Remove unused
+       function.
+       * data-streamer-out.c (lto_output_widest_uint_uleb128_stream): Remove
+       unused function.
+       * Makefile.in (lto-section-out.o): Add dependency on DATA_STREAMER_H.
+       (ipa-reference.o): Likewise.
+       * lto-section-out.c: Include data-streamer.h.
+       * ipa-reference.c: Include data-streamer.h.
+
 2011-08-12  Nick Clifton  <nickc@redhat.com>
 
        * builtins.c (expand_builtin_memcmp): Do not use cmpstrnsi
index d25c380aaeb893ac0261a375cce00b06af7ef593..762b72bdae9bc50baee005359764b1ae74a796c4 100644 (file)
@@ -2345,7 +2345,8 @@ lto-section-out.o : lto-section-out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
    $(TM_H) $(DIAGNOSTIC_CORE_H) $(TREE_H) $(EXPR_H) $(PARAMS_H) input.h \
    $(HASHTAB_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(TREE_PASS_H) \
    $(CGRAPH_H) $(FUNCTION_H) $(GGC_H) $(EXCEPT_H) pointer-set.h \
-   $(BITMAP_H) langhooks.h $(LTO_STREAMER_H) lto-compress.h
+   $(BITMAP_H) langhooks.h $(LTO_STREAMER_H) lto-compress.h \
+   $(DATA_STREAMER_H)
 lto-symtab.o: lto-symtab.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
    $(TREE_H) $(GIMPLE_H) $(GGC_H) $(HASHTAB_H) \
    $(LTO_STREAMER_H) $(LINKER_PLUGIN_API_H) gt-lto-symtab.h
@@ -3079,7 +3080,8 @@ ipa-reference.o : ipa-reference.c $(CONFIG_H) $(SYSTEM_H) \
    coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \
    pointer-set.h $(GGC_H) $(IPA_REFERENCE_H) $(IPA_UTILS_H) $(SPLAY_TREE_H) \
    $(GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) $(TREE_PASS_H) \
-   $(TIMEVAR_H) $(DIAGNOSTIC_H) $(FUNCTION_H) $(LTO_STREAMER_H) $(DIAGNOSTIC_CORE_H)
+   $(TIMEVAR_H) $(DIAGNOSTIC_H) $(FUNCTION_H) $(LTO_STREAMER_H) \
+   $(DIAGNOSTIC_CORE_H) $(DATA_STREAMER_H)
 ipa-pure-const.o : ipa-pure-const.c $(CONFIG_H) $(SYSTEM_H) \
    coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \
    pointer-set.h $(GGC_H) $(IPA_UTILS_H) $(TARGET_H) \
index 5e366b11f1a1f8ea58abf7a28bea703753362ac9..72fce0598a7e04ad9c90b0baeacc5759238fc862 100644 (file)
@@ -45,7 +45,7 @@ string_for_index (struct data_in *data_in, unsigned int loc, unsigned int *rlen)
   /* Get the string stored at location LOC in DATA_IN->STRINGS.  */
   LTO_INIT_INPUT_BLOCK (str_tab, data_in->strings, loc - 1,
                        data_in->strings_len);
-  len = lto_input_uleb128 (&str_tab);
+  len = streamer_read_uhwi (&str_tab);
   *rlen = len;
 
   if (str_tab.p + len > data_in->strings_len)
@@ -61,22 +61,22 @@ string_for_index (struct data_in *data_in, unsigned int loc, unsigned int *rlen)
    IB.  Write the length to RLEN.  */
 
 const char *
-input_string_internal (struct data_in *data_in, struct lto_input_block *ib,
-                      unsigned int *rlen)
+streamer_read_indexed_string (struct data_in *data_in,
+                             struct lto_input_block *ib, unsigned int *rlen)
 {
-  return string_for_index (data_in, lto_input_uleb128 (ib), rlen);
+  return string_for_index (data_in, streamer_read_uhwi (ib), rlen);
 }
 
 
 /* Read a NULL terminated string from the string table in DATA_IN.  */
 
 const char *
-lto_input_string (struct data_in *data_in, struct lto_input_block *ib)
+streamer_read_string (struct data_in *data_in, struct lto_input_block *ib)
 {
   unsigned int len;
   const char *ptr;
 
-  ptr = input_string_internal (data_in, ib, &len);
+  ptr = streamer_read_indexed_string (data_in, ib, &len);
   if (!ptr)
     return NULL;
   if (ptr[len - 1] != '\0')
@@ -86,10 +86,10 @@ lto_input_string (struct data_in *data_in, struct lto_input_block *ib)
 }
 
 
-/* Read an ULEB128 Number of IB.  */
+/* Read an unsigned HOST_WIDE_INT number from IB.  */
 
 unsigned HOST_WIDE_INT
-lto_input_uleb128 (struct lto_input_block *ib)
+streamer_read_uhwi (struct lto_input_block *ib)
 {
   unsigned HOST_WIDE_INT result = 0;
   int shift = 0;
@@ -97,7 +97,7 @@ lto_input_uleb128 (struct lto_input_block *ib)
 
   while (true)
     {
-      byte = lto_input_1_unsigned (ib);
+      byte = streamer_read_uchar (ib);
       result |= (byte & 0x7f) << shift;
       shift += 7;
       if ((byte & 0x80) == 0)
@@ -106,31 +106,10 @@ lto_input_uleb128 (struct lto_input_block *ib)
 }
 
 
-/* HOST_WIDEST_INT version of lto_input_uleb128.  IB is as in
-   lto_input_uleb128.  */
-
-unsigned HOST_WIDEST_INT
-lto_input_widest_uint_uleb128 (struct lto_input_block *ib)
-{
-  unsigned HOST_WIDEST_INT result = 0;
-  int shift = 0;
-  unsigned HOST_WIDEST_INT byte;
-
-  while (true)
-    {
-      byte = lto_input_1_unsigned (ib);
-      result |= (byte & 0x7f) << shift;
-      shift += 7;
-      if ((byte & 0x80) == 0)
-       return result;
-    }
-}
-
-
-/* Read an SLEB128 Number of IB.  */
+/* Read a HOST_WIDE_INT number from IB.  */
 
 HOST_WIDE_INT
-lto_input_sleb128 (struct lto_input_block *ib)
+streamer_read_hwi (struct lto_input_block *ib)
 {
   HOST_WIDE_INT result = 0;
   int shift = 0;
@@ -138,7 +117,7 @@ lto_input_sleb128 (struct lto_input_block *ib)
 
   while (true)
     {
-      byte = lto_input_1_unsigned (ib);
+      byte = streamer_read_uchar (ib);
       result |= (byte & 0x7f) << shift;
       shift += 7;
       if ((byte & 0x80) == 0)
index 07d5b35fba31487bc1a9effd12f2f9a6f97a44bb..98cbf22617638fb9dfbc5e81ad6ea8c7c4ea1a70 100644 (file)
@@ -32,8 +32,8 @@ along with GCC; see the file COPYING3.  If not see
    duration of the OB and thus OB can keep pointer into it.  */
 
 unsigned
-lto_string_index (struct output_block *ob, const char *s, unsigned int len,
-                 bool persistent)
+streamer_string_index (struct output_block *ob, const char *s, unsigned int len,
+                      bool persistent)
 {
   struct string_slot **slot;
   struct string_slot s_slot;
@@ -64,7 +64,7 @@ lto_string_index (struct output_block *ob, const char *s, unsigned int len,
       new_slot->len = len;
       new_slot->slot_num = start;
       *slot = new_slot;
-      lto_output_uleb128_stream (string_stream, len);
+      streamer_write_uhwi_stream (string_stream, len);
       lto_output_data_stream (string_stream, string, len);
       return start + 1;
     }
@@ -83,15 +83,16 @@ lto_string_index (struct output_block *ob, const char *s, unsigned int len,
    duration of the OB and thus OB can keep pointer into it.  */
 
 void
-lto_output_string_with_length (struct output_block *ob,
-                              struct lto_output_stream *index_stream,
-                              const char *s, unsigned int len, bool persistent)
+streamer_write_string_with_length (struct output_block *ob,
+                                  struct lto_output_stream *index_stream,
+                                  const char *s, unsigned int len,
+                                  bool persistent)
 {
   if (s)
-    lto_output_uleb128_stream (index_stream,
-                              lto_string_index (ob, s, len, persistent));
+    streamer_write_uhwi_stream (index_stream,
+                               streamer_string_index (ob, s, len, persistent));
   else
-    lto_output_1_stream (index_stream, 0);
+    streamer_write_char_stream (index_stream, 0);
 }
 
 
@@ -101,51 +102,51 @@ lto_output_string_with_length (struct output_block *ob,
    duration of the OB and thus OB can keep pointer into it.  */
 
 void
-lto_output_string (struct output_block *ob,
-                  struct lto_output_stream *index_stream,
-                  const char *string, bool persistent)
+streamer_write_string (struct output_block *ob,
+                      struct lto_output_stream *index_stream,
+                      const char *string, bool persistent)
 {
   if (string)
-    lto_output_string_with_length (ob, index_stream, string,
-                                  strlen (string) + 1,
-                                  persistent);
+    streamer_write_string_with_length (ob, index_stream, string,
+                                      strlen (string) + 1,
+                                      persistent);
   else
-    lto_output_1_stream (index_stream, 0);
+    streamer_write_char_stream (index_stream, 0);
 }
 
 
 /* Write a zero to the output stream.  */
 
 void
-output_zero (struct output_block *ob)
+streamer_write_zero (struct output_block *ob)
 {
-  lto_output_1_stream (ob->main_stream, 0);
+  streamer_write_char_stream (ob->main_stream, 0);
 }
 
 
-/* Output an unsigned LEB128 quantity to OB->main_stream.  */
+/* Write an unsigned HOST_WIDE_INT value WORK to OB->main_stream.  */
 
 void
-output_uleb128 (struct output_block *ob, unsigned HOST_WIDE_INT work)
+streamer_write_uhwi (struct output_block *ob, unsigned HOST_WIDE_INT work)
 {
-  lto_output_uleb128_stream (ob->main_stream, work);
+  streamer_write_uhwi_stream (ob->main_stream, work);
 }
 
 
-/* Output a signed LEB128 quantity to OB->main_stream.  */
+/* Write a HOST_WIDE_INT value WORK to OB->main_stream.  */
 
 void
-output_sleb128 (struct output_block *ob, HOST_WIDE_INT work)
+streamer_write_hwi (struct output_block *ob, HOST_WIDE_INT work)
 {
-  lto_output_sleb128_stream (ob->main_stream, work);
+  streamer_write_hwi_stream (ob->main_stream, work);
 }
 
 
-/* Output an unsigned LEB128 quantity to OBS.  */
+/* Write an unsigned HOST_WIDE_INT value WORK to OBS.  */
 
 void
-lto_output_uleb128_stream (struct lto_output_stream *obs,
-                          unsigned HOST_WIDE_INT work)
+streamer_write_uhwi_stream (struct lto_output_stream *obs,
+                            unsigned HOST_WIDE_INT work)
 {
   do
     {
@@ -155,39 +156,16 @@ lto_output_uleb128_stream (struct lto_output_stream *obs,
        /* More bytes to follow.  */
        byte |= 0x80;
 
-      lto_output_1_stream (obs, byte);
+      streamer_write_char_stream (obs, byte);
     }
   while (work != 0);
 }
 
 
-/* Identical to output_uleb128_stream above except using unsigned
-   HOST_WIDEST_INT type.  For efficiency on host where unsigned HOST_WIDEST_INT
-   is not native, we only use this if we know that HOST_WIDE_INT is not wide
-   enough.  */
+/* Write a HOST_WIDE_INT value WORK to OBS.  */
 
 void
-lto_output_widest_uint_uleb128_stream (struct lto_output_stream *obs,
-                                      unsigned HOST_WIDEST_INT work)
-{
-  do
-    {
-      unsigned int byte = (work & 0x7f);
-      work >>= 7;
-      if (work != 0)
-       /* More bytes to follow.  */
-       byte |= 0x80;
-
-      lto_output_1_stream (obs, byte);
-    }
-  while (work != 0);
-}
-
-
-/* Output a signed LEB128 quantity.  */
-
-void
-lto_output_sleb128_stream (struct lto_output_stream *obs, HOST_WIDE_INT work)
+streamer_write_hwi_stream (struct lto_output_stream *obs, HOST_WIDE_INT work)
 {
   int more, byte;
 
@@ -201,7 +179,7 @@ lto_output_sleb128_stream (struct lto_output_stream *obs, HOST_WIDE_INT work)
       if (more)
        byte |= 0x80;
 
-      lto_output_1_stream (obs, byte);
+      streamer_write_char_stream (obs, byte);
     }
   while (more);
 }
index c2f6fa81fb545ea2669e14839063dfaefd35c96e..c413a75930f54c490e56db5cc9ce23c27088f17e 100644 (file)
@@ -55,6 +55,35 @@ struct string_slot
   unsigned int slot_num;
 };
 
+/* In data-streamer.c  */
+void bp_pack_var_len_unsigned (struct bitpack_d *, unsigned HOST_WIDE_INT);
+void bp_pack_var_len_int (struct bitpack_d *, HOST_WIDE_INT);
+unsigned HOST_WIDE_INT bp_unpack_var_len_unsigned (struct bitpack_d *);
+HOST_WIDE_INT bp_unpack_var_len_int (struct bitpack_d *);
+
+/* In data-streamer-out.c  */
+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_string (struct output_block *, struct lto_output_stream *,
+                           const char *, bool);
+unsigned streamer_string_index (struct output_block *, const char *,
+                               unsigned int, bool);
+void streamer_write_string_with_length (struct output_block *,
+                                       struct lto_output_stream *,
+                                       const char *, unsigned int, bool);
+void streamer_write_uhwi_stream (struct lto_output_stream *,
+                                unsigned HOST_WIDE_INT);
+void streamer_write_hwi_stream (struct lto_output_stream *, HOST_WIDE_INT);
+
+/* In data-streamer-in.c  */
+const char *string_for_index (struct data_in *, unsigned int, unsigned int *);
+const char *streamer_read_string (struct data_in *, struct lto_input_block *);
+const char *streamer_read_indexed_string (struct data_in *,
+                                         struct lto_input_block *,
+                                         unsigned int *);
+unsigned HOST_WIDE_INT streamer_read_uhwi (struct lto_input_block *);
+HOST_WIDE_INT streamer_read_hwi (struct lto_input_block *);
 
 /* Returns a hash code for P.  Adapted from libiberty's htab_hash_string
    to support strings that may not end in '\0'.  */
@@ -111,7 +140,8 @@ bp_pack_value (struct bitpack_d *bp, bitpack_word_t val, unsigned nbits)
      next one.  */
   if (pos + nbits > BITS_PER_BITPACK_WORD)
     {
-      lto_output_uleb128_stream ((struct lto_output_stream *) bp->stream, word);
+      streamer_write_uhwi_stream ((struct lto_output_stream *) bp->stream,
+                                 word);
       word = val;
       pos = nbits;
     }
@@ -126,20 +156,20 @@ bp_pack_value (struct bitpack_d *bp, bitpack_word_t val, unsigned nbits)
 
 /* Finishes bit-packing of BP.  */
 static inline void
-lto_output_bitpack (struct bitpack_d *bp)
+streamer_write_bitpack (struct bitpack_d *bp)
 {
-  lto_output_uleb128_stream ((struct lto_output_stream *) bp->stream,
-                            bp->word);
+  streamer_write_uhwi_stream ((struct lto_output_stream *) bp->stream,
+                             bp->word);
   bp->word = 0;
   bp->pos = 0;
 }
 
 /* Returns a new bit-packing context for bit-unpacking from IB.  */
 static inline struct bitpack_d
-lto_input_bitpack (struct lto_input_block *ib)
+streamer_read_bitpack (struct lto_input_block *ib)
 {
   struct bitpack_d bp;
-  bp.word = lto_input_uleb128 (ib);
+  bp.word = streamer_read_uhwi (ib);
   bp.pos = 0;
   bp.stream = (void *)ib;
   return bp;
@@ -160,7 +190,8 @@ bp_unpack_value (struct bitpack_d *bp, unsigned nbits)
      switch to the next one.  */
   if (pos + nbits > BITS_PER_BITPACK_WORD)
     {
-      bp->word = val = lto_input_uleb128 ((struct lto_input_block *)bp->stream);
+      bp->word = val 
+       = streamer_read_uhwi ((struct lto_input_block *)bp->stream);
       bp->pos = nbits;
       return val & mask;
     }
@@ -175,7 +206,7 @@ bp_unpack_value (struct bitpack_d *bp, unsigned nbits)
 /* Write a character to the output block.  */
 
 static inline void
-lto_output_1_stream (struct lto_output_stream *obs, char c)
+streamer_write_char_stream (struct lto_output_stream *obs, char c)
 {
   /* No space left.  */
   if (obs->left_in_block == 0)
@@ -192,7 +223,7 @@ lto_output_1_stream (struct lto_output_stream *obs, char c)
 /* Read byte from the input block.  */
 
 static inline unsigned char
-lto_input_1_unsigned (struct lto_input_block *ib)
+streamer_read_uchar (struct lto_input_block *ib)
 {
   if (ib->p >= ib->len)
     lto_section_overrun (ib);
@@ -204,10 +235,10 @@ lto_input_1_unsigned (struct lto_input_block *ib)
    Be host independent, limit range to 31bits.  */
 
 static inline void
-lto_output_int_in_range (struct lto_output_stream *obs,
-                        HOST_WIDE_INT min,
-                        HOST_WIDE_INT max,
-                        HOST_WIDE_INT val)
+streamer_write_hwi_in_range (struct lto_output_stream *obs,
+                                 HOST_WIDE_INT min,
+                                 HOST_WIDE_INT max,
+                                 HOST_WIDE_INT val)
 {
   HOST_WIDE_INT range = max - min;
 
@@ -215,35 +246,35 @@ lto_output_int_in_range (struct lto_output_stream *obs,
                       && range < 0x7fffffff);
 
   val -= min;
-  lto_output_1_stream (obs, val & 255);
+  streamer_write_char_stream (obs, val & 255);
   if (range >= 0xff)
-    lto_output_1_stream (obs, (val >> 8) & 255);
+    streamer_write_char_stream (obs, (val >> 8) & 255);
   if (range >= 0xffff)
-    lto_output_1_stream (obs, (val >> 16) & 255);
+    streamer_write_char_stream (obs, (val >> 16) & 255);
   if (range >= 0xffffff)
-    lto_output_1_stream (obs, (val >> 24) & 255);
+    streamer_write_char_stream (obs, (val >> 24) & 255);
 }
 
 /* Input VAL into OBS and verify it is in range MIN...MAX that is supposed
    to be compile time constant.  PURPOSE is used for error reporting.  */
 
 static inline HOST_WIDE_INT
-lto_input_int_in_range (struct lto_input_block *ib,
-                       const char *purpose,
-                       HOST_WIDE_INT min,
-                       HOST_WIDE_INT max)
+streamer_read_hwi_in_range (struct lto_input_block *ib,
+                                const char *purpose,
+                                HOST_WIDE_INT min,
+                                HOST_WIDE_INT max)
 {
   HOST_WIDE_INT range = max - min;
-  HOST_WIDE_INT val = lto_input_1_unsigned (ib);
+  HOST_WIDE_INT val = streamer_read_uchar (ib);
 
   gcc_checking_assert (range > 0 && range < 0x7fffffff);
 
   if (range >= 0xff)
-    val |= ((HOST_WIDE_INT)lto_input_1_unsigned (ib)) << 8;
+    val |= ((HOST_WIDE_INT)streamer_read_uchar (ib)) << 8;
   if (range >= 0xffff)
-    val |= ((HOST_WIDE_INT)lto_input_1_unsigned (ib)) << 16;
+    val |= ((HOST_WIDE_INT)streamer_read_uchar (ib)) << 16;
   if (range >= 0xffffff)
-    val |= ((HOST_WIDE_INT)lto_input_1_unsigned (ib)) << 24;
+    val |= ((HOST_WIDE_INT)streamer_read_uchar (ib)) << 24;
   val += min;
   if (val < min || val > max)
     lto_value_range_error (purpose, val, min, max);
@@ -292,14 +323,14 @@ bp_unpack_int_in_range (struct bitpack_d *bp,
 
 /* Output VAL of type "enum enum_name" into OBS.
    Assume range 0...ENUM_LAST - 1.  */
-#define lto_output_enum(obs,enum_name,enum_last,val) \
-  lto_output_int_in_range ((obs), 0, (int)(enum_last) - 1, (int)(val))
+#define streamer_write_enum(obs,enum_name,enum_last,val) \
+  streamer_write_hwi_in_range ((obs), 0, (int)(enum_last) - 1, (int)(val))
 
 /* Input enum of type "enum enum_name" from IB.
    Assume range 0...ENUM_LAST - 1.  */
-#define lto_input_enum(ib,enum_name,enum_last) \
-  (enum enum_name)lto_input_int_in_range ((ib), #enum_name, 0, \
-                                         (int)(enum_last) - 1)
+#define streamer_read_enum(ib,enum_name,enum_last) \
+  (enum enum_name)streamer_read_hwi_in_range ((ib), #enum_name, 0, \
+                                             (int)(enum_last) - 1)
 
 /* Output VAL of type "enum enum_name" into BP.
    Assume range 0...ENUM_LAST - 1.  */
@@ -315,41 +346,17 @@ bp_unpack_int_in_range (struct bitpack_d *bp,
 /* Output the start of a record with TAG to output block OB.  */
 
 static inline void
-output_record_start (struct output_block *ob, enum LTO_tags tag)
+streamer_write_record_start (struct output_block *ob, enum LTO_tags tag)
 {
-  lto_output_enum (ob->main_stream, LTO_tags, LTO_NUM_TAGS, tag);
+  streamer_write_enum (ob->main_stream, LTO_tags, LTO_NUM_TAGS, tag);
 }
 
 /* Return the next tag in the input block IB.  */
 
 static inline enum LTO_tags
-input_record_start (struct lto_input_block *ib)
+streamer_read_record_start (struct lto_input_block *ib)
 {
-  return lto_input_enum (ib, LTO_tags, LTO_NUM_TAGS);
+  return streamer_read_enum (ib, LTO_tags, LTO_NUM_TAGS);
 }
 
-/* In data-streamer.c  */
-void bp_pack_var_len_unsigned (struct bitpack_d *, unsigned HOST_WIDE_INT);
-void bp_pack_var_len_int (struct bitpack_d *, HOST_WIDE_INT);
-unsigned HOST_WIDE_INT bp_unpack_var_len_unsigned (struct bitpack_d *);
-HOST_WIDE_INT bp_unpack_var_len_int (struct bitpack_d *);
-
-/* In data-streamer-out.c  */
-void output_zero (struct output_block *);
-void output_uleb128 (struct output_block *, unsigned HOST_WIDE_INT);
-void output_sleb128 (struct output_block *, HOST_WIDE_INT);
-void lto_output_string (struct output_block *, struct lto_output_stream *,
-                       const char *, bool);
-unsigned lto_string_index (struct output_block *, const char *, unsigned int,
-                          bool);
-void lto_output_string_with_length (struct output_block *,
-                                   struct lto_output_stream *,
-                                   const char *, unsigned int, bool);
-const char *input_string_internal (struct data_in *, struct lto_input_block *,
-                                  unsigned int *);
-
-/* In data-streamer-in.c  */
-const char *string_for_index (struct data_in *, unsigned int, unsigned int *);
-const char *lto_input_string (struct data_in *, struct lto_input_block *);
-
 #endif  /* GCC_DATA_STREAMER_H  */
index 78ab729062b6c59d21925d4392255e1153fbc0e2..fc6ceb43aa1b9956a01012a3361f29ad228472dd 100644 (file)
@@ -41,7 +41,7 @@ input_phi (struct lto_input_block *ib, basic_block bb, struct data_in *data_in,
   int i, len;
   gimple result;
 
-  ix = lto_input_uleb128 (ib);
+  ix = streamer_read_uhwi (ib);
   phi_result = VEC_index (tree, SSANAMES (fn), ix);
   len = EDGE_COUNT (bb->preds);
   result = create_phi_node (phi_result, bb);
@@ -53,7 +53,7 @@ input_phi (struct lto_input_block *ib, basic_block bb, struct data_in *data_in,
   for (i = 0; i < len; i++)
     {
       tree def = stream_read_tree (ib, data_in);
-      int src_index = lto_input_uleb128 (ib);
+      int src_index = streamer_read_uhwi (ib);
       location_t arg_loc = lto_input_location (ib, data_in);
       basic_block sbb = BASIC_BLOCK_FOR_FUNCTION (fn, src_index);
 
@@ -90,7 +90,7 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
   code = lto_tag_to_gimple_code (tag);
 
   /* Read the tuple header.  */
-  bp = lto_input_bitpack (ib);
+  bp = streamer_read_bitpack (ib);
   num_ops = bp_unpack_var_len_unsigned (&bp);
   stmt = gimple_alloc (code, num_ops);
   stmt->gsbase.no_warning = bp_unpack_value (&bp, 1);
@@ -109,7 +109,7 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
   switch (code)
     {
     case GIMPLE_RESX:
-      gimple_resx_set_region (stmt, lto_input_sleb128 (ib));
+      gimple_resx_set_region (stmt, streamer_read_hwi (ib));
       break;
 
     case GIMPLE_EH_MUST_NOT_THROW:
@@ -117,18 +117,18 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
       break;
 
     case GIMPLE_EH_DISPATCH:
-      gimple_eh_dispatch_set_region (stmt, lto_input_sleb128 (ib));
+      gimple_eh_dispatch_set_region (stmt, streamer_read_hwi (ib));
       break;
 
     case GIMPLE_ASM:
       {
        /* FIXME lto.  Move most of this into a new gimple_asm_set_string().  */
        tree str;
-       stmt->gimple_asm.ni = lto_input_uleb128 (ib);
-       stmt->gimple_asm.no = lto_input_uleb128 (ib);
-       stmt->gimple_asm.nc = lto_input_uleb128 (ib);
-       stmt->gimple_asm.nl = lto_input_uleb128 (ib);
-       str = input_string_cst (data_in, ib);
+       stmt->gimple_asm.ni = streamer_read_uhwi (ib);
+       stmt->gimple_asm.no = streamer_read_uhwi (ib);
+       stmt->gimple_asm.nc = streamer_read_uhwi (ib);
+       stmt->gimple_asm.nl = streamer_read_uhwi (ib);
+       str = streamer_read_string_cst (data_in, ib);
        stmt->gimple_asm.string = TREE_STRING_POINTER (str);
       }
       /* Fallthru  */
@@ -221,7 +221,7 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
        {
          if (gimple_call_internal_p (stmt))
            gimple_call_set_internal_fn
-             (stmt, lto_input_enum (ib, internal_fn, IFN_LAST));
+             (stmt, streamer_read_enum (ib, internal_fn, IFN_LAST));
          else
            gimple_call_set_fntype (stmt, stream_read_tree (ib, data_in));
        }
@@ -286,21 +286,21 @@ input_bb (struct lto_input_block *ib, enum LTO_tags tag,
      basic GIMPLE routines that use CFUN.  */
   gcc_assert (cfun == fn);
 
-  index = lto_input_uleb128 (ib);
+  index = streamer_read_uhwi (ib);
   bb = BASIC_BLOCK_FOR_FUNCTION (fn, index);
 
-  bb->count = (lto_input_sleb128 (ib) * count_materialization_scale
+  bb->count = (streamer_read_hwi (ib) * count_materialization_scale
               + REG_BR_PROB_BASE / 2) / REG_BR_PROB_BASE;
-  bb->loop_depth = lto_input_sleb128 (ib);
-  bb->frequency = lto_input_sleb128 (ib);
-  bb->flags = lto_input_sleb128 (ib);
+  bb->loop_depth = streamer_read_hwi (ib);
+  bb->frequency = streamer_read_hwi (ib);
+  bb->flags = streamer_read_hwi (ib);
 
   /* LTO_bb1 has statements.  LTO_bb0 does not.  */
   if (tag == LTO_bb0)
     return;
 
   bsi = gsi_start_bb (bb);
-  tag = input_record_start (ib);
+  tag = streamer_read_record_start (ib);
   while (tag)
     {
       gimple stmt = input_gimple_stmt (ib, data_in, fn, tag);
@@ -310,24 +310,24 @@ input_bb (struct lto_input_block *ib, enum LTO_tags tag,
 
       /* After the statement, expect a 0 delimiter or the EH region
         that the previous statement belongs to.  */
-      tag = input_record_start (ib);
+      tag = streamer_read_record_start (ib);
       lto_tag_check_set (tag, 2, LTO_eh_region, LTO_null);
 
       if (tag == LTO_eh_region)
        {
-         HOST_WIDE_INT region = lto_input_sleb128 (ib);
+         HOST_WIDE_INT region = streamer_read_hwi (ib);
          gcc_assert (region == (int) region);
          add_stmt_to_eh_lp (stmt, region);
        }
 
-      tag = input_record_start (ib);
+      tag = streamer_read_record_start (ib);
     }
 
-  tag = input_record_start (ib);
+  tag = streamer_read_record_start (ib);
   while (tag)
     {
       gimple phi = input_phi (ib, bb, data_in, fn);
       find_referenced_vars_in (phi);
-      tag = input_record_start (ib);
+      tag = streamer_read_record_start (ib);
     }
 }
index 233862c96ace2589bc097f4ae6ad231466089169..78ed2815dde28855254339049e0c0384b464e71c 100644 (file)
@@ -36,13 +36,13 @@ output_phi (struct output_block *ob, gimple phi)
 {
   unsigned i, len = gimple_phi_num_args (phi);
 
-  output_record_start (ob, lto_gimple_code_to_tag (GIMPLE_PHI));
-  output_uleb128 (ob, SSA_NAME_VERSION (PHI_RESULT (phi)));
+  streamer_write_record_start (ob, lto_gimple_code_to_tag (GIMPLE_PHI));
+  streamer_write_uhwi (ob, SSA_NAME_VERSION (PHI_RESULT (phi)));
 
   for (i = 0; i < len; i++)
     {
       stream_write_tree (ob, gimple_phi_arg_def (phi, i), true);
-      output_uleb128 (ob, gimple_phi_arg_edge (phi, i)->src->index);
+      streamer_write_uhwi (ob, gimple_phi_arg_edge (phi, i)->src->index);
       lto_output_location (ob, gimple_phi_arg_location (phi, i));
     }
 }
@@ -61,7 +61,7 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
   /* Emit identifying tag.  */
   code = gimple_code (stmt);
   tag = lto_gimple_code_to_tag (code);
-  output_record_start (ob, tag);
+  streamer_write_record_start (ob, tag);
 
   /* Emit the tuple header.  */
   bp = bitpack_create (ob->main_stream);
@@ -71,7 +71,7 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
     bp_pack_value (&bp, gimple_assign_nontemporal_move_p (stmt), 1);
   bp_pack_value (&bp, gimple_has_volatile_ops (stmt), 1);
   bp_pack_var_len_unsigned (&bp, stmt->gsbase.subcode);
-  lto_output_bitpack (&bp);
+  streamer_write_bitpack (&bp);
 
   /* Emit location information for the statement.  */
   lto_output_location (ob, gimple_location (stmt));
@@ -83,7 +83,7 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
   switch (gimple_code (stmt))
     {
     case GIMPLE_RESX:
-      output_sleb128 (ob, gimple_resx_region (stmt));
+      streamer_write_hwi (ob, gimple_resx_region (stmt));
       break;
 
     case GIMPLE_EH_MUST_NOT_THROW:
@@ -91,15 +91,16 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
       break;
 
     case GIMPLE_EH_DISPATCH:
-      output_sleb128 (ob, gimple_eh_dispatch_region (stmt));
+      streamer_write_hwi (ob, gimple_eh_dispatch_region (stmt));
       break;
 
     case GIMPLE_ASM:
-      lto_output_uleb128_stream (ob->main_stream, gimple_asm_ninputs (stmt));
-      lto_output_uleb128_stream (ob->main_stream, gimple_asm_noutputs (stmt));
-      lto_output_uleb128_stream (ob->main_stream, gimple_asm_nclobbers (stmt));
-      lto_output_uleb128_stream (ob->main_stream, gimple_asm_nlabels (stmt));
-      lto_output_string (ob, ob->main_stream, gimple_asm_string (stmt), true);
+      streamer_write_uhwi (ob, gimple_asm_ninputs (stmt));
+      streamer_write_uhwi (ob, gimple_asm_noutputs (stmt));
+      streamer_write_uhwi (ob, gimple_asm_nclobbers (stmt));
+      streamer_write_uhwi (ob, gimple_asm_nlabels (stmt));
+      streamer_write_string (ob, ob->main_stream, gimple_asm_string (stmt),
+                            true);
       /* Fallthru  */
 
     case GIMPLE_ASSIGN:
@@ -139,8 +140,8 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
       if (is_gimple_call (stmt))
        {
          if (gimple_call_internal_p (stmt))
-           lto_output_enum (ob->main_stream, internal_fn,
-                            IFN_LAST, gimple_call_internal_fn (stmt));
+           streamer_write_enum (ob->main_stream, internal_fn,
+                                IFN_LAST, gimple_call_internal_fn (stmt));
          else
            stream_write_tree (ob, gimple_call_fntype (stmt), true);
        }
@@ -163,16 +164,16 @@ output_bb (struct output_block *ob, basic_block bb, struct function *fn)
 {
   gimple_stmt_iterator bsi = gsi_start_bb (bb);
 
-  output_record_start (ob,
-                      (!gsi_end_p (bsi)) || phi_nodes (bb)
-                       ? LTO_bb1
-                       : LTO_bb0);
+  streamer_write_record_start (ob,
+                              (!gsi_end_p (bsi)) || phi_nodes (bb)
+                               ? LTO_bb1
+                               : LTO_bb0);
 
-  output_uleb128 (ob, bb->index);
-  output_sleb128 (ob, bb->count);
-  output_sleb128 (ob, bb->loop_depth);
-  output_sleb128 (ob, bb->frequency);
-  output_sleb128 (ob, bb->flags);
+  streamer_write_uhwi (ob, bb->index);
+  streamer_write_hwi (ob, bb->count);
+  streamer_write_hwi (ob, bb->loop_depth);
+  streamer_write_hwi (ob, bb->frequency);
+  streamer_write_hwi (ob, bb->flags);
 
   if (!gsi_end_p (bsi) || phi_nodes (bb))
     {
@@ -189,14 +190,14 @@ output_bb (struct output_block *ob, basic_block bb, struct function *fn)
          region = lookup_stmt_eh_lp_fn (fn, stmt);
          if (region != 0)
            {
-             output_record_start (ob, LTO_eh_region);
-             output_sleb128 (ob, region);
+             streamer_write_record_start (ob, LTO_eh_region);
+             streamer_write_hwi (ob, region);
            }
          else
-           output_record_start (ob, LTO_null);
+           streamer_write_record_start (ob, LTO_null);
        }
 
-      output_record_start (ob, LTO_null);
+      streamer_write_record_start (ob, LTO_null);
 
       for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
        {
@@ -209,6 +210,6 @@ output_bb (struct output_block *ob, basic_block bb, struct function *fn)
            output_phi (ob, phi);
        }
 
-      output_record_start (ob, LTO_null);
+      streamer_write_record_start (ob, LTO_null);
     }
 }
index f3214e2caea2f5a06e6116228e4b31ce2d5e7c4d..c0eacbb62fde50b7a32e8e3054b2a823084e2ef0 100644 (file)
@@ -2326,7 +2326,7 @@ read_predicate (struct lto_input_block *ib)
   do 
     {
       gcc_assert (k <= MAX_CLAUSES);
-      clause = out.clause[k++] = lto_input_uleb128 (ib);
+      clause = out.clause[k++] = streamer_read_uhwi (ib);
     }
   while (clause);
 
@@ -2346,9 +2346,9 @@ read_inline_edge_summary (struct lto_input_block *ib, struct cgraph_edge *e)
   struct inline_edge_summary *es = inline_edge_summary (e);
   struct predicate p;
 
-  es->call_stmt_size = lto_input_uleb128 (ib);
-  es->call_stmt_time = lto_input_uleb128 (ib);
-  es->loop_depth = lto_input_uleb128 (ib);
+  es->call_stmt_size = streamer_read_uhwi (ib);
+  es->call_stmt_time = streamer_read_uhwi (ib);
+  es->loop_depth = streamer_read_uhwi (ib);
   p = read_predicate (ib);
   edge_set_predicate (e, &p);
 }
@@ -2376,7 +2376,7 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
   data_in =
     lto_data_in_create (file_data, (const char *) data + string_offset,
                        header->string_size, NULL);
-  f_count = lto_input_uleb128 (&ib);
+  f_count = streamer_read_uhwi (&ib);
   for (i = 0; i < f_count; i++)
     {
       unsigned int index;
@@ -2386,38 +2386,38 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
       struct bitpack_d bp;
       struct cgraph_edge *e;
 
-      index = lto_input_uleb128 (&ib);
+      index = streamer_read_uhwi (&ib);
       encoder = file_data->cgraph_node_encoder;
       node = lto_cgraph_encoder_deref (encoder, index);
       info = inline_summary (node);
 
       info->estimated_stack_size
-       = info->estimated_self_stack_size = lto_input_uleb128 (&ib);
-      info->size = info->self_size = lto_input_uleb128 (&ib);
-      info->time = info->self_time = lto_input_uleb128 (&ib);
+       = info->estimated_self_stack_size = streamer_read_uhwi (&ib);
+      info->size = info->self_size = streamer_read_uhwi (&ib);
+      info->time = info->self_time = streamer_read_uhwi (&ib);
 
-      bp = lto_input_bitpack (&ib);
+      bp = streamer_read_bitpack (&ib);
       info->inlinable = bp_unpack_value (&bp, 1);
       info->versionable = bp_unpack_value (&bp, 1);
 
-      count2 = lto_input_uleb128 (&ib);
+      count2 = streamer_read_uhwi (&ib);
       gcc_assert (!info->conds);
       for (j = 0; j < count2; j++)
        {
          struct condition c;
-         c.operand_num = lto_input_uleb128 (&ib);
-         c.code = (enum tree_code) lto_input_uleb128 (&ib);
+         c.operand_num = streamer_read_uhwi (&ib);
+         c.code = (enum tree_code) streamer_read_uhwi (&ib);
          c.val = stream_read_tree (&ib, data_in);
          VEC_safe_push (condition, gc, info->conds, &c);
        }
-      count2 = lto_input_uleb128 (&ib);
+      count2 = streamer_read_uhwi (&ib);
       gcc_assert (!info->entry);
       for (j = 0; j < count2; j++)
        {
          struct size_time_entry e;
 
-         e.size = lto_input_uleb128 (&ib);
-         e.time = lto_input_uleb128 (&ib);
+         e.size = streamer_read_uhwi (&ib);
+         e.time = streamer_read_uhwi (&ib);
          e.predicate = read_predicate (&ib);
 
          VEC_safe_push (size_time_entry, gc, info->entry, &e);
@@ -2480,10 +2480,9 @@ write_predicate (struct output_block *ob, struct predicate *p)
     for (j = 0; p->clause[j]; j++)
       {
         gcc_assert (j < MAX_CLAUSES);
-        lto_output_uleb128_stream (ob->main_stream,
-                                   p->clause[j]);
+        streamer_write_uhwi (ob, p->clause[j]);
       }
-  lto_output_uleb128_stream (ob->main_stream, 0);
+  streamer_write_uhwi (ob, 0);
 }
 
 
@@ -2493,9 +2492,9 @@ static void
 write_inline_edge_summary (struct output_block *ob, struct cgraph_edge *e)
 {
   struct inline_edge_summary *es = inline_edge_summary (e);
-  lto_output_uleb128_stream (ob->main_stream, es->call_stmt_size);
-  lto_output_uleb128_stream (ob->main_stream, es->call_stmt_time);
-  lto_output_uleb128_stream (ob->main_stream, es->loop_depth);
+  streamer_write_uhwi (ob, es->call_stmt_size);
+  streamer_write_uhwi (ob, es->call_stmt_time);
+  streamer_write_uhwi (ob, es->loop_depth);
   write_predicate (ob, es->predicate);
 }
 
@@ -2517,7 +2516,7 @@ inline_write_summary (cgraph_node_set set,
   for (i = 0; i < lto_cgraph_encoder_size (encoder); i++)
     if (lto_cgraph_encoder_deref (encoder, i)->analyzed)
       count++;
-  lto_output_uleb128_stream (ob->main_stream, count);
+  streamer_write_uhwi (ob, count);
 
   for (i = 0; i < lto_cgraph_encoder_size (encoder); i++)
     {
@@ -2532,38 +2531,28 @@ inline_write_summary (cgraph_node_set set,
          struct condition *c;
          
 
-         lto_output_uleb128_stream (ob->main_stream,
-                                    lto_cgraph_encoder_encode (encoder, node));
-         lto_output_sleb128_stream (ob->main_stream,
-                                    info->estimated_self_stack_size);
-         lto_output_sleb128_stream (ob->main_stream,
-                                    info->self_size);
-         lto_output_sleb128_stream (ob->main_stream,
-                                    info->self_time);
+         streamer_write_uhwi (ob, lto_cgraph_encoder_encode (encoder, node));
+         streamer_write_hwi (ob, info->estimated_self_stack_size);
+         streamer_write_hwi (ob, info->self_size);
+         streamer_write_hwi (ob, info->self_time);
          bp = bitpack_create (ob->main_stream);
          bp_pack_value (&bp, info->inlinable, 1);
          bp_pack_value (&bp, info->versionable, 1);
-         lto_output_bitpack (&bp);
-         lto_output_uleb128_stream (ob->main_stream,
-                                    VEC_length (condition, info->conds));
+         streamer_write_bitpack (&bp);
+         streamer_write_uhwi (ob, VEC_length (condition, info->conds));
          for (i = 0; VEC_iterate (condition, info->conds, i, c); i++)
            {
-             lto_output_uleb128_stream (ob->main_stream,
-                                        c->operand_num);
-             lto_output_uleb128_stream (ob->main_stream,
-                                        c->code);
+             streamer_write_uhwi (ob, c->operand_num);
+             streamer_write_uhwi (ob, c->code);
              stream_write_tree (ob, c->val, true);
            }
-         lto_output_uleb128_stream (ob->main_stream,
-                                    VEC_length (size_time_entry, info->entry));
+         streamer_write_uhwi (ob, VEC_length (size_time_entry, info->entry));
          for (i = 0;
               VEC_iterate (size_time_entry, info->entry, i, e);
               i++)
            {
-             lto_output_uleb128_stream (ob->main_stream,
-                                        e->size);
-             lto_output_uleb128_stream (ob->main_stream,
-                                        e->time);
+             streamer_write_uhwi (ob, e->size);
+             streamer_write_uhwi (ob, e->time);
              write_predicate (ob, &e->predicate);
            }
          for (edge = node->callees; edge; edge = edge->next_callee)
@@ -2572,7 +2561,7 @@ inline_write_summary (cgraph_node_set set,
            write_inline_edge_summary (ob, edge);
        }
     }
-  lto_output_1_stream (ob->main_stream, 0);
+  streamer_write_char_stream (ob->main_stream, 0);
   produce_asm (ob, NULL);
   destroy_output_block (ob);
 
index 0997cf5e7e8b00f2fae4edcbf771d903cbfe4bd7..a81bb3cb1cdf5d1d9f60ece397c9e1622276cc76 100644 (file)
@@ -2644,8 +2644,7 @@ static void
 ipa_write_jump_function (struct output_block *ob,
                         struct ipa_jump_func *jump_func)
 {
-  lto_output_uleb128_stream (ob->main_stream,
-                            jump_func->type);
+  streamer_write_uhwi (ob, jump_func->type);
 
   switch (jump_func->type)
     {
@@ -2659,17 +2658,13 @@ ipa_write_jump_function (struct output_block *ob,
       break;
     case IPA_JF_PASS_THROUGH:
       stream_write_tree (ob, jump_func->value.pass_through.operand, true);
-      lto_output_uleb128_stream (ob->main_stream,
-                                jump_func->value.pass_through.formal_id);
-      lto_output_uleb128_stream (ob->main_stream,
-                                jump_func->value.pass_through.operation);
+      streamer_write_uhwi (ob, jump_func->value.pass_through.formal_id);
+      streamer_write_uhwi (ob, jump_func->value.pass_through.operation);
       break;
     case IPA_JF_ANCESTOR:
-      lto_output_uleb128_stream (ob->main_stream,
-                                jump_func->value.ancestor.offset);
+      streamer_write_uhwi (ob, jump_func->value.ancestor.offset);
       stream_write_tree (ob, jump_func->value.ancestor.type, true);
-      lto_output_uleb128_stream (ob->main_stream,
-                                jump_func->value.ancestor.formal_id);
+      streamer_write_uhwi (ob, jump_func->value.ancestor.formal_id);
       break;
     case IPA_JF_CONST_MEMBER_PTR:
       stream_write_tree (ob, jump_func->value.member_cst.pfn, true);
@@ -2685,7 +2680,7 @@ ipa_read_jump_function (struct lto_input_block *ib,
                        struct ipa_jump_func *jump_func,
                        struct data_in *data_in)
 {
-  jump_func->type = (enum jump_func_type) lto_input_uleb128 (ib);
+  jump_func->type = (enum jump_func_type) streamer_read_uhwi (ib);
 
   switch (jump_func->type)
     {
@@ -2699,13 +2694,14 @@ ipa_read_jump_function (struct lto_input_block *ib,
       break;
     case IPA_JF_PASS_THROUGH:
       jump_func->value.pass_through.operand = stream_read_tree (ib, data_in);
-      jump_func->value.pass_through.formal_id = lto_input_uleb128 (ib);
-      jump_func->value.pass_through.operation = (enum tree_code) lto_input_uleb128 (ib);
+      jump_func->value.pass_through.formal_id = streamer_read_uhwi (ib);
+      jump_func->value.pass_through.operation
+       = (enum tree_code) streamer_read_uhwi (ib);
       break;
     case IPA_JF_ANCESTOR:
-      jump_func->value.ancestor.offset = lto_input_uleb128 (ib);
+      jump_func->value.ancestor.offset = streamer_read_uhwi (ib);
       jump_func->value.ancestor.type = stream_read_tree (ib, data_in);
-      jump_func->value.ancestor.formal_id = lto_input_uleb128 (ib);
+      jump_func->value.ancestor.formal_id = streamer_read_uhwi (ib);
       break;
     case IPA_JF_CONST_MEMBER_PTR:
       jump_func->value.member_cst.pfn = stream_read_tree (ib, data_in);
@@ -2724,15 +2720,15 @@ ipa_write_indirect_edge_info (struct output_block *ob,
   struct cgraph_indirect_call_info *ii = cs->indirect_info;
   struct bitpack_d bp;
 
-  lto_output_sleb128_stream (ob->main_stream, ii->param_index);
-  lto_output_sleb128_stream (ob->main_stream, ii->anc_offset);
+  streamer_write_hwi (ob, ii->param_index);
+  streamer_write_hwi (ob, ii->anc_offset);
   bp = bitpack_create (ob->main_stream);
   bp_pack_value (&bp, ii->polymorphic, 1);
-  lto_output_bitpack (&bp);
+  streamer_write_bitpack (&bp);
 
   if (ii->polymorphic)
     {
-      lto_output_sleb128_stream (ob->main_stream, ii->otr_token);
+      streamer_write_hwi (ob, ii->otr_token);
       stream_write_tree (ob, ii->otr_type, true);
     }
 }
@@ -2748,13 +2744,13 @@ ipa_read_indirect_edge_info (struct lto_input_block *ib,
   struct cgraph_indirect_call_info *ii = cs->indirect_info;
   struct bitpack_d bp;
 
-  ii->param_index = (int) lto_input_sleb128 (ib);
-  ii->anc_offset = (HOST_WIDE_INT) lto_input_sleb128 (ib);
-  bp = lto_input_bitpack (ib);
+  ii->param_index = (int) streamer_read_hwi (ib);
+  ii->anc_offset = (HOST_WIDE_INT) streamer_read_hwi (ib);
+  bp = streamer_read_bitpack (ib);
   ii->polymorphic = bp_unpack_value (&bp, 1);
   if (ii->polymorphic)
     {
-      ii->otr_token = (HOST_WIDE_INT) lto_input_sleb128 (ib);
+      ii->otr_token = (HOST_WIDE_INT) streamer_read_hwi (ib);
       ii->otr_type = stream_read_tree (ib, data_in);
     }
 }
@@ -2773,7 +2769,7 @@ ipa_write_node_info (struct output_block *ob, struct cgraph_node *node)
 
   encoder = ob->decl_state->cgraph_node_encoder;
   node_ref = lto_cgraph_encoder_encode (encoder, node);
-  lto_output_uleb128_stream (ob->main_stream, node_ref);
+  streamer_write_uhwi (ob, node_ref);
 
   bp = bitpack_create (ob->main_stream);
   gcc_assert (info->uses_analysis_done
@@ -2782,13 +2778,12 @@ ipa_write_node_info (struct output_block *ob, struct cgraph_node *node)
   gcc_assert (!info->ipcp_orig_node);
   for (j = 0; j < ipa_get_param_count (info); j++)
     bp_pack_value (&bp, ipa_is_param_used (info, j), 1);
-  lto_output_bitpack (&bp);
+  streamer_write_bitpack (&bp);
   for (e = node->callees; e; e = e->next_callee)
     {
       struct ipa_edge_args *args = IPA_EDGE_REF (e);
 
-      lto_output_uleb128_stream (ob->main_stream,
-                                ipa_get_cs_argument_count (args));
+      streamer_write_uhwi (ob, ipa_get_cs_argument_count (args));
       for (j = 0; j < ipa_get_cs_argument_count (args); j++)
        ipa_write_jump_function (ob, ipa_get_ith_jump_func (args, j));
     }
@@ -2796,8 +2791,7 @@ ipa_write_node_info (struct output_block *ob, struct cgraph_node *node)
     {
       struct ipa_edge_args *args = IPA_EDGE_REF (e);
 
-      lto_output_uleb128_stream (ob->main_stream,
-                                ipa_get_cs_argument_count (args));
+      streamer_write_uhwi (ob, ipa_get_cs_argument_count (args));
       for (j = 0; j < ipa_get_cs_argument_count (args); j++)
        ipa_write_jump_function (ob, ipa_get_ith_jump_func (args, j));
       ipa_write_indirect_edge_info (ob, e);
@@ -2817,7 +2811,7 @@ ipa_read_node_info (struct lto_input_block *ib, struct cgraph_node *node,
 
   ipa_initialize_node_params (node);
 
-  bp = lto_input_bitpack (ib);
+  bp = streamer_read_bitpack (ib);
   if (ipa_get_param_count (info) != 0)
     info->uses_analysis_done = true;
   info->node_enqueued = false;
@@ -2826,7 +2820,7 @@ ipa_read_node_info (struct lto_input_block *ib, struct cgraph_node *node,
   for (e = node->callees; e; e = e->next_callee)
     {
       struct ipa_edge_args *args = IPA_EDGE_REF (e);
-      int count = lto_input_uleb128 (ib);
+      int count = streamer_read_uhwi (ib);
 
       ipa_set_cs_argument_count (args, count);
       if (!count)
@@ -2840,7 +2834,7 @@ ipa_read_node_info (struct lto_input_block *ib, struct cgraph_node *node,
   for (e = node->indirect_calls; e; e = e->next_callee)
     {
       struct ipa_edge_args *args = IPA_EDGE_REF (e);
-      int count = lto_input_uleb128 (ib);
+      int count = streamer_read_uhwi (ib);
 
       ipa_set_cs_argument_count (args, count);
       if (count)
@@ -2877,7 +2871,7 @@ ipa_prop_write_jump_functions (cgraph_node_set set)
        count++;
     }
 
-  lto_output_uleb128_stream (ob->main_stream, count);
+  streamer_write_uhwi (ob, count);
 
   /* Process all of the functions.  */
   for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi))
@@ -2887,7 +2881,7 @@ ipa_prop_write_jump_functions (cgraph_node_set set)
          && IPA_NODE_REF (node) != NULL)
         ipa_write_node_info (ob, node);
     }
-  lto_output_1_stream (ob->main_stream, 0);
+  streamer_write_char_stream (ob->main_stream, 0);
   produce_asm (ob, NULL);
   destroy_output_block (ob);
 }
@@ -2914,7 +2908,7 @@ ipa_prop_read_section (struct lto_file_decl_data *file_data, const char *data,
   data_in =
     lto_data_in_create (file_data, (const char *) data + string_offset,
                        header->string_size, NULL);
-  count = lto_input_uleb128 (&ib_main);
+  count = streamer_read_uhwi (&ib_main);
 
   for (i = 0; i < count; i++)
     {
@@ -2922,7 +2916,7 @@ ipa_prop_read_section (struct lto_file_decl_data *file_data, const char *data,
       struct cgraph_node *node;
       lto_cgraph_encoder_t encoder;
 
-      index = lto_input_uleb128 (&ib_main);
+      index = streamer_read_uhwi (&ib_main);
       encoder = file_data->cgraph_node_encoder;
       node = lto_cgraph_encoder_deref (encoder, index);
       gcc_assert (node->analyzed);
index 4f02c7bf7efe86905b7a269b3a27aeba7d57f609..36212cda67b5708107ae66e577cc633a8e2eddd0 100644 (file)
@@ -950,7 +950,7 @@ pure_const_write_summary (cgraph_node_set set,
        count++;
     }
 
-  lto_output_uleb128_stream (ob->main_stream, count);
+  streamer_write_uhwi_stream (ob->main_stream, count);
 
   /* Process all of the functions.  */
   for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi))
@@ -967,7 +967,7 @@ pure_const_write_summary (cgraph_node_set set,
 
          encoder = ob->decl_state->cgraph_node_encoder;
          node_ref = lto_cgraph_encoder_encode (encoder, node);
-         lto_output_uleb128_stream (ob->main_stream, node_ref);
+         streamer_write_uhwi_stream (ob->main_stream, node_ref);
 
          /* Note that flags will need to be read in the opposite
             order as we are pushing the bitflags into FLAGS.  */
@@ -977,7 +977,7 @@ pure_const_write_summary (cgraph_node_set set,
          bp_pack_value (&bp, fs->looping_previously_known, 1);
          bp_pack_value (&bp, fs->looping, 1);
          bp_pack_value (&bp, fs->can_throw, 1);
-         lto_output_bitpack (&bp);
+         streamer_write_bitpack (&bp);
        }
     }
 
@@ -1006,7 +1006,7 @@ pure_const_read_summary (void)
       if (ib)
        {
          unsigned int i;
-         unsigned int count = lto_input_uleb128 (ib);
+         unsigned int count = streamer_read_uhwi (ib);
 
          for (i = 0; i < count; i++)
            {
@@ -1017,7 +1017,7 @@ pure_const_read_summary (void)
              lto_cgraph_encoder_t encoder;
 
              fs = XCNEW (struct funct_state_d);
-             index = lto_input_uleb128 (ib);
+             index = streamer_read_uhwi (ib);
              encoder = file_data->cgraph_node_encoder;
              node = lto_cgraph_encoder_deref (encoder, index);
              set_function_state (node, fs);
@@ -1025,7 +1025,7 @@ pure_const_read_summary (void)
              /* Note that the flags must be read in the opposite
                 order in which they were written (the bitflags were
                 pushed into FLAGS).  */
-             bp = lto_input_bitpack (ib);
+             bp = streamer_read_bitpack (ib);
              fs->pure_const_state
                        = (enum pure_const_state_e) bp_unpack_value (&bp, 2);
              fs->state_previously_known
index 05024b4989ee810f41427e00bc4a11f5d087f97e..7b45c653675d1731c7d3af2050f1bbbbe297636a 100644 (file)
@@ -58,6 +58,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "timevar.h"
 #include "diagnostic.h"
 #include "langhooks.h"
+#include "data-streamer.h"
 #include "lto-streamer.h"
 
 static void remove_node_data (struct cgraph_node *node,
@@ -992,17 +993,17 @@ stream_out_bitmap (struct lto_simple_output_block *ob,
   bitmap_iterator bi;
   if (bits == all_module_statics)
     {
-      lto_output_sleb128_stream (ob->main_stream, -1);
+      streamer_write_hwi_stream (ob->main_stream, -1);
       return;
     }
   EXECUTE_IF_AND_IN_BITMAP (bits, ltrans_statics, 0, index, bi)
     count ++;
   if (count == ltrans_statics_bitcount)
     {
-      lto_output_sleb128_stream (ob->main_stream, -1);
+      streamer_write_hwi_stream (ob->main_stream, -1);
       return;
     }
-  lto_output_sleb128_stream (ob->main_stream, count);
+  streamer_write_hwi_stream (ob->main_stream, count);
   if (!count)
     return;
   EXECUTE_IF_AND_IN_BITMAP (bits, ltrans_statics, 0, index, bi)
@@ -1054,7 +1055,7 @@ ipa_reference_write_optimization_summary (cgraph_node_set set,
                                set, vset, ltrans_statics))
          count++;
 
-  lto_output_uleb128_stream (ob->main_stream, count);
+  streamer_write_uhwi_stream (ob->main_stream, count);
   if (count)
     stream_out_bitmap (ob, ltrans_statics, ltrans_statics,
                       -1);
@@ -1071,7 +1072,7 @@ ipa_reference_write_optimization_summary (cgraph_node_set set,
 
            info = get_reference_optimization_summary (node);
            node_ref = lto_cgraph_encoder_encode (encoder, node);
-           lto_output_uleb128_stream (ob->main_stream, node_ref);
+           streamer_write_uhwi_stream (ob->main_stream, node_ref);
 
            stream_out_bitmap (ob, info->statics_not_read, ltrans_statics,
                               ltrans_statics_bitcount);
@@ -1112,16 +1113,16 @@ ipa_reference_read_optimization_summary (void)
       if (ib)
        {
          unsigned int i;
-         unsigned int f_count = lto_input_uleb128 (ib);
+         unsigned int f_count = streamer_read_uhwi (ib);
          int b_count;
          if (!f_count)
            continue;
-         b_count = lto_input_sleb128 (ib);
+         b_count = streamer_read_hwi (ib);
          if (dump_file)
            fprintf (dump_file, "all module statics:");
          for (i = 0; i < (unsigned int)b_count; i++)
            {
-             unsigned int var_index = lto_input_uleb128 (ib);
+             unsigned int var_index = streamer_read_uhwi (ib);
              tree v_decl = lto_file_decl_data_get_var_decl (file_data,
                                                             var_index);
              bitmap_set_bit (all_module_statics, DECL_UID (v_decl));
@@ -1138,7 +1139,7 @@ ipa_reference_read_optimization_summary (void)
              int v_count;
              lto_cgraph_encoder_t encoder;
 
-             index = lto_input_uleb128 (ib);
+             index = streamer_read_uhwi (ib);
              encoder = file_data->cgraph_node_encoder;
              node = lto_cgraph_encoder_deref (encoder, index);
              info = XCNEW (struct ipa_reference_optimization_summary_d);
@@ -1151,7 +1152,7 @@ ipa_reference_read_optimization_summary (void)
                         cgraph_node_name (node), node->uid);
 
              /* Set the statics not read.  */
-             v_count = lto_input_sleb128 (ib);
+             v_count = streamer_read_hwi (ib);
              if (v_count == -1)
                {
                  info->statics_not_read = all_module_statics;
@@ -1161,7 +1162,7 @@ ipa_reference_read_optimization_summary (void)
              else
                for (j = 0; j < (unsigned int)v_count; j++)
                  {
-                   unsigned int var_index = lto_input_uleb128 (ib);
+                   unsigned int var_index = streamer_read_uhwi (ib);
                    tree v_decl = lto_file_decl_data_get_var_decl (file_data,
                                                                   var_index);
                    bitmap_set_bit (info->statics_not_read, DECL_UID (v_decl));
@@ -1174,7 +1175,7 @@ ipa_reference_read_optimization_summary (void)
                fprintf (dump_file,
                         "\n  static not written:");
              /* Set the statics not written.  */
-             v_count = lto_input_sleb128 (ib);
+             v_count = streamer_read_hwi (ib);
              if (v_count == -1)
                {
                  info->statics_not_written = all_module_statics;
@@ -1184,7 +1185,7 @@ ipa_reference_read_optimization_summary (void)
              else
                for (j = 0; j < (unsigned int)v_count; j++)
                  {
-                   unsigned int var_index = lto_input_uleb128 (ib);
+                   unsigned int var_index = streamer_read_uhwi (ib);
                    tree v_decl = lto_file_decl_data_get_var_decl (file_data,
                                                                   var_index);
                    bitmap_set_bit (info->statics_not_written, DECL_UID (v_decl));
index 126ba5a01d8826d99bad9371e6581c5388228d79..5bcc342d83f12d77b914abe67727e74a36506023 100644 (file)
@@ -267,24 +267,24 @@ lto_output_edge (struct lto_simple_output_block *ob, struct cgraph_edge *edge,
   struct bitpack_d bp;
 
   if (edge->indirect_unknown_callee)
-    lto_output_enum (ob->main_stream, LTO_cgraph_tags, LTO_cgraph_last_tag,
-                    LTO_cgraph_indirect_edge);
+    streamer_write_enum (ob->main_stream, LTO_cgraph_tags, LTO_cgraph_last_tag,
+                        LTO_cgraph_indirect_edge);
   else
-    lto_output_enum (ob->main_stream, LTO_cgraph_tags, LTO_cgraph_last_tag,
-                    LTO_cgraph_edge);
+    streamer_write_enum (ob->main_stream, LTO_cgraph_tags, LTO_cgraph_last_tag,
+                        LTO_cgraph_edge);
 
   ref = lto_cgraph_encoder_lookup (encoder, edge->caller);
   gcc_assert (ref != LCC_NOT_FOUND);
-  lto_output_sleb128_stream (ob->main_stream, ref);
+  streamer_write_hwi_stream (ob->main_stream, ref);
 
   if (!edge->indirect_unknown_callee)
     {
       ref = lto_cgraph_encoder_lookup (encoder, edge->callee);
       gcc_assert (ref != LCC_NOT_FOUND);
-      lto_output_sleb128_stream (ob->main_stream, ref);
+      streamer_write_hwi_stream (ob->main_stream, ref);
     }
 
-  lto_output_sleb128_stream (ob->main_stream, edge->count);
+  streamer_write_hwi_stream (ob->main_stream, edge->count);
 
   bp = bitpack_create (ob->main_stream);
   uid = (!gimple_has_body_p (edge->caller->decl)
@@ -312,7 +312,7 @@ lto_output_edge (struct lto_simple_output_block *ob, struct cgraph_edge *edge,
                             | ECF_LEAF
                             | ECF_NOVOPS)));
     }
-  lto_output_bitpack (&bp);
+  streamer_write_bitpack (&bp);
 }
 
 /* Return if LIST contain references from other partitions.  */
@@ -423,7 +423,8 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
   else
     tag = LTO_cgraph_unavail_node;
 
-  lto_output_enum (ob->main_stream, LTO_cgraph_tags, LTO_cgraph_last_tag, tag);
+  streamer_write_enum (ob->main_stream, LTO_cgraph_tags, LTO_cgraph_last_tag,
+                      tag);
 
   /* In WPA mode, we only output part of the call-graph.  Also, we
      fake cgraph node attributes.  There are two cases that we care.
@@ -459,14 +460,14 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
   if (LTO_cgraph_analyzed_node)
     gcc_assert (clone_of || !node->clone_of);
   if (!clone_of)
-    lto_output_sleb128_stream (ob->main_stream, LCC_NOT_FOUND);
+    streamer_write_hwi_stream (ob->main_stream, LCC_NOT_FOUND);
   else
-    lto_output_sleb128_stream (ob->main_stream, ref);
+    streamer_write_hwi_stream (ob->main_stream, ref);
 
 
   lto_output_fn_decl_index (ob->decl_state, ob->main_stream, node->decl);
-  lto_output_sleb128_stream (ob->main_stream, node->count);
-  lto_output_sleb128_stream (ob->main_stream, node->count_materialization_scale);
+  streamer_write_hwi_stream (ob->main_stream, node->count);
+  streamer_write_hwi_stream (ob->main_stream, node->count_materialization_scale);
 
   if (tag == LTO_cgraph_analyzed_node)
     {
@@ -478,7 +479,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
       else
        ref = LCC_NOT_FOUND;
 
-      lto_output_sleb128_stream (ob->main_stream, ref);
+      streamer_write_hwi_stream (ob->main_stream, ref);
     }
 
   if (node->same_comdat_group && !boundary_p)
@@ -488,7 +489,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
     }
   else
     ref = LCC_NOT_FOUND;
-  lto_output_sleb128_stream (ob->main_stream, ref);
+  streamer_write_hwi_stream (ob->main_stream, ref);
 
   bp = bitpack_create (ob->main_stream);
   bp_pack_value (&bp, node->local.local, 1);
@@ -513,23 +514,21 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
   bp_pack_value (&bp, node->thunk.thunk_p && !boundary_p, 1);
   bp_pack_enum (&bp, ld_plugin_symbol_resolution,
                LDPR_NUM_KNOWN, node->resolution);
-  lto_output_bitpack (&bp);
+  streamer_write_bitpack (&bp);
 
   if (node->thunk.thunk_p && !boundary_p)
     {
-      lto_output_uleb128_stream
+      streamer_write_uhwi_stream
         (ob->main_stream,
          1 + (node->thunk.this_adjusting != 0) * 2
          + (node->thunk.virtual_offset_p != 0) * 4);
-      lto_output_uleb128_stream (ob->main_stream,
-                                node->thunk.fixed_offset);
-      lto_output_uleb128_stream (ob->main_stream,
-                                node->thunk.virtual_value);
+      streamer_write_uhwi_stream (ob->main_stream, node->thunk.fixed_offset);
+      streamer_write_uhwi_stream (ob->main_stream, node->thunk.virtual_value);
     }
   if ((node->alias || node->thunk.thunk_p) && !boundary_p)
     {
-      lto_output_int_in_range (ob->main_stream, 0, 1,
-                              node->thunk.alias != NULL);
+      streamer_write_hwi_in_range (ob->main_stream, 0, 1,
+                                       node->thunk.alias != NULL);
       if (node->thunk.alias != NULL)
         lto_output_fn_decl_index (ob->decl_state, ob->main_stream,
                                  node->thunk.alias);
@@ -573,7 +572,7 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, struct varpool_node
                                                           set, vset), 1);
       bp_pack_value (&bp, boundary_p, 1);  /* in_other_partition.  */
     }
-  lto_output_bitpack (&bp);
+  streamer_write_bitpack (&bp);
   if (node->alias_of)
     lto_output_var_decl_index (ob->decl_state, ob->main_stream, node->alias_of);
   if (node->same_comdat_group && !boundary_p)
@@ -583,9 +582,9 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, struct varpool_node
     }
   else
     ref = LCC_NOT_FOUND;
-  lto_output_sleb128_stream (ob->main_stream, ref);
-  lto_output_enum (ob->main_stream, ld_plugin_symbol_resolution,
-                  LDPR_NUM_KNOWN, node->resolution);
+  streamer_write_hwi_stream (ob->main_stream, ref);
+  streamer_write_enum (ob->main_stream, ld_plugin_symbol_resolution,
+                      LDPR_NUM_KNOWN, node->resolution);
 }
 
 /* Output the varpool NODE to OB. 
@@ -600,19 +599,19 @@ lto_output_ref (struct lto_simple_output_block *ob, struct ipa_ref *ref,
   bp = bitpack_create (ob->main_stream);
   bp_pack_value (&bp, ref->refered_type, 1);
   bp_pack_value (&bp, ref->use, 2);
-  lto_output_bitpack (&bp);
+  streamer_write_bitpack (&bp);
   if (ref->refered_type == IPA_REF_CGRAPH)
     {
       int nref = lto_cgraph_encoder_lookup (encoder, ipa_ref_node (ref));
       gcc_assert (nref != LCC_NOT_FOUND);
-      lto_output_sleb128_stream (ob->main_stream, nref);
+      streamer_write_hwi_stream (ob->main_stream, nref);
     }
   else
     {
       int nref = lto_varpool_encoder_lookup (varpool_encoder,
                                             ipa_ref_varpool_node (ref));
       gcc_assert (nref != LCC_NOT_FOUND);
-      lto_output_sleb128_stream (ob->main_stream, nref);
+      streamer_write_hwi_stream (ob->main_stream, nref);
     }
 }
 
@@ -627,11 +626,11 @@ output_profile_summary (struct lto_simple_output_block *ob)
         GCC profile feedback and they are difficult to merge from multiple
         units.  */
       gcc_assert (profile_info->runs);
-      lto_output_uleb128_stream (ob->main_stream, profile_info->runs);
-      lto_output_uleb128_stream (ob->main_stream, profile_info->sum_max);
+      streamer_write_uhwi_stream (ob->main_stream, profile_info->runs);
+      streamer_write_uhwi_stream (ob->main_stream, profile_info->sum_max);
     }
   else
-    lto_output_uleb128_stream (ob->main_stream, 0);
+    streamer_write_uhwi_stream (ob->main_stream, 0);
 }
 
 /* Add NODE into encoder as well as nodes it is cloned from.
@@ -709,15 +708,15 @@ output_refs (cgraph_node_set set, varpool_node_set vset,
       count = ipa_ref_list_nreferences (&node->ref_list);
       if (count)
        {
-         lto_output_uleb128_stream (ob->main_stream, count);
-         lto_output_uleb128_stream (ob->main_stream,
+         streamer_write_uhwi_stream (ob->main_stream, count);
+         streamer_write_uhwi_stream (ob->main_stream,
                                     lto_cgraph_encoder_lookup (encoder, node));
          for (i = 0; ipa_ref_list_reference_iterate (&node->ref_list, i, ref); i++)
            lto_output_ref (ob, ref, encoder, varpool_encoder);
        }
     }
 
-  lto_output_uleb128_stream (ob->main_stream, 0);
+  streamer_write_uhwi_stream (ob->main_stream, 0);
 
   for (vsi = vsi_start (vset); !vsi_end_p (vsi); vsi_next (&vsi))
     {
@@ -726,8 +725,8 @@ output_refs (cgraph_node_set set, varpool_node_set vset,
       count = ipa_ref_list_nreferences (&node->ref_list);
       if (count)
        {
-         lto_output_uleb128_stream (ob->main_stream, count);
-         lto_output_uleb128_stream (ob->main_stream,
+         streamer_write_uhwi_stream (ob->main_stream, count);
+         streamer_write_uhwi_stream (ob->main_stream,
                                     lto_varpool_encoder_lookup (varpool_encoder,
                                                                 node));
          for (i = 0; ipa_ref_list_reference_iterate (&node->ref_list, i, ref); i++)
@@ -735,7 +734,7 @@ output_refs (cgraph_node_set set, varpool_node_set vset,
        }
     }
 
-  lto_output_uleb128_stream (ob->main_stream, 0);
+  streamer_write_uhwi_stream (ob->main_stream, 0);
 
   lto_destroy_simple_output_block (ob);
 }
@@ -852,7 +851,7 @@ output_cgraph (cgraph_node_set set, varpool_node_set vset)
       output_outgoing_cgraph_edges (node->indirect_calls, ob, encoder);
     }
 
-  lto_output_uleb128_stream (ob->main_stream, 0);
+  streamer_write_uhwi_stream (ob->main_stream, 0);
 
   /* Emit toplevel asms.
      When doing WPA we must output every asm just once.  Since we do not partition asm
@@ -864,14 +863,14 @@ output_cgraph (cgraph_node_set set, varpool_node_set vset)
       for (can = cgraph_asm_nodes; can; can = can->next)
        {
          int len = TREE_STRING_LENGTH (can->asm_str);
-         lto_output_uleb128_stream (ob->main_stream, len);
+         streamer_write_uhwi_stream (ob->main_stream, len);
          for (i = 0; i < len; ++i)
-           lto_output_1_stream (ob->main_stream,
-                                TREE_STRING_POINTER (can->asm_str)[i]);
+           streamer_write_char_stream (ob->main_stream,
+                                       TREE_STRING_POINTER (can->asm_str)[i]);
        }
     }
 
-  lto_output_uleb128_stream (ob->main_stream, 0);
+  streamer_write_uhwi_stream (ob->main_stream, 0);
 
   lto_destroy_simple_output_block (ob);
   output_varpool (set, vset);
@@ -938,7 +937,7 @@ output_varpool (cgraph_node_set set, varpool_node_set vset)
   lto_varpool_encoder_t varpool_encoder = ob->decl_state->varpool_node_encoder;
   int len = lto_varpool_encoder_size (varpool_encoder), i;
 
-  lto_output_uleb128_stream (ob->main_stream, len);
+  streamer_write_uhwi_stream (ob->main_stream, len);
 
   /* Write out the nodes.  We must first output a node and then its clones,
      otherwise at a time reading back the node there would be nothing to clone
@@ -969,9 +968,9 @@ input_node (struct lto_file_decl_data *file_data,
   int ref = LCC_NOT_FOUND, ref2 = LCC_NOT_FOUND;
   int clone_ref;
 
-  clone_ref = lto_input_sleb128 (ib);
+  clone_ref = streamer_read_hwi (ib);
 
-  decl_index = lto_input_uleb128 (ib);
+  decl_index = streamer_read_uhwi (ib);
   fn_decl = lto_file_decl_data_get_fn_decl (file_data, decl_index);
 
   if (clone_ref != LCC_NOT_FOUND)
@@ -982,13 +981,13 @@ input_node (struct lto_file_decl_data *file_data,
   else
     node = cgraph_get_create_node (fn_decl);
 
-  node->count = lto_input_sleb128 (ib);
-  node->count_materialization_scale = lto_input_sleb128 (ib);
+  node->count = streamer_read_hwi (ib);
+  node->count_materialization_scale = streamer_read_hwi (ib);
 
   if (tag == LTO_cgraph_analyzed_node)
-    ref = lto_input_sleb128 (ib);
+    ref = streamer_read_hwi (ib);
 
-  ref2 = lto_input_sleb128 (ib);
+  ref2 = streamer_read_hwi (ib);
 
   /* Make sure that we have not read this node before.  Nodes that
      have already been read will have their tag stored in the 'aux'
@@ -998,7 +997,7 @@ input_node (struct lto_file_decl_data *file_data,
     internal_error ("bytecode stream: found multiple instances of cgraph "
                    "node %d", node->uid);
 
-  bp = lto_input_bitpack (ib);
+  bp = streamer_read_bitpack (ib);
   input_overwrite_node (file_data, node, tag, &bp);
 
   /* Store a reference for now, and fix up later to be a pointer.  */
@@ -1009,9 +1008,9 @@ input_node (struct lto_file_decl_data *file_data,
 
   if (node->thunk.thunk_p)
     {
-      int type = lto_input_uleb128 (ib);
-      HOST_WIDE_INT fixed_offset = lto_input_uleb128 (ib);
-      HOST_WIDE_INT virtual_value = lto_input_uleb128 (ib);
+      int type = streamer_read_uhwi (ib);
+      HOST_WIDE_INT fixed_offset = streamer_read_uhwi (ib);
+      HOST_WIDE_INT virtual_value = streamer_read_uhwi (ib);
 
       node->thunk.fixed_offset = fixed_offset;
       node->thunk.this_adjusting = (type & 2);
@@ -1020,9 +1019,9 @@ input_node (struct lto_file_decl_data *file_data,
     }
   if (node->thunk.thunk_p || node->alias)
     {
-      if (lto_input_int_in_range (ib, "alias nonzero flag", 0, 1))
+      if (streamer_read_hwi_in_range (ib, "alias nonzero flag", 0, 1))
        {
-          decl_index = lto_input_uleb128 (ib);
+          decl_index = streamer_read_uhwi (ib);
           node->thunk.alias = lto_file_decl_data_get_fn_decl (file_data,
                                                              decl_index);
        }
@@ -1044,12 +1043,12 @@ input_varpool_node (struct lto_file_decl_data *file_data,
   int ref = LCC_NOT_FOUND;
   bool non_null_aliasof;
 
-  decl_index = lto_input_uleb128 (ib);
+  decl_index = streamer_read_uhwi (ib);
   var_decl = lto_file_decl_data_get_var_decl (file_data, decl_index);
   node = varpool_node (var_decl);
   node->lto_file_data = file_data;
 
-  bp = lto_input_bitpack (ib);
+  bp = streamer_read_bitpack (ib);
   node->externally_visible = bp_unpack_value (&bp, 1);
   node->force_output = bp_unpack_value (&bp, 1);
   node->finalized = bp_unpack_value (&bp, 1);
@@ -1067,14 +1066,14 @@ input_varpool_node (struct lto_file_decl_data *file_data,
     varpool_mark_needed_node (node);
   if (non_null_aliasof)
     {
-      decl_index = lto_input_uleb128 (ib);
+      decl_index = streamer_read_uhwi (ib);
       node->alias_of = lto_file_decl_data_get_var_decl (file_data, decl_index);
     }
-  ref = lto_input_sleb128 (ib);
+  ref = streamer_read_hwi (ib);
   /* Store a reference for now, and fix up later to be a pointer.  */
   node->same_comdat_group = (struct varpool_node *) (intptr_t) ref;
-  node->resolution = lto_input_enum (ib, ld_plugin_symbol_resolution,
-                                    LDPR_NUM_KNOWN);
+  node->resolution = streamer_read_enum (ib, ld_plugin_symbol_resolution,
+                                        LDPR_NUM_KNOWN);
 
   return node;
 }
@@ -1095,13 +1094,14 @@ input_ref (struct lto_input_block *ib,
   enum ipa_ref_type type;
   enum ipa_ref_use use;
 
-  bp = lto_input_bitpack (ib);
+  bp = streamer_read_bitpack (ib);
   type = (enum ipa_ref_type) bp_unpack_value (&bp, 1);
   use = (enum ipa_ref_use) bp_unpack_value (&bp, 2);
   if (type == IPA_REF_CGRAPH)
-    node = VEC_index (cgraph_node_ptr, nodes, lto_input_sleb128 (ib));
+    node = VEC_index (cgraph_node_ptr, nodes, streamer_read_hwi (ib));
   else
-    varpool_node = VEC_index (varpool_node_ptr, varpool_nodes, lto_input_sleb128 (ib));
+    varpool_node = VEC_index (varpool_node_ptr, varpool_nodes,
+                             streamer_read_hwi (ib));
   ipa_record_reference (refering_node, refering_varpool_node,
                        node, varpool_node, use, NULL);
 }
@@ -1124,22 +1124,22 @@ input_edge (struct lto_input_block *ib, VEC(cgraph_node_ptr, heap) *nodes,
   struct bitpack_d bp;
   int ecf_flags = 0;
 
-  caller = VEC_index (cgraph_node_ptr, nodes, lto_input_sleb128 (ib));
+  caller = VEC_index (cgraph_node_ptr, nodes, streamer_read_hwi (ib));
   if (caller == NULL || caller->decl == NULL_TREE)
     internal_error ("bytecode stream: no caller found while reading edge");
 
   if (!indirect)
     {
-      callee = VEC_index (cgraph_node_ptr, nodes, lto_input_sleb128 (ib));
+      callee = VEC_index (cgraph_node_ptr, nodes, streamer_read_hwi (ib));
       if (callee == NULL || callee->decl == NULL_TREE)
        internal_error ("bytecode stream: no callee found while reading edge");
     }
   else
     callee = NULL;
 
-  count = (gcov_type) lto_input_sleb128 (ib);
+  count = (gcov_type) streamer_read_hwi (ib);
 
-  bp = lto_input_bitpack (ib);
+  bp = streamer_read_bitpack (ib);
   inline_failed = bp_unpack_enum (&bp, cgraph_inline_failed_enum, CIF_N_REASONS);
   stmt_id = bp_unpack_var_len_unsigned (&bp);
   freq = (int) bp_unpack_var_len_unsigned (&bp);
@@ -1185,7 +1185,7 @@ input_cgraph_1 (struct lto_file_decl_data *file_data,
   unsigned i;
   unsigned HOST_WIDE_INT len;
 
-  tag = lto_input_enum (ib, LTO_cgraph_tags, LTO_cgraph_last_tag);
+  tag = streamer_read_enum (ib, LTO_cgraph_tags, LTO_cgraph_last_tag);
   while (tag)
     {
       if (tag == LTO_cgraph_edge)
@@ -1201,20 +1201,20 @@ input_cgraph_1 (struct lto_file_decl_data *file_data,
          lto_cgraph_encoder_encode (file_data->cgraph_node_encoder, node);
        }
 
-      tag = lto_input_enum (ib, LTO_cgraph_tags, LTO_cgraph_last_tag);
+      tag = streamer_read_enum (ib, LTO_cgraph_tags, LTO_cgraph_last_tag);
     }
 
   /* Input toplevel asms.  */
-  len = lto_input_uleb128 (ib);
+  len = streamer_read_uhwi (ib);
   while (len)
     {
       char *str = (char *)xmalloc (len + 1);
       for (i = 0; i < len; ++i)
-       str[i] = lto_input_1_unsigned (ib);
+       str[i] = streamer_read_uchar (ib);
       cgraph_add_asm_node (build_string (len, str));
       free (str);
 
-      len = lto_input_uleb128 (ib);
+      len = streamer_read_uhwi (ib);
     }
   /* AUX pointers should be all non-zero for nodes read from the stream.  */
 #ifdef ENABLE_CHECKING
@@ -1260,7 +1260,7 @@ input_varpool_1 (struct lto_file_decl_data *file_data,
   int i;
   struct varpool_node *node;
 
-  len = lto_input_uleb128 (ib);
+  len = streamer_read_uhwi (ib);
   while (len)
     {
       VEC_safe_push (varpool_node_ptr, heap, varpool,
@@ -1302,10 +1302,10 @@ input_refs (struct lto_input_block *ib,
   while (true)
     {
       struct cgraph_node *node;
-      count = lto_input_uleb128 (ib);
+      count = streamer_read_uhwi (ib);
       if (!count)
        break;
-      idx = lto_input_uleb128 (ib);
+      idx = streamer_read_uhwi (ib);
       node = VEC_index (cgraph_node_ptr, nodes, idx);
       while (count)
        {
@@ -1316,10 +1316,11 @@ input_refs (struct lto_input_block *ib,
   while (true)
     {
       struct varpool_node *node;
-      count = lto_input_uleb128 (ib);
+      count = streamer_read_uhwi (ib);
       if (!count)
        break;
-      node = VEC_index (varpool_node_ptr, varpool, lto_input_uleb128 (ib));
+      node = VEC_index (varpool_node_ptr, varpool,
+                       streamer_read_uhwi (ib));
       while (count)
        {
          input_ref (ib, NULL, node, nodes, varpool);
@@ -1336,11 +1337,11 @@ static void
 input_profile_summary (struct lto_input_block *ib,
                       struct lto_file_decl_data *file_data)
 {
-  unsigned int runs = lto_input_uleb128 (ib);
+  unsigned int runs = streamer_read_uhwi (ib);
   if (runs)
     {
       file_data->profile_info.runs = runs;
-      file_data->profile_info.sum_max = lto_input_uleb128 (ib);
+      file_data->profile_info.sum_max = streamer_read_uhwi (ib);
     }
 
 }
@@ -1528,10 +1529,9 @@ output_edge_opt_summary (struct output_block *ob,
                         struct cgraph_edge *edge)
 {
   if (edge->indirect_info)
-    lto_output_sleb128_stream (ob->main_stream,
-                              edge->indirect_info->thunk_delta);
+    streamer_write_hwi (ob, edge->indirect_info->thunk_delta);
   else
-    lto_output_sleb128_stream (ob->main_stream, 0);
+    streamer_write_hwi (ob, 0);
 }
 
 /* Output optimization summary for NODE to OB.  */
@@ -1550,24 +1550,22 @@ output_node_opt_summary (struct output_block *ob,
 
   if (node->clone.args_to_skip)
     {
-      lto_output_uleb128_stream (ob->main_stream,
-                                bitmap_count_bits (node->clone.args_to_skip));
+      streamer_write_uhwi (ob, bitmap_count_bits (node->clone.args_to_skip));
       EXECUTE_IF_SET_IN_BITMAP (node->clone.args_to_skip, 0, index, bi)
-       lto_output_uleb128_stream (ob->main_stream, index);
+       streamer_write_uhwi (ob, index);
     }
   else
-    lto_output_uleb128_stream (ob->main_stream, 0);
+    streamer_write_uhwi (ob, 0);
   if (node->clone.combined_args_to_skip)
     {
-      lto_output_uleb128_stream (ob->main_stream,
-                                bitmap_count_bits (node->clone.combined_args_to_skip));
+      streamer_write_uhwi (ob, bitmap_count_bits (node->clone.combined_args_to_skip));
       EXECUTE_IF_SET_IN_BITMAP (node->clone.combined_args_to_skip, 0, index, bi)
-       lto_output_uleb128_stream (ob->main_stream, index);
+       streamer_write_uhwi (ob, index);
     }
   else
-    lto_output_uleb128_stream (ob->main_stream, 0);
-  lto_output_uleb128_stream (ob->main_stream,
-                            VEC_length (ipa_replace_map_p, node->clone.tree_map));
+    streamer_write_uhwi (ob, 0);
+  streamer_write_uhwi (ob, VEC_length (ipa_replace_map_p,
+                                      node->clone.tree_map));
   FOR_EACH_VEC_ELT (ipa_replace_map_p, node->clone.tree_map, i, map)
     {
       int parm_num;
@@ -1580,12 +1578,12 @@ output_node_opt_summary (struct output_block *ob,
       /* At the moment we assume all old trees to be PARM_DECLs, because we have no
          mechanism to store function local declarations into summaries.  */
       gcc_assert (parm);
-      lto_output_uleb128_stream (ob->main_stream, parm_num);
+      streamer_write_uhwi (ob, parm_num);
       stream_write_tree (ob, map->new_tree, true);
       bp = bitpack_create (ob->main_stream);
       bp_pack_value (&bp, map->replace_p, 1);
       bp_pack_value (&bp, map->ref_p, 1);
-      lto_output_bitpack (&bp);
+      streamer_write_bitpack (&bp);
     }
 
   if (cgraph_node_in_set_p (node, set))
@@ -1616,13 +1614,13 @@ output_cgraph_opt_summary (cgraph_node_set set)
     if (output_cgraph_opt_summary_p (lto_cgraph_encoder_deref (encoder, i),
                                     set))
       count++;
-  lto_output_uleb128_stream (ob->main_stream, count);
+  streamer_write_uhwi (ob, count);
   for (i = 0; i < n_nodes; i++)
     {
       node = lto_cgraph_encoder_deref (encoder, i);
       if (output_cgraph_opt_summary_p (node, set))
        {
-         lto_output_uleb128_stream (ob->main_stream, i);
+         streamer_write_uhwi (ob, i);
          output_node_opt_summary (ob, node, set);
        }
     }
@@ -1637,7 +1635,7 @@ input_edge_opt_summary (struct cgraph_edge *edge,
                        struct lto_input_block *ib_main)
 {
   HOST_WIDE_INT thunk_delta;
-  thunk_delta = lto_input_sleb128 (ib_main);
+  thunk_delta = streamer_read_hwi (ib_main);
   if (thunk_delta != 0)
     {
       gcc_assert (!edge->indirect_info);
@@ -1659,23 +1657,23 @@ input_node_opt_summary (struct cgraph_node *node,
   struct bitpack_d bp;
   struct cgraph_edge *e;
 
-  count = lto_input_uleb128 (ib_main);
+  count = streamer_read_uhwi (ib_main);
   if (count)
     node->clone.args_to_skip = BITMAP_GGC_ALLOC ();
   for (i = 0; i < count; i++)
     {
-      bit = lto_input_uleb128 (ib_main);
+      bit = streamer_read_uhwi (ib_main);
       bitmap_set_bit (node->clone.args_to_skip, bit);
     }
-  count = lto_input_uleb128 (ib_main);
+  count = streamer_read_uhwi (ib_main);
   if (count)
     node->clone.combined_args_to_skip = BITMAP_GGC_ALLOC ();
   for (i = 0; i < count; i++)
     {
-      bit = lto_input_uleb128 (ib_main);
+      bit = streamer_read_uhwi (ib_main);
       bitmap_set_bit (node->clone.combined_args_to_skip, bit);
     }
-  count = lto_input_uleb128 (ib_main);
+  count = streamer_read_uhwi (ib_main);
   for (i = 0; i < count; i++)
     {
       int parm_num;
@@ -1686,10 +1684,10 @@ input_node_opt_summary (struct cgraph_node *node,
       for (parm_num = 0, parm = DECL_ARGUMENTS (node->decl); parm_num;
           parm = DECL_CHAIN (parm))
        parm_num --;
-      map->parm_num = lto_input_uleb128 (ib_main);
+      map->parm_num = streamer_read_uhwi (ib_main);
       map->old_tree = NULL;
       map->new_tree = stream_read_tree (ib_main, data_in);
-      bp = lto_input_bitpack (ib_main);
+      bp = streamer_read_bitpack (ib_main);
       map->replace_p = bp_unpack_value (&bp, 1);
       map->ref_p = bp_unpack_value (&bp, 1);
     }
@@ -1722,11 +1720,11 @@ input_cgraph_opt_section (struct lto_file_decl_data *file_data,
   data_in =
     lto_data_in_create (file_data, (const char *) data + string_offset,
                        header->string_size, NULL);
-  count = lto_input_uleb128 (&ib_main);
+  count = streamer_read_uhwi (&ib_main);
 
   for (i = 0; i < count; i++)
     {
-      int ref = lto_input_uleb128 (&ib_main);
+      int ref = streamer_read_uhwi (&ib_main);
       input_node_opt_summary (VEC_index (cgraph_node_ptr, nodes, ref),
                              &ib_main, data_in);
     }
index 7f44d6e367546905df338a4090a85b8041920214..fe3cc54c7f96b2cd2667674e971de098aac1e220 100644 (file)
@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "pointer-set.h"
 #include "bitmap.h"
 #include "langhooks.h"
+#include "data-streamer.h"
 #include "lto-streamer.h"
 #include "lto-compress.h"
 
@@ -303,7 +304,7 @@ lto_output_decl_index (struct lto_output_stream *obs,
     }
 
   if (obs)
-    lto_output_uleb128_stream (obs, index);
+    streamer_write_uhwi_stream (obs, index);
   *this_index = index;
   return new_entry_p;
 }
index 16947c7338b8b7a9506a42ec0fdfb32104339e56..331eba8bd30c81db926c9d375a6324a248bc5efa 100644 (file)
@@ -86,7 +86,7 @@ lto_input_data_block (struct lto_input_block *ib, void *addr, size_t length)
   unsigned char *const buffer = (unsigned char *const) addr;
 
   for (i = 0; i < length; i++)
-    buffer[i] = lto_input_1_unsigned (ib);
+    buffer[i] = streamer_read_uchar (ib);
 }
 
 
@@ -186,7 +186,7 @@ lto_input_location (struct lto_input_block *ib, struct data_in *data_in)
 {
   struct bitpack_d bp;
 
-  bp = lto_input_bitpack (ib);
+  bp = streamer_read_bitpack (ib);
   return lto_input_location_bitpack (data_in, &bp);
 }
 
@@ -210,32 +210,32 @@ lto_input_tree_ref (struct lto_input_block *ib, struct data_in *data_in,
   switch (tag)
     {
     case LTO_type_ref:
-      ix_u = lto_input_uleb128 (ib);
+      ix_u = streamer_read_uhwi (ib);
       result = lto_file_decl_data_get_type (data_in->file_data, ix_u);
       break;
 
     case LTO_ssa_name_ref:
-      ix_u = lto_input_uleb128 (ib);
+      ix_u = streamer_read_uhwi (ib);
       result = VEC_index (tree, SSANAMES (fn), ix_u);
       break;
 
     case LTO_field_decl_ref:
-      ix_u = lto_input_uleb128 (ib);
+      ix_u = streamer_read_uhwi (ib);
       result = lto_file_decl_data_get_field_decl (data_in->file_data, ix_u);
       break;
 
     case LTO_function_decl_ref:
-      ix_u = lto_input_uleb128 (ib);
+      ix_u = streamer_read_uhwi (ib);
       result = lto_file_decl_data_get_fn_decl (data_in->file_data, ix_u);
       break;
 
     case LTO_type_decl_ref:
-      ix_u = lto_input_uleb128 (ib);
+      ix_u = streamer_read_uhwi (ib);
       result = lto_file_decl_data_get_type_decl (data_in->file_data, ix_u);
       break;
 
     case LTO_namespace_decl_ref:
-      ix_u = lto_input_uleb128 (ib);
+      ix_u = streamer_read_uhwi (ib);
       result = lto_file_decl_data_get_namespace_decl (data_in->file_data, ix_u);
       break;
 
@@ -245,7 +245,7 @@ lto_input_tree_ref (struct lto_input_block *ib, struct data_in *data_in,
     case LTO_imported_decl_ref:
     case LTO_label_decl_ref:
     case LTO_translation_unit_decl_ref:
-      ix_u = lto_input_uleb128 (ib);
+      ix_u = streamer_read_uhwi (ib);
       result = lto_file_decl_data_get_var_decl (data_in->file_data, ix_u);
       break;
 
@@ -270,7 +270,7 @@ lto_input_eh_catch_list (struct lto_input_block *ib, struct data_in *data_in,
   enum LTO_tags tag;
 
   *last_p = first = NULL;
-  tag = input_record_start (ib);
+  tag = streamer_read_record_start (ib);
   while (tag)
     {
       tree list;
@@ -298,7 +298,7 @@ lto_input_eh_catch_list (struct lto_input_block *ib, struct data_in *data_in,
       if (first == NULL)
        first = n;
 
-      tag = input_record_start (ib);
+      tag = streamer_read_record_start (ib);
     }
 
   return first;
@@ -315,20 +315,20 @@ input_eh_region (struct lto_input_block *ib, struct data_in *data_in, int ix)
   eh_region r;
 
   /* Read the region header.  */
-  tag = input_record_start (ib);
+  tag = streamer_read_record_start (ib);
   if (tag == LTO_null)
     return NULL;
 
   r = ggc_alloc_cleared_eh_region_d ();
-  r->index = lto_input_sleb128 (ib);
+  r->index = streamer_read_hwi (ib);
 
   gcc_assert (r->index == ix);
 
   /* Read all the region pointers as region numbers.  We'll fix up
      the pointers once the whole array has been read.  */
-  r->outer = (eh_region) (intptr_t) lto_input_sleb128 (ib);
-  r->inner = (eh_region) (intptr_t) lto_input_sleb128 (ib);
-  r->next_peer = (eh_region) (intptr_t) lto_input_sleb128 (ib);
+  r->outer = (eh_region) (intptr_t) streamer_read_hwi (ib);
+  r->inner = (eh_region) (intptr_t) streamer_read_hwi (ib);
+  r->next_peer = (eh_region) (intptr_t) streamer_read_hwi (ib);
 
   switch (tag)
     {
@@ -353,7 +353,7 @@ input_eh_region (struct lto_input_block *ib, struct data_in *data_in, int ix)
          r->type = ERT_ALLOWED_EXCEPTIONS;
          r->u.allowed.type_list = stream_read_tree (ib, data_in);
          r->u.allowed.label = stream_read_tree (ib, data_in);
-         r->u.allowed.filter = lto_input_uleb128 (ib);
+         r->u.allowed.filter = streamer_read_uhwi (ib);
 
          for (l = r->u.allowed.type_list; l ; l = TREE_CHAIN (l))
            add_type_for_runtime (TREE_VALUE (l));
@@ -370,7 +370,7 @@ input_eh_region (struct lto_input_block *ib, struct data_in *data_in, int ix)
        gcc_unreachable ();
     }
 
-  r->landing_pads = (eh_landing_pad) (intptr_t) lto_input_sleb128 (ib);
+  r->landing_pads = (eh_landing_pad) (intptr_t) streamer_read_hwi (ib);
 
   return r;
 }
@@ -386,17 +386,17 @@ input_eh_lp (struct lto_input_block *ib, struct data_in *data_in, int ix)
   eh_landing_pad lp;
 
   /* Read the landing pad header.  */
-  tag = input_record_start (ib);
+  tag = streamer_read_record_start (ib);
   if (tag == LTO_null)
     return NULL;
 
   lto_tag_check_range (tag, LTO_eh_landing_pad, LTO_eh_landing_pad);
 
   lp = ggc_alloc_cleared_eh_landing_pad_d ();
-  lp->index = lto_input_sleb128 (ib);
+  lp->index = streamer_read_hwi (ib);
   gcc_assert (lp->index == ix);
-  lp->next_lp = (eh_landing_pad) (intptr_t) lto_input_sleb128 (ib);
-  lp->region = (eh_region) (intptr_t) lto_input_sleb128 (ib);
+  lp->next_lp = (eh_landing_pad) (intptr_t) streamer_read_hwi (ib);
+  lp->region = (eh_region) (intptr_t) streamer_read_hwi (ib);
   lp->post_landing_pad = stream_read_tree (ib, data_in);
 
   return lp;
@@ -492,7 +492,7 @@ input_eh_regions (struct lto_input_block *ib, struct data_in *data_in,
   HOST_WIDE_INT i, root_region, len;
   enum LTO_tags tag;
 
-  tag = input_record_start (ib);
+  tag = streamer_read_record_start (ib);
   if (tag == LTO_null)
     return;
 
@@ -505,11 +505,11 @@ input_eh_regions (struct lto_input_block *ib, struct data_in *data_in,
 
   gcc_assert (fn->eh);
 
-  root_region = lto_input_sleb128 (ib);
+  root_region = streamer_read_hwi (ib);
   gcc_assert (root_region == (int) root_region);
 
   /* Read the EH region array.  */
-  len = lto_input_sleb128 (ib);
+  len = streamer_read_hwi (ib);
   gcc_assert (len == (int) len);
   if (len > 0)
     {
@@ -522,7 +522,7 @@ input_eh_regions (struct lto_input_block *ib, struct data_in *data_in,
     }
 
   /* Read the landing pads.  */
-  len = lto_input_sleb128 (ib);
+  len = streamer_read_hwi (ib);
   gcc_assert (len == (int) len);
   if (len > 0)
     {
@@ -535,7 +535,7 @@ input_eh_regions (struct lto_input_block *ib, struct data_in *data_in,
     }
 
   /* Read the runtime type data.  */
-  len = lto_input_sleb128 (ib);
+  len = streamer_read_hwi (ib);
   gcc_assert (len == (int) len);
   if (len > 0)
     {
@@ -548,7 +548,7 @@ input_eh_regions (struct lto_input_block *ib, struct data_in *data_in,
     }
 
   /* Read the table of action chains.  */
-  len = lto_input_sleb128 (ib);
+  len = streamer_read_hwi (ib);
   gcc_assert (len == (int) len);
   if (len > 0)
     {
@@ -566,7 +566,7 @@ input_eh_regions (struct lto_input_block *ib, struct data_in *data_in,
          VEC_safe_grow (uchar, gc, fn->eh->ehspec_data.other, len);
          for (i = 0; i < len; i++)
            {
-             uchar c = lto_input_1_unsigned (ib);
+             uchar c = streamer_read_uchar (ib);
              VEC_replace (uchar, fn->eh->ehspec_data.other, i, c);
            }
        }
@@ -576,7 +576,7 @@ input_eh_regions (struct lto_input_block *ib, struct data_in *data_in,
      pointers.  */
   fixup_eh_region_pointers (fn, root_region);
 
-  tag = input_record_start (ib);
+  tag = streamer_read_record_start (ib);
   lto_tag_check_range (tag, LTO_null, LTO_null);
 }
 
@@ -611,9 +611,10 @@ input_cfg (struct lto_input_block *ib, struct function *fn,
   init_empty_tree_cfg_for_function (fn);
   init_ssa_operands ();
 
-  profile_status_for_function (fn) = lto_input_enum (ib, profile_status_d, PROFILE_LAST);
+  profile_status_for_function (fn) = streamer_read_enum (ib, profile_status_d,
+                                                        PROFILE_LAST);
 
-  bb_count = lto_input_uleb128 (ib);
+  bb_count = streamer_read_uhwi (ib);
 
   last_basic_block_for_function (fn) = bb_count;
   if (bb_count > VEC_length (basic_block, basic_block_info_for_function (fn)))
@@ -624,7 +625,7 @@ input_cfg (struct lto_input_block *ib, struct function *fn,
     VEC_safe_grow_cleared (basic_block, gc,
                           label_to_block_map_for_function (fn), bb_count);
 
-  index = lto_input_sleb128 (ib);
+  index = streamer_read_hwi (ib);
   while (index != -1)
     {
       basic_block bb = BASIC_BLOCK_FOR_FUNCTION (fn, index);
@@ -633,7 +634,7 @@ input_cfg (struct lto_input_block *ib, struct function *fn,
       if (bb == NULL)
        bb = make_new_block (fn, index);
 
-      edge_count = lto_input_uleb128 (ib);
+      edge_count = streamer_read_uhwi (ib);
 
       /* Connect up the CFG.  */
       for (i = 0; i < edge_count; i++)
@@ -645,11 +646,11 @@ input_cfg (struct lto_input_block *ib, struct function *fn,
          gcov_type count;
          edge e;
 
-         dest_index = lto_input_uleb128 (ib);
-         probability = (int) lto_input_sleb128 (ib);
-         count = ((gcov_type) lto_input_sleb128 (ib) * count_materialization_scale
+         dest_index = streamer_read_uhwi (ib);
+         probability = (int) streamer_read_hwi (ib);
+         count = ((gcov_type) streamer_read_hwi (ib) * count_materialization_scale
                   + REG_BR_PROB_BASE / 2) / REG_BR_PROB_BASE;
-         edge_flags = lto_input_uleb128 (ib);
+         edge_flags = streamer_read_uhwi (ib);
 
          dest = BASIC_BLOCK_FOR_FUNCTION (fn, dest_index);
 
@@ -661,18 +662,18 @@ input_cfg (struct lto_input_block *ib, struct function *fn,
          e->count = count;
        }
 
-      index = lto_input_sleb128 (ib);
+      index = streamer_read_hwi (ib);
     }
 
   p_bb = ENTRY_BLOCK_PTR_FOR_FUNCTION(fn);
-  index = lto_input_sleb128 (ib);
+  index = streamer_read_hwi (ib);
   while (index != -1)
     {
       basic_block bb = BASIC_BLOCK_FOR_FUNCTION (fn, index);
       bb->prev_bb = p_bb;
       p_bb->next_bb = bb;
       p_bb = bb;
-      index = lto_input_sleb128 (ib);
+      index = streamer_read_hwi (ib);
     }
 }
 
@@ -686,10 +687,10 @@ input_ssa_names (struct lto_input_block *ib, struct data_in *data_in,
 {
   unsigned int i, size;
 
-  size = lto_input_uleb128 (ib);
+  size = streamer_read_uhwi (ib);
   init_ssanames (fn, size);
 
-  i = lto_input_uleb128 (ib);
+  i = streamer_read_uhwi (ib);
   while (i)
     {
       tree ssa_name, name;
@@ -699,14 +700,14 @@ input_ssa_names (struct lto_input_block *ib, struct data_in *data_in,
       while (VEC_length (tree, SSANAMES (fn)) < i)
        VEC_quick_push (tree, SSANAMES (fn), NULL_TREE);
 
-      is_default_def = (lto_input_1_unsigned (ib) != 0);
+      is_default_def = (streamer_read_uchar (ib) != 0);
       name = stream_read_tree (ib, data_in);
       ssa_name = make_ssa_name_fn (fn, name, gimple_build_nop ());
 
       if (is_default_def)
        set_default_def (SSA_NAME_VAR (ssa_name), ssa_name);
 
-      i = lto_input_uleb128 (ib);
+      i = streamer_read_uhwi (ib);
     }
 }
 
@@ -769,14 +770,14 @@ input_function (tree fn_decl, struct data_in *data_in,
   int len;
 
   fn = DECL_STRUCT_FUNCTION (fn_decl);
-  tag = input_record_start (ib);
+  tag = streamer_read_record_start (ib);
   clear_line_info (data_in);
 
   gimple_register_cfg_hooks ();
   lto_tag_check (tag, LTO_function);
 
   /* Read all the attributes for FN.  */
-  bp = lto_input_bitpack (ib);
+  bp = streamer_read_bitpack (ib);
   fn->is_thunk = bp_unpack_value (&bp, 1);
   fn->has_local_explicit_reg_vars = bp_unpack_value (&bp, 1);
   fn->after_tree_profile = bp_unpack_value (&bp, 1);
@@ -797,14 +798,14 @@ input_function (tree fn_decl, struct data_in *data_in,
   fn->function_end_locus = lto_input_location (ib, data_in);
 
   /* Input the current IL state of the function.  */
-  fn->curr_properties = lto_input_uleb128 (ib);
+  fn->curr_properties = streamer_read_uhwi (ib);
 
   /* Read the static chain and non-local goto save area.  */
   fn->static_chain_decl = stream_read_tree (ib, data_in);
   fn->nonlocal_goto_save_area = stream_read_tree (ib, data_in);
 
   /* Read all the local symbols.  */
-  len = lto_input_sleb128 (ib);
+  len = streamer_read_hwi (ib);
   if (len > 0)
     {
       int i;
@@ -825,10 +826,10 @@ input_function (tree fn_decl, struct data_in *data_in,
     {
       unsigned ix;
       bool res;
-      res = lto_streamer_cache_lookup (data_in->reader_cache, oarg, &ix);
+      res = streamer_tree_cache_lookup (data_in->reader_cache, oarg, &ix);
       gcc_assert (res);
       /* Replace the argument in the streamer cache.  */
-      lto_streamer_cache_insert_at (data_in->reader_cache, narg, ix);
+      streamer_tree_cache_insert_at (data_in->reader_cache, narg, ix);
     }
   gcc_assert (!oarg && !narg);
 
@@ -845,12 +846,12 @@ input_function (tree fn_decl, struct data_in *data_in,
   node = cgraph_get_create_node (fn_decl);
 
   /* Read all the basic blocks.  */
-  tag = input_record_start (ib);
+  tag = streamer_read_record_start (ib);
   while (tag)
     {
       input_bb (ib, tag, data_in, fn,
                node->count_materialization_scale);
-      tag = input_record_start (ib);
+      tag = streamer_read_record_start (ib);
     }
 
   /* Fix up the call statements that are mentioned in the callgraph
@@ -1052,20 +1053,20 @@ lto_read_tree (struct lto_input_block *ib, struct data_in *data_in,
               enum LTO_tags tag)
 {
   /* Instantiate a new tree node.  */
-  tree result = lto_materialize_tree (ib, data_in, tag);
+  tree result = streamer_alloc_tree (ib, data_in, tag);
 
   /* Enter RESULT in the reader cache.  This will make RESULT
      available so that circular references in the rest of the tree
      structure can be resolved in subsequent calls to stream_read_tree.  */
-  lto_streamer_cache_append (data_in->reader_cache, result);
+  streamer_tree_cache_append (data_in->reader_cache, result);
 
   /* Read all the bitfield values in RESULT.  Note that for LTO, we
      only write language-independent bitfields, so no more unpacking is
      needed.  */
-  tree_read_bitfields (ib, result);
+  streamer_read_tree_bitfields (ib, result);
 
   /* Read all the pointer fields in RESULT.  */
-  lto_input_tree_pointers (ib, data_in, result);
+  streamer_read_tree_body (ib, data_in, result);
 
   /* Read any LTO-specific data not read by the tree streamer.  */
   if (DECL_P (result)
@@ -1075,13 +1076,13 @@ lto_read_tree (struct lto_input_block *ib, struct data_in *data_in,
 
   /* We should never try to instantiate an MD or NORMAL builtin here.  */
   if (TREE_CODE (result) == FUNCTION_DECL)
-    gcc_assert (!lto_stream_as_builtin_p (result));
+    gcc_assert (!streamer_handle_as_builtin_p (result));
 
-  /* end_marker = */ lto_input_1_unsigned (ib);
+  /* end_marker = */ streamer_read_uchar (ib);
 
 #ifdef LTO_STREAMER_DEBUG
   /* Remove the mapping to RESULT's original address set by
-     lto_materialize_tree.  */
+     streamer_alloc_tree.  */
   lto_orig_address_remove (result);
 #endif
 
@@ -1099,7 +1100,7 @@ lto_input_tree (struct lto_input_block *ib, struct data_in *data_in)
   enum LTO_tags tag;
   tree result;
 
-  tag = input_record_start (ib);
+  tag = streamer_read_record_start (ib);
   gcc_assert ((unsigned) tag < (unsigned) LTO_NUM_TAGS);
 
   if (tag == LTO_null)
@@ -1115,19 +1116,19 @@ lto_input_tree (struct lto_input_block *ib, struct data_in *data_in)
     {
       /* If TAG is a reference to a previously read tree, look it up in
         the reader cache.  */
-      result = lto_get_pickled_tree (ib, data_in);
+      result = streamer_get_pickled_tree (ib, data_in);
     }
   else if (tag == LTO_builtin_decl)
     {
       /* If we are going to read a built-in function, all we need is
         the code and class.  */
-      result = lto_get_builtin_tree (ib, data_in);
+      result = streamer_get_builtin_tree (ib, data_in);
     }
   else if (tag == lto_tree_code_to_tag (INTEGER_CST))
     {
       /* For integer constants we only need the type and its hi/low
         words.  */
-      result = lto_input_integer_cst (ib, data_in);
+      result = streamer_read_integer_cst (ib, data_in);
     }
   else
     {
@@ -1164,7 +1165,7 @@ lto_data_in_create (struct lto_file_decl_data *file_data, const char *strings,
   data_in->strings = strings;
   data_in->strings_len = len;
   data_in->globals_resolution = resolutions;
-  data_in->reader_cache = lto_streamer_cache_create ();
+  data_in->reader_cache = streamer_tree_cache_create ();
 
   return data_in;
 }
@@ -1176,7 +1177,7 @@ void
 lto_data_in_delete (struct data_in *data_in)
 {
   VEC_free (ld_plugin_symbol_resolution_t, heap, data_in->globals_resolution);
-  lto_streamer_cache_delete (data_in->reader_cache);
+  streamer_tree_cache_delete (data_in->reader_cache);
   free (data_in->labels);
   free (data_in);
 }
index 14bf878724555480ae0c59e42e43c20c27f5d7e6..a8d60073c773cac57b2f3455d121e92df6b2acb9 100644 (file)
@@ -70,7 +70,7 @@ create_output_block (enum lto_section_type section_type)
   ob->decl_state = lto_get_out_decl_state ();
   ob->main_stream = XCNEW (struct lto_output_stream);
   ob->string_stream = XCNEW (struct lto_output_stream);
-  ob->writer_cache = lto_streamer_cache_create ();
+  ob->writer_cache = streamer_tree_cache_create ();
 
   if (section_type == LTO_section_function_body)
     ob->cfg_stream = XCNEW (struct lto_output_stream);
@@ -99,7 +99,7 @@ destroy_output_block (struct output_block *ob)
   if (section_type == LTO_section_function_body)
     free (ob->cfg_stream);
 
-  lto_streamer_cache_delete (ob->writer_cache);
+  streamer_tree_cache_delete (ob->writer_cache);
   obstack_free (&ob->obstack, NULL);
 
   free (ob);
@@ -111,7 +111,7 @@ destroy_output_block (struct output_block *ob)
 static void
 output_type_ref (struct output_block *ob, tree node)
 {
-  output_record_start (ob, LTO_type_ref);
+  streamer_write_record_start (ob, LTO_type_ref);
   lto_output_type_ref_index (ob->decl_state, ob->main_stream, node);
 }
 
@@ -153,10 +153,10 @@ lto_output_location_bitpack (struct bitpack_d *bp,
 
   bp_pack_value (bp, ob->current_file != xloc.file, 1);
   if (ob->current_file != xloc.file)
-    bp_pack_var_len_unsigned (bp, lto_string_index (ob,
-                                                   xloc.file,
-                                                   strlen (xloc.file) + 1,
-                                                   true));
+    bp_pack_var_len_unsigned (bp,
+                             streamer_string_index (ob, xloc.file,
+                                                    strlen (xloc.file) + 1,
+                                                    true));
   ob->current_file = xloc.file;
 
   bp_pack_value (bp, ob->current_line != xloc.line, 1);
@@ -180,7 +180,7 @@ lto_output_location (struct output_block *ob, location_t loc)
 {
   struct bitpack_d bp = bitpack_create (ob->main_stream);
   lto_output_location_bitpack (&bp, ob, loc);
-  lto_output_bitpack (&bp);
+  streamer_write_bitpack (&bp);
 }
 
 
@@ -203,60 +203,60 @@ lto_output_tree_ref (struct output_block *ob, tree expr)
   switch (code)
     {
     case SSA_NAME:
-      output_record_start (ob, LTO_ssa_name_ref);
-      output_uleb128 (ob, SSA_NAME_VERSION (expr));
+      streamer_write_record_start (ob, LTO_ssa_name_ref);
+      streamer_write_uhwi (ob, SSA_NAME_VERSION (expr));
       break;
 
     case FIELD_DECL:
-      output_record_start (ob, LTO_field_decl_ref);
+      streamer_write_record_start (ob, LTO_field_decl_ref);
       lto_output_field_decl_index (ob->decl_state, ob->main_stream, expr);
       break;
 
     case FUNCTION_DECL:
-      output_record_start (ob, LTO_function_decl_ref);
+      streamer_write_record_start (ob, LTO_function_decl_ref);
       lto_output_fn_decl_index (ob->decl_state, ob->main_stream, expr);
       break;
 
     case VAR_DECL:
     case DEBUG_EXPR_DECL:
       gcc_assert (decl_function_context (expr) == NULL || TREE_STATIC (expr));
-      output_record_start (ob, LTO_global_decl_ref);
+      streamer_write_record_start (ob, LTO_global_decl_ref);
       lto_output_var_decl_index (ob->decl_state, ob->main_stream, expr);
       break;
 
     case CONST_DECL:
-      output_record_start (ob, LTO_const_decl_ref);
+      streamer_write_record_start (ob, LTO_const_decl_ref);
       lto_output_var_decl_index (ob->decl_state, ob->main_stream, expr);
       break;
 
     case IMPORTED_DECL:
       gcc_assert (decl_function_context (expr) == NULL);
-      output_record_start (ob, LTO_imported_decl_ref);
+      streamer_write_record_start (ob, LTO_imported_decl_ref);
       lto_output_var_decl_index (ob->decl_state, ob->main_stream, expr);
       break;
 
     case TYPE_DECL:
-      output_record_start (ob, LTO_type_decl_ref);
+      streamer_write_record_start (ob, LTO_type_decl_ref);
       lto_output_type_decl_index (ob->decl_state, ob->main_stream, expr);
       break;
 
     case NAMESPACE_DECL:
-      output_record_start (ob, LTO_namespace_decl_ref);
+      streamer_write_record_start (ob, LTO_namespace_decl_ref);
       lto_output_namespace_decl_index (ob->decl_state, ob->main_stream, expr);
       break;
 
     case LABEL_DECL:
-      output_record_start (ob, LTO_label_decl_ref);
+      streamer_write_record_start (ob, LTO_label_decl_ref);
       lto_output_var_decl_index (ob->decl_state, ob->main_stream, expr);
       break;
 
     case RESULT_DECL:
-      output_record_start (ob, LTO_result_decl_ref);
+      streamer_write_record_start (ob, LTO_result_decl_ref);
       lto_output_var_decl_index (ob->decl_state, ob->main_stream, expr);
       break;
 
     case TRANSLATION_UNIT_DECL:
-      output_record_start (ob, LTO_translation_unit_decl_ref);
+      streamer_write_record_start (ob, LTO_translation_unit_decl_ref);
       lto_output_var_decl_index (ob->decl_state, ob->main_stream, expr);
       break;
 
@@ -311,16 +311,16 @@ lto_write_tree (struct output_block *ob, tree expr, bool ref_p)
 
   /* Write the header, containing everything needed to materialize
      EXPR on the reading side.  */
-  lto_output_tree_header (ob, expr);
+  streamer_write_tree_header (ob, expr);
 
   /* Pack all the non-pointer fields in EXPR into a bitpack and write
      the resulting bitpack.  */
   bp = bitpack_create (ob->main_stream);
-  pack_value_fields (&bp, expr);
-  lto_output_bitpack (&bp);
+  streamer_pack_tree_bitfields (&bp, expr);
+  streamer_write_bitpack (&bp);
 
   /* Write all the pointer fields in EXPR.  */
-  lto_output_tree_pointers (ob, expr, ref_p);
+  streamer_write_tree_body (ob, expr, ref_p);
 
   /* Write any LTO-specific data to OB.  */
   if (DECL_P (expr)
@@ -349,7 +349,7 @@ lto_write_tree (struct output_block *ob, tree expr, bool ref_p)
     }
 
   /* Mark the end of EXPR.  */
-  output_zero (ob);
+  streamer_write_zero (ob);
 }
 
 
@@ -365,7 +365,7 @@ lto_output_tree (struct output_block *ob, tree expr, bool ref_p)
 
   if (expr == NULL_TREE)
     {
-      output_record_start (ob, LTO_null);
+      streamer_write_record_start (ob, LTO_null);
       return;
     }
 
@@ -379,29 +379,29 @@ lto_output_tree (struct output_block *ob, tree expr, bool ref_p)
      to be materialized by the reader (to implement TYPE_CACHED_VALUES).  */
   if (TREE_CODE (expr) == INTEGER_CST)
     {
-      lto_output_integer_cst (ob, expr, ref_p);
+      streamer_write_integer_cst (ob, expr, ref_p);
       return;
     }
 
-  existed_p = lto_streamer_cache_insert (ob->writer_cache, expr, &ix);
+  existed_p = streamer_tree_cache_insert (ob->writer_cache, expr, &ix);
   if (existed_p)
     {
       /* If a node has already been streamed out, make sure that
         we don't write it more than once.  Otherwise, the reader
         will instantiate two different nodes for the same object.  */
-      output_record_start (ob, LTO_tree_pickle_reference);
-      output_uleb128 (ob, ix);
-      lto_output_enum (ob->main_stream, LTO_tags, LTO_NUM_TAGS,
-                      lto_tree_code_to_tag (TREE_CODE (expr)));
+      streamer_write_record_start (ob, LTO_tree_pickle_reference);
+      streamer_write_uhwi (ob, ix);
+      streamer_write_enum (ob->main_stream, LTO_tags, LTO_NUM_TAGS,
+                          lto_tree_code_to_tag (TREE_CODE (expr)));
     }
-  else if (lto_stream_as_builtin_p (expr))
+  else if (streamer_handle_as_builtin_p (expr))
     {
       /* MD and NORMAL builtins do not need to be written out
         completely as they are always instantiated by the
         compiler on startup.  The only builtins that need to
         be written out are BUILT_IN_FRONTEND.  For all other
         builtins, we simply write the class and code.  */
-      lto_output_builtin_tree (ob, expr);
+      streamer_write_builtin (ob, expr);
     }
   else
     {
@@ -421,13 +421,13 @@ output_eh_try_list (struct output_block *ob, eh_catch first)
 
   for (n = first; n; n = n->next_catch)
     {
-      output_record_start (ob, LTO_eh_catch);
+      streamer_write_record_start (ob, LTO_eh_catch);
       stream_write_tree (ob, n->type_list, true);
       stream_write_tree (ob, n->filter_list, true);
       stream_write_tree (ob, n->label, true);
     }
 
-  output_record_start (ob, LTO_null);
+  streamer_write_record_start (ob, LTO_null);
 }
 
 
@@ -442,7 +442,7 @@ output_eh_region (struct output_block *ob, eh_region r)
 
   if (r == NULL)
     {
-      output_record_start (ob, LTO_null);
+      streamer_write_record_start (ob, LTO_null);
       return;
     }
 
@@ -457,23 +457,23 @@ output_eh_region (struct output_block *ob, eh_region r)
   else
     gcc_unreachable ();
 
-  output_record_start (ob, tag);
-  output_sleb128 (ob, r->index);
+  streamer_write_record_start (ob, tag);
+  streamer_write_hwi (ob, r->index);
 
   if (r->outer)
-    output_sleb128 (ob, r->outer->index);
+    streamer_write_hwi (ob, r->outer->index);
   else
-    output_zero (ob);
+    streamer_write_zero (ob);
 
   if (r->inner)
-    output_sleb128 (ob, r->inner->index);
+    streamer_write_hwi (ob, r->inner->index);
   else
-    output_zero (ob);
+    streamer_write_zero (ob);
 
   if (r->next_peer)
-    output_sleb128 (ob, r->next_peer->index);
+    streamer_write_hwi (ob, r->next_peer->index);
   else
-    output_zero (ob);
+    streamer_write_zero (ob);
 
   if (r->type == ERT_TRY)
     {
@@ -483,7 +483,7 @@ output_eh_region (struct output_block *ob, eh_region r)
     {
       stream_write_tree (ob, r->u.allowed.type_list, true);
       stream_write_tree (ob, r->u.allowed.label, true);
-      output_uleb128 (ob, r->u.allowed.filter);
+      streamer_write_uhwi (ob, r->u.allowed.filter);
     }
   else if (r->type == ERT_MUST_NOT_THROW)
     {
@@ -492,9 +492,9 @@ output_eh_region (struct output_block *ob, eh_region r)
     }
 
   if (r->landing_pads)
-    output_sleb128 (ob, r->landing_pads->index);
+    streamer_write_hwi (ob, r->landing_pads->index);
   else
-    output_zero (ob);
+    streamer_write_zero (ob);
 }
 
 
@@ -505,21 +505,21 @@ output_eh_lp (struct output_block *ob, eh_landing_pad lp)
 {
   if (lp == NULL)
     {
-      output_record_start (ob, LTO_null);
+      streamer_write_record_start (ob, LTO_null);
       return;
     }
 
-  output_record_start (ob, LTO_eh_landing_pad);
-  output_sleb128 (ob, lp->index);
+  streamer_write_record_start (ob, LTO_eh_landing_pad);
+  streamer_write_hwi (ob, lp->index);
   if (lp->next_lp)
-    output_sleb128 (ob, lp->next_lp->index);
+    streamer_write_hwi (ob, lp->next_lp->index);
   else
-    output_zero (ob);
+    streamer_write_zero (ob);
 
   if (lp->region)
-    output_sleb128 (ob, lp->region->index);
+    streamer_write_hwi (ob, lp->region->index);
   else
-    output_zero (ob);
+    streamer_write_zero (ob);
 
   stream_write_tree (ob, lp->post_landing_pad, true);
 }
@@ -537,23 +537,23 @@ output_eh_regions (struct output_block *ob, struct function *fn)
       eh_landing_pad lp;
       tree ttype;
 
-      output_record_start (ob, LTO_eh_table);
+      streamer_write_record_start (ob, LTO_eh_table);
 
       /* Emit the index of the root of the EH region tree.  */
-      output_sleb128 (ob, fn->eh->region_tree->index);
+      streamer_write_hwi (ob, fn->eh->region_tree->index);
 
       /* Emit all the EH regions in the region array.  */
-      output_sleb128 (ob, VEC_length (eh_region, fn->eh->region_array));
+      streamer_write_hwi (ob, VEC_length (eh_region, fn->eh->region_array));
       FOR_EACH_VEC_ELT (eh_region, fn->eh->region_array, i, eh)
        output_eh_region (ob, eh);
 
       /* Emit all landing pads.  */
-      output_sleb128 (ob, VEC_length (eh_landing_pad, fn->eh->lp_array));
+      streamer_write_hwi (ob, VEC_length (eh_landing_pad, fn->eh->lp_array));
       FOR_EACH_VEC_ELT (eh_landing_pad, fn->eh->lp_array, i, lp)
        output_eh_lp (ob, lp);
 
       /* Emit all the runtime type data.  */
-      output_sleb128 (ob, VEC_length (tree, fn->eh->ttype_data));
+      streamer_write_hwi (ob, VEC_length (tree, fn->eh->ttype_data));
       FOR_EACH_VEC_ELT (tree, fn->eh->ttype_data, i, ttype)
        stream_write_tree (ob, ttype, true);
 
@@ -561,22 +561,24 @@ output_eh_regions (struct output_block *ob, struct function *fn)
       if (targetm.arm_eabi_unwinder)
        {
          tree t;
-         output_sleb128 (ob, VEC_length (tree, fn->eh->ehspec_data.arm_eabi));
+         streamer_write_hwi (ob, VEC_length (tree,
+                                             fn->eh->ehspec_data.arm_eabi));
          FOR_EACH_VEC_ELT (tree, fn->eh->ehspec_data.arm_eabi, i, t)
            stream_write_tree (ob, t, true);
        }
       else
        {
          uchar c;
-         output_sleb128 (ob, VEC_length (uchar, fn->eh->ehspec_data.other));
+         streamer_write_hwi (ob, VEC_length (uchar,
+                                             fn->eh->ehspec_data.other));
          FOR_EACH_VEC_ELT (uchar, fn->eh->ehspec_data.other, i, c)
-           lto_output_1_stream (ob->main_stream, c);
+           streamer_write_char_stream (ob->main_stream, c);
        }
     }
 
   /* The LTO_null either terminates the record or indicates that there
      are no eh_records at all.  */
-  output_record_start (ob, LTO_null);
+  streamer_write_record_start (ob, LTO_null);
 }
 
 
@@ -588,7 +590,7 @@ output_ssa_names (struct output_block *ob, struct function *fn)
   unsigned int i, len;
 
   len = VEC_length (tree, SSANAMES (fn));
-  output_uleb128 (ob, len);
+  streamer_write_uhwi (ob, len);
 
   for (i = 1; i < len; i++)
     {
@@ -599,12 +601,13 @@ output_ssa_names (struct output_block *ob, struct function *fn)
          || !is_gimple_reg (ptr))
        continue;
 
-      output_uleb128 (ob, i);
-      lto_output_1_stream (ob->main_stream, SSA_NAME_IS_DEFAULT_DEF (ptr));
+      streamer_write_uhwi (ob, i);
+      streamer_write_char_stream (ob->main_stream,
+                                 SSA_NAME_IS_DEFAULT_DEF (ptr));
       stream_write_tree (ob, SSA_NAME_VAR (ptr), true);
     }
 
-  output_zero (ob);
+  streamer_write_zero (ob);
 }
 
 
@@ -618,40 +621,40 @@ output_cfg (struct output_block *ob, struct function *fn)
 
   ob->main_stream = ob->cfg_stream;
 
-  lto_output_enum (ob->main_stream, profile_status_d, PROFILE_LAST,
-                  profile_status_for_function (fn));
+  streamer_write_enum (ob->main_stream, profile_status_d, PROFILE_LAST,
+                      profile_status_for_function (fn));
 
   /* Output the number of the highest basic block.  */
-  output_uleb128 (ob, last_basic_block_for_function (fn));
+  streamer_write_uhwi (ob, last_basic_block_for_function (fn));
 
   FOR_ALL_BB_FN (bb, fn)
     {
       edge_iterator ei;
       edge e;
 
-      output_sleb128 (ob, bb->index);
+      streamer_write_hwi (ob, bb->index);
 
       /* Output the successors and the edge flags.  */
-      output_uleb128 (ob, EDGE_COUNT (bb->succs));
+      streamer_write_uhwi (ob, EDGE_COUNT (bb->succs));
       FOR_EACH_EDGE (e, ei, bb->succs)
        {
-         output_uleb128 (ob, e->dest->index);
-         output_sleb128 (ob, e->probability);
-         output_sleb128 (ob, e->count);
-         output_uleb128 (ob, e->flags);
+         streamer_write_uhwi (ob, e->dest->index);
+         streamer_write_hwi (ob, e->probability);
+         streamer_write_hwi (ob, e->count);
+         streamer_write_uhwi (ob, e->flags);
        }
     }
 
-  output_sleb128 (ob, -1);
+  streamer_write_hwi (ob, -1);
 
   bb = ENTRY_BLOCK_PTR;
   while (bb->next_bb)
     {
-      output_sleb128 (ob, bb->next_bb->index);
+      streamer_write_hwi (ob, bb->next_bb->index);
       bb = bb->next_bb;
     }
 
-  output_sleb128 (ob, -1);
+  streamer_write_hwi (ob, -1);
 
   ob->main_stream = tmp_stream;
 }
@@ -737,9 +740,9 @@ output_function (struct cgraph_node *node)
   push_cfun (fn);
 
   /* Make string 0 be a NULL string.  */
-  lto_output_1_stream (ob->string_stream, 0);
+  streamer_write_char_stream (ob->string_stream, 0);
 
-  output_record_start (ob, LTO_function);
+  streamer_write_record_start (ob, LTO_function);
 
   /* Write all the attributes for FN.  */
   bp = bitpack_create (ob->main_stream);
@@ -757,21 +760,21 @@ output_function (struct cgraph_node *node)
   bp_pack_value (&bp, fn->calls_setjmp, 1);
   bp_pack_value (&bp, fn->va_list_fpr_size, 8);
   bp_pack_value (&bp, fn->va_list_gpr_size, 8);
-  lto_output_bitpack (&bp);
+  streamer_write_bitpack (&bp);
 
   /* Output the function start and end loci.  */
   lto_output_location (ob, fn->function_start_locus);
   lto_output_location (ob, fn->function_end_locus);
 
   /* Output current IL state of the function.  */
-  output_uleb128 (ob, fn->curr_properties);
+  streamer_write_uhwi (ob, fn->curr_properties);
 
   /* Output the static chain and non-local goto save area.  */
   stream_write_tree (ob, fn->static_chain_decl, true);
   stream_write_tree (ob, fn->nonlocal_goto_save_area, true);
 
   /* Output all the local variables in the function.  */
-  output_sleb128 (ob, VEC_length (tree, fn->local_decls));
+  streamer_write_hwi (ob, VEC_length (tree, fn->local_decls));
   FOR_EACH_VEC_ELT (tree, fn->local_decls, i, t)
     stream_write_tree (ob, t, true);
 
@@ -810,7 +813,7 @@ output_function (struct cgraph_node *node)
     output_bb (ob, bb, fn);
 
   /* The terminator for this function.  */
-  output_record_start (ob, LTO_null);
+  streamer_write_record_start (ob, LTO_null);
 
   output_cfg (ob, fn);
 
@@ -907,7 +910,7 @@ output_unreferenced_globals (cgraph_node_set set, varpool_node_set vset)
   clear_line_info (ob);
 
   /* Make string 0 be a NULL string.  */
-  lto_output_1_stream (ob->string_stream, 0);
+  streamer_write_char_stream (ob->string_stream, 0);
 
   /* We really need to propagate in both directoins:
      for normal aliases we propagate from first defined alias to
@@ -924,7 +927,7 @@ output_unreferenced_globals (cgraph_node_set set, varpool_node_set vset)
       }
   symbol_alias_set_destroy (defined);
 
-  output_record_start (ob, LTO_null);
+  streamer_write_record_start (ob, LTO_null);
 
   produce_asm (ob, NULL);
   destroy_output_block (ob);
@@ -1089,7 +1092,7 @@ write_global_stream (struct output_block *ob,
   for (index = 0; index < size; index++)
     {
       t = lto_tree_ref_encoder_get_tree (encoder, index);
-      if (!lto_streamer_cache_lookup (ob->writer_cache, t, NULL))
+      if (!streamer_tree_cache_lookup (ob->writer_cache, t, NULL))
        stream_write_tree (ob, t, false);
     }
 }
@@ -1117,7 +1120,7 @@ write_global_references (struct output_block *ob,
       uint32_t slot_num;
 
       t = lto_tree_ref_encoder_get_tree (encoder, index);
-      lto_streamer_cache_lookup (ob->writer_cache, t, &slot_num);
+      streamer_tree_cache_lookup (ob->writer_cache, t, &slot_num);
       gcc_assert (slot_num != (unsigned)-1);
       lto_output_data_stream (ref_stream, &slot_num, sizeof slot_num);
     }
@@ -1153,7 +1156,7 @@ lto_output_decl_state_refs (struct output_block *ob,
   /* Write reference to FUNCTION_DECL.  If there is not function,
      write reference to void_type_node. */
   decl = (state->fn_decl) ? state->fn_decl : void_type_node;
-  lto_streamer_cache_lookup (ob->writer_cache, decl, &ref);
+  streamer_tree_cache_lookup (ob->writer_cache, decl, &ref);
   gcc_assert (ref != (unsigned)-1);
   lto_output_data_stream (out_stream, &ref, sizeof (uint32_t));
 
@@ -1185,7 +1188,7 @@ lto_out_decl_state_written_size (struct lto_out_decl_state *state)
    so far.  */
 
 static void
-write_symbol (struct lto_streamer_cache_d *cache,
+write_symbol (struct streamer_tree_cache_d *cache,
              struct lto_output_stream *stream,
              tree t, struct pointer_set_t *seen, bool alias)
 {
@@ -1218,7 +1221,7 @@ write_symbol (struct lto_streamer_cache_d *cache,
     return;
   pointer_set_insert (seen, name);
 
-  lto_streamer_cache_lookup (cache, t, &slot_num);
+  streamer_tree_cache_lookup (cache, t, &slot_num);
   gcc_assert (slot_num != (unsigned)-1);
 
   if (DECL_EXTERNAL (t))
@@ -1307,7 +1310,7 @@ static void
 produce_symtab (struct output_block *ob,
                cgraph_node_set set, varpool_node_set vset)
 {
-  struct lto_streamer_cache_d *cache = ob->writer_cache;
+  struct streamer_tree_cache_d *cache = ob->writer_cache;
   char *section_name = lto_get_section_name (LTO_section_symtab, NULL, NULL);
   struct pointer_set_t *seen;
   struct cgraph_node *node;
@@ -1438,7 +1441,7 @@ produce_asm_for_decls (cgraph_node_set set, varpool_node_set vset)
   free (section_name);
 
   /* Make string 0 be a NULL string.  */
-  lto_output_1_stream (ob->string_stream, 0);
+  streamer_write_char_stream (ob->string_stream, 0);
 
   /* Write the global symbols.  */
   out_state = lto_get_out_decl_state ();
index 01a681fbd183c280b96ab6a8059b5e859fd7e834..633c3ce4d5059538854be6b7c8b35346b564a068 100644 (file)
@@ -291,7 +291,7 @@ lto_streamer_init (void)
      match exactly the structures defined in treestruct.def.  When a
      new TS_* astructure is added, the streamer should be updated to
      handle it.  */
-  check_handled_ts_structures ();
+  streamer_check_handled_ts_structures ();
 
 #ifdef LTO_STREAMER_DEBUG
   tree_htab = htab_create (31, hash_tree, eq_tree, NULL);
index 57d0be49634c51dec756e79b54cdc8851c78b0b1..190d6a3a821656323d073414b5dcd20a0d8929eb 100644 (file)
@@ -652,7 +652,7 @@ struct output_block
   bool global;
 
   /* Cache of nodes written in this section.  */
-  struct lto_streamer_cache_d *writer_cache;
+  struct streamer_tree_cache_d *writer_cache;
 
   /* All data persistent across whole duration of output block
      can go here.  */
@@ -690,7 +690,7 @@ struct data_in
   VEC(ld_plugin_symbol_resolution_t,heap) *globals_resolution;
 
   /* Cache of pickled nodes.  */
-  struct lto_streamer_cache_d *reader_cache;
+  struct streamer_tree_cache_d *reader_cache;
 };
 
 
@@ -712,10 +712,6 @@ extern const char *lto_get_section_data (struct lto_file_decl_data *,
 extern void lto_free_section_data (struct lto_file_decl_data *,
                                   enum lto_section_type,
                                   const char *, const char *, size_t);
-extern unsigned HOST_WIDE_INT lto_input_uleb128 (struct lto_input_block *);
-extern unsigned HOST_WIDEST_INT lto_input_widest_uint_uleb128 (
-                                               struct lto_input_block *);
-extern HOST_WIDE_INT lto_input_sleb128 (struct lto_input_block *);
 extern htab_t lto_create_renaming_table (void);
 extern void lto_record_renamed_decl (struct lto_file_decl_data *,
                                     const char *, const char *);
@@ -742,12 +738,6 @@ extern void lto_end_section (void);
 extern void lto_write_stream (struct lto_output_stream *);
 extern void lto_output_data_stream (struct lto_output_stream *, const void *,
                                    size_t);
-extern void lto_output_uleb128_stream (struct lto_output_stream *,
-                                              unsigned HOST_WIDE_INT);
-extern void lto_output_widest_uint_uleb128_stream (struct lto_output_stream *,
-                                                          unsigned HOST_WIDEST_INT);
-extern void lto_output_sleb128_stream (struct lto_output_stream *,
-                                      HOST_WIDE_INT);
 extern bool lto_output_decl_index (struct lto_output_stream *,
                            struct lto_tree_ref_encoder *,
                            tree, unsigned int *);
index bf2aab19c30419f865b2d809f5514bde87a1d9bd..0b1dcb9c8b53dcb34689b3949ed89d73a3493b64 100644 (file)
@@ -204,7 +204,7 @@ lto_read_in_decl_state (struct data_in *data_in, const uint32_t *data,
   uint32_t i, j;
   
   ix = *data++;
-  decl = lto_streamer_cache_get (data_in->reader_cache, ix);
+  decl = streamer_tree_cache_get (data_in->reader_cache, ix);
   if (TREE_CODE (decl) != FUNCTION_DECL)
     {
       gcc_assert (decl == void_type_node);
@@ -218,7 +218,7 @@ lto_read_in_decl_state (struct data_in *data_in, const uint32_t *data,
       tree *decls = ggc_alloc_vec_tree (size);
 
       for (j = 0; j < size; j++)
-       decls[j] = lto_streamer_cache_get (data_in->reader_cache, data[j]);
+       decls[j] = streamer_tree_cache_get (data_in->reader_cache, data[j]);
 
       state->streams[i].size = size;
       state->streams[i].trees = decls;
@@ -563,7 +563,7 @@ lto_register_var_decl_in_symtab (struct data_in *data_in, tree decl)
   if (TREE_PUBLIC (decl))
     {
       unsigned ix;
-      if (!lto_streamer_cache_lookup (data_in->reader_cache, decl, &ix))
+      if (!streamer_tree_cache_lookup (data_in->reader_cache, decl, &ix))
        gcc_unreachable ();
       lto_symtab_register_decl (decl, get_resolution (data_in, ix),
                                data_in->file_data);
@@ -629,7 +629,7 @@ lto_register_function_decl_in_symtab (struct data_in *data_in, tree decl)
   if (TREE_PUBLIC (decl) && !DECL_ABSTRACT (decl))
     {
       unsigned ix;
-      if (!lto_streamer_cache_lookup (data_in->reader_cache, decl, &ix))
+      if (!streamer_tree_cache_lookup (data_in->reader_cache, decl, &ix))
        gcc_unreachable ();
       lto_symtab_register_decl (decl, get_resolution (data_in, ix),
                                data_in->file_data);
@@ -645,7 +645,7 @@ lto_register_function_decl_in_symtab (struct data_in *data_in, tree decl)
 static void
 uniquify_nodes (struct data_in *data_in, unsigned from)
 {
-  struct lto_streamer_cache_d *cache = data_in->reader_cache;
+  struct streamer_tree_cache_d *cache = data_in->reader_cache;
   unsigned len = VEC_length (tree, cache->nodes);
   unsigned i;
 
@@ -756,7 +756,7 @@ uniquify_nodes (struct data_in *data_in, unsigned from)
                  {
                    unsigned ix;
                    gcc_assert (f1 != f2 && DECL_NAME (f1) == DECL_NAME (f2));
-                   if (!lto_streamer_cache_lookup (cache, f2, &ix))
+                   if (!streamer_tree_cache_lookup (cache, f2, &ix))
                      gcc_unreachable ();
                    /* If we're going to replace an element which we'd
                       still visit in the next iterations, we wouldn't
@@ -772,14 +772,14 @@ uniquify_nodes (struct data_in *data_in, unsigned from)
                       operand handling.  */
                    if (ix < i)
                      lto_fixup_types (f2);
-                   lto_streamer_cache_insert_at (cache, f1, ix);
+                   streamer_tree_cache_insert_at (cache, f1, ix);
                  }
            }
 
          /* If we found a tree that is equal to oldt replace it in the
             cache, so that further users (in the various LTO sections)
             make use of it.  */
-         lto_streamer_cache_insert_at (cache, t, i);
+         streamer_tree_cache_insert_at (cache, t, i);
        }
     }
 
index 6c45102376a27bdbc497c93652f481d09c5bc493..b4c65629e4758fe750ab6d6fb94fd548953c577b 100644 (file)
@@ -29,8 +29,6 @@ along with GCC; see the file COPYING3.  If not see
 struct output_block;
 struct lto_input_block;
 struct data_in;
-struct bitpack_d;
-struct lto_streamer_cache_d;
 
 /* Streamer hooks.  These functions do additional processing as
    needed by the module.  There are two types of callbacks, those that
index f2ff35f874c7e85f7a2e340ad688d9c09848c04c..efa4bd877be44947ce9c4ba97000bfa1e8c3301f 100644 (file)
@@ -34,12 +34,12 @@ along with GCC; see the file COPYING3.  If not see
    block IB.  */
 
 tree
-input_string_cst (struct data_in *data_in, struct lto_input_block *ib)
+streamer_read_string_cst (struct data_in *data_in, struct lto_input_block *ib)
 {
   unsigned int len;
   const char * ptr;
 
-  ptr = input_string_internal (data_in, ib, &len);
+  ptr = streamer_read_indexed_string (data_in, ib, &len);
   if (!ptr)
     return NULL;
   return build_string (len, ptr);
@@ -55,7 +55,7 @@ input_identifier (struct data_in *data_in, struct lto_input_block *ib)
   unsigned int len;
   const char *ptr;
 
-  ptr = input_string_internal (data_in, ib, &len);
+  ptr = streamer_read_indexed_string (data_in, ib, &len);
   if (!ptr)
     return NULL;
   return get_identifier_with_length (ptr, len);
@@ -65,14 +65,14 @@ input_identifier (struct data_in *data_in, struct lto_input_block *ib)
 /* Read a chain of tree nodes from input block IB. DATA_IN contains
    tables and descriptors for the file being read.  */
 
-static tree
-lto_input_chain (struct lto_input_block *ib, struct data_in *data_in)
+tree
+streamer_read_chain (struct lto_input_block *ib, struct data_in *data_in)
 {
   int i, count;
   tree first, prev, curr;
 
   first = prev = NULL_TREE;
-  count = lto_input_sleb128 (ib);
+  count = streamer_read_hwi (ib);
   for (i = 0; i < count; i++)
     {
       curr = stream_read_tree (ib, data_in);
@@ -96,7 +96,7 @@ static void
 unpack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
 {
   /* Note that the code for EXPR has already been unpacked to create EXPR in
-     lto_materialize_tree.  */
+     streamer_alloc_tree.  */
   if (!TYPE_P (expr))
     {
       TREE_SIDE_EFFECTS (expr) = (unsigned) bp_unpack_value (bp, 1);
@@ -409,13 +409,13 @@ unpack_value_fields (struct bitpack_d *bp, tree expr)
    bitfield values that the writer may have written.  */
 
 struct bitpack_d
-tree_read_bitfields (struct lto_input_block *ib, tree expr)
+streamer_read_tree_bitfields (struct lto_input_block *ib, tree expr)
 {
   enum tree_code code;
   struct bitpack_d bp;
 
   /* Read the bitpack of non-pointer values from IB.  */
-  bp = lto_input_bitpack (ib);
+  bp = streamer_read_bitpack (ib);
 
   /* The first word in BP contains the code of the tree that we
      are about to read.  */
@@ -435,8 +435,8 @@ tree_read_bitfields (struct lto_input_block *ib, tree expr)
    *IX_P the index into the reader cache where the new tree is stored.  */
 
 tree
-lto_materialize_tree (struct lto_input_block *ib, struct data_in *data_in,
-                     enum LTO_tags tag)
+streamer_alloc_tree (struct lto_input_block *ib, struct data_in *data_in,
+                    enum LTO_tags tag)
 {
   enum tree_code code;
   tree result;
@@ -450,7 +450,7 @@ lto_materialize_tree (struct lto_input_block *ib, struct data_in *data_in,
   /* Read the word representing the memory address for the tree
      as it was written by the writer.  This is useful when
      debugging differences between the writer and reader.  */
-  orig_address_in_writer = lto_input_sleb128 (ib);
+  orig_address_in_writer = streamer_read_hwi (ib);
   gcc_assert ((intptr_t) orig_address_in_writer == orig_address_in_writer);
 #endif
 
@@ -462,22 +462,22 @@ lto_materialize_tree (struct lto_input_block *ib, struct data_in *data_in,
 
   /* Instantiate a new tree using the header data.  */
   if (CODE_CONTAINS_STRUCT (code, TS_STRING))
-    result = input_string_cst (data_in, ib);
+    result = streamer_read_string_cst (data_in, ib);
   else if (CODE_CONTAINS_STRUCT (code, TS_IDENTIFIER))
     result = input_identifier (data_in, ib);
   else if (CODE_CONTAINS_STRUCT (code, TS_VEC))
     {
-      HOST_WIDE_INT len = lto_input_sleb128 (ib);
+      HOST_WIDE_INT len = streamer_read_hwi (ib);
       result = make_tree_vec (len);
     }
   else if (CODE_CONTAINS_STRUCT (code, TS_BINFO))
     {
-      unsigned HOST_WIDE_INT len = lto_input_uleb128 (ib);
+      unsigned HOST_WIDE_INT len = streamer_read_uhwi (ib);
       result = make_tree_binfo (len);
     }
   else if (code == CALL_EXPR)
     {
-      unsigned HOST_WIDE_INT nargs = lto_input_uleb128 (ib);
+      unsigned HOST_WIDE_INT nargs = streamer_read_uhwi (ib);
       return build_vl_exp (CALL_EXPR, nargs + 3);
     }
   else
@@ -522,7 +522,7 @@ static void
 lto_input_ts_vector_tree_pointers (struct lto_input_block *ib,
                                   struct data_in *data_in, tree expr)
 {
-  TREE_VECTOR_CST_ELTS (expr) = lto_input_chain (ib, data_in);
+  TREE_VECTOR_CST_ELTS (expr) = streamer_read_chain (ib, data_in);
 }
 
 
@@ -570,7 +570,7 @@ lto_input_ts_decl_common_tree_pointers (struct lto_input_block *ib,
      dwarf2out.c.  */
 
   if (TREE_CODE (expr) == PARM_DECL)
-    TREE_CHAIN (expr) = lto_input_chain (ib, data_in);
+    TREE_CHAIN (expr) = streamer_read_chain (ib, data_in);
 
   if ((TREE_CODE (expr) == VAR_DECL
        || TREE_CODE (expr) == PARM_DECL)
@@ -638,7 +638,7 @@ lto_input_ts_field_decl_tree_pointers (struct lto_input_block *ib,
   DECL_QUALIFIER (expr) = stream_read_tree (ib, data_in);
   DECL_FIELD_BIT_OFFSET (expr) = stream_read_tree (ib, data_in);
   DECL_FCONTEXT (expr) = stream_read_tree (ib, data_in);
-  TREE_CHAIN (expr) = lto_input_chain (ib, data_in);
+  TREE_CHAIN (expr) = streamer_read_chain (ib, data_in);
 }
 
 
@@ -724,7 +724,7 @@ lto_input_ts_list_tree_pointers (struct lto_input_block *ib,
 {
   TREE_PURPOSE (expr) = stream_read_tree (ib, data_in);
   TREE_VALUE (expr) = stream_read_tree (ib, data_in);
-  TREE_CHAIN (expr) = lto_input_chain (ib, data_in);
+  TREE_CHAIN (expr) = streamer_read_chain (ib, data_in);
 }
 
 
@@ -738,7 +738,7 @@ lto_input_ts_vec_tree_pointers (struct lto_input_block *ib,
 {
   int i;
 
-  /* Note that TREE_VEC_LENGTH was read by lto_materialize_tree to
+  /* Note that TREE_VEC_LENGTH was read by streamer_alloc_tree to
      instantiate EXPR.  */
   for (i = 0; i < TREE_VEC_LENGTH (expr); i++)
     TREE_VEC_ELT (expr, i) = stream_read_tree (ib, data_in);
@@ -757,7 +757,7 @@ lto_input_ts_exp_tree_pointers (struct lto_input_block *ib,
   int i, length;
   location_t loc;
 
-  length = lto_input_sleb128 (ib);
+  length = streamer_read_hwi (ib);
   gcc_assert (length == TREE_OPERAND_LENGTH (expr));
 
   for (i = 0; i < length; i++)
@@ -780,7 +780,7 @@ lto_input_ts_block_tree_pointers (struct lto_input_block *ib,
   /* Do not stream BLOCK_SOURCE_LOCATION.  We cannot handle debug information
      for early inlining so drop it on the floor instead of ICEing in
      dwarf2out.c.  */
-  BLOCK_VARS (expr) = lto_input_chain (ib, data_in);
+  BLOCK_VARS (expr) = streamer_read_chain (ib, data_in);
 
   /* Do not stream BLOCK_NONLOCALIZED_VARS.  We cannot handle debug information
      for early inlining so drop it on the floor instead of ICEing in
@@ -827,7 +827,7 @@ lto_input_ts_binfo_tree_pointers (struct lto_input_block *ib,
   tree t;
 
   /* Note that the number of slots in EXPR was read in
-     lto_materialize_tree when instantiating EXPR.  However, the
+     streamer_alloc_tree when instantiating EXPR.  However, the
      vector is empty so we cannot rely on VEC_length to know how many
      elements to read.  So, this list is emitted as a 0-terminated
      list on the writer side.  */
@@ -844,7 +844,7 @@ lto_input_ts_binfo_tree_pointers (struct lto_input_block *ib,
   BINFO_VIRTUALS (expr) = stream_read_tree (ib, data_in);
   BINFO_VPTR_FIELD (expr) = stream_read_tree (ib, data_in);
 
-  len = lto_input_uleb128 (ib);
+  len = streamer_read_uhwi (ib);
   if (len > 0)
     {
       VEC_reserve_exact (tree, gc, BINFO_BASE_ACCESSES (expr), len);
@@ -871,7 +871,7 @@ lto_input_ts_constructor_tree_pointers (struct lto_input_block *ib,
 {
   unsigned i, len;
 
-  len = lto_input_uleb128 (ib);
+  len = streamer_read_uhwi (ib);
   for (i = 0; i < len; i++)
     {
       tree index, value;
@@ -892,7 +892,7 @@ lto_input_ts_target_option (struct lto_input_block *ib, tree expr)
   struct bitpack_d bp;
   struct cl_target_option *t = TREE_TARGET_OPTION (expr);
 
-  bp = lto_input_bitpack (ib);
+  bp = streamer_read_bitpack (ib);
   len = sizeof (struct cl_target_option);
   for (i = 0; i < len; i++)
     ((unsigned char *)t)[i] = bp_unpack_value (&bp, 8);
@@ -907,7 +907,7 @@ lto_input_ts_translation_unit_decl_tree_pointers (struct lto_input_block *ib,
                                                  struct data_in *data_in,
                                                  tree expr)
 {
-  TRANSLATION_UNIT_LANGUAGE (expr) = xstrdup (lto_input_string (data_in, ib));
+  TRANSLATION_UNIT_LANGUAGE (expr) = xstrdup (streamer_read_string (data_in, ib));
   VEC_safe_push (tree, gc, all_translation_units, expr);
 }
 
@@ -915,7 +915,7 @@ lto_input_ts_translation_unit_decl_tree_pointers (struct lto_input_block *ib,
    contains tables and descriptors for the file being read.  */
 
 void
-lto_input_tree_pointers (struct lto_input_block *ib, struct data_in *data_in,
+streamer_read_tree_body (struct lto_input_block *ib, struct data_in *data_in,
                         tree expr)
 {
   enum tree_code code;
@@ -985,16 +985,16 @@ lto_input_tree_pointers (struct lto_input_block *ib, struct data_in *data_in,
    context in DATA_IN.  */
 
 tree
-lto_input_integer_cst (struct lto_input_block *ib, struct data_in *data_in)
+streamer_read_integer_cst (struct lto_input_block *ib, struct data_in *data_in)
 {
   tree result, type;
   HOST_WIDE_INT low, high;
   bool overflow_p;
 
   type = stream_read_tree (ib, data_in);
-  overflow_p = (lto_input_1_unsigned (ib) != 0);
-  low = lto_input_uleb128 (ib);
-  high = lto_input_uleb128 (ib);
+  overflow_p = (streamer_read_uchar (ib) != 0);
+  low = streamer_read_uhwi (ib);
+  high = streamer_read_uhwi (ib);
   result = build_int_cst_wide (type, low, high);
 
   /* If the original constant had overflown, build a replica of RESULT to
@@ -1013,16 +1013,16 @@ lto_input_integer_cst (struct lto_input_block *ib, struct data_in *data_in)
    DATA_IN->FILE_DATA->GLOBALS_INDEX[IX].  */
 
 tree
-lto_get_pickled_tree (struct lto_input_block *ib, struct data_in *data_in)
+streamer_get_pickled_tree (struct lto_input_block *ib, struct data_in *data_in)
 {
   unsigned HOST_WIDE_INT ix;
   tree result;
   enum LTO_tags expected_tag;
 
-  ix = lto_input_uleb128 (ib);
-  expected_tag = lto_input_enum (ib, LTO_tags, LTO_NUM_TAGS);
+  ix = streamer_read_uhwi (ib);
+  expected_tag = streamer_read_enum (ib, LTO_tags, LTO_NUM_TAGS);
 
-  result = lto_streamer_cache_get (data_in->reader_cache, ix);
+  result = streamer_tree_cache_get (data_in->reader_cache, ix);
   gcc_assert (result
               && TREE_CODE (result) == lto_tag_to_tree_code (expected_tag));
 
@@ -1034,17 +1034,17 @@ lto_get_pickled_tree (struct lto_input_block *ib, struct data_in *data_in)
    corresponding builtin.  DATA_IN is as in stream_read_tree.  */
 
 tree
-lto_get_builtin_tree (struct lto_input_block *ib, struct data_in *data_in)
+streamer_get_builtin_tree (struct lto_input_block *ib, struct data_in *data_in)
 {
   enum built_in_class fclass;
   enum built_in_function fcode;
   const char *asmname;
   tree result;
 
-  fclass = lto_input_enum (ib, built_in_class, BUILT_IN_LAST);
+  fclass = streamer_read_enum (ib, built_in_class, BUILT_IN_LAST);
   gcc_assert (fclass == BUILT_IN_NORMAL || fclass == BUILT_IN_MD);
 
-  fcode = (enum built_in_function) lto_input_uleb128 (ib);
+  fcode = (enum built_in_function) streamer_read_uhwi (ib);
 
   if (fclass == BUILT_IN_NORMAL)
     {
@@ -1062,11 +1062,11 @@ lto_get_builtin_tree (struct lto_input_block *ib, struct data_in *data_in)
   else
     gcc_unreachable ();
 
-  asmname = lto_input_string (data_in, ib);
+  asmname = streamer_read_string (data_in, ib);
   if (asmname)
     set_builtin_user_assembler_name (result, asmname);
 
-  lto_streamer_cache_append (data_in->reader_cache, result);
+  streamer_tree_cache_append (data_in->reader_cache, result);
 
   return result;
 }
index 8bab9304b747ab5d544636141cf3db97d1c9093c..61e674ab4f77f39b988606659b8e5b1a3b314dcc 100644 (file)
@@ -32,14 +32,14 @@ along with GCC; see the file COPYING3.  If not see
    table in OB.  Then put the index onto the INDEX_STREAM.  */
 
 static void
-output_string_cst (struct output_block *ob,
+write_string_cst (struct output_block *ob,
                   struct lto_output_stream *index_stream,
                   tree string)
 {
-  lto_output_string_with_length (ob, index_stream,
-                                TREE_STRING_POINTER (string),
-                                TREE_STRING_LENGTH (string),
-                                true);
+  streamer_write_string_with_length (ob, index_stream,
+                                    TREE_STRING_POINTER (string),
+                                    TREE_STRING_LENGTH (string),
+                                    true);
 }
 
 
@@ -47,14 +47,14 @@ output_string_cst (struct output_block *ob,
    table in OB.  Then put the index onto the INDEX_STREAM.  */
 
 static void
-output_identifier (struct output_block *ob,
+write_identifier (struct output_block *ob,
                   struct lto_output_stream *index_stream,
                   tree id)
 {
-  lto_output_string_with_length (ob, index_stream,
-                                IDENTIFIER_POINTER (id),
-                                IDENTIFIER_LENGTH (id),
-                                true);
+  streamer_write_string_with_length (ob, index_stream,
+                                    IDENTIFIER_POINTER (id),
+                                    IDENTIFIER_LENGTH (id),
+                                    true);
 }
 
 
@@ -235,7 +235,7 @@ pack_ts_function_decl_value_fields (struct bitpack_d *bp, tree expr)
 {
   /* For normal/md builtins we only write the class and code, so they
      should never be handled here.  */
-  gcc_assert (!lto_stream_as_builtin_p (expr));
+  gcc_assert (!streamer_handle_as_builtin_p (expr));
 
   bp_pack_enum (bp, built_in_class, BUILT_IN_LAST,
                DECL_BUILT_IN_CLASS (expr));
@@ -303,10 +303,11 @@ pack_ts_translation_unit_decl_value_fields (struct bitpack_d *bp ATTRIBUTE_UNUSE
 {
 }
 
-/* Pack all the non-pointer fields in EXPR into a bit pack.  */
+
+/* Pack all the bitfields in EXPR into a bit pack.  */
 
 void
-pack_value_fields (struct bitpack_d *bp, tree expr)
+streamer_pack_tree_bitfields (struct bitpack_d *bp, tree expr)
 {
   enum tree_code code;
 
@@ -349,19 +350,19 @@ pack_value_fields (struct bitpack_d *bp, tree expr)
    the index into the streamer cache where EXPR is stored.*/
 
 void
-lto_output_builtin_tree (struct output_block *ob, tree expr)
+streamer_write_builtin (struct output_block *ob, tree expr)
 {
-  gcc_assert (lto_stream_as_builtin_p (expr));
+  gcc_assert (streamer_handle_as_builtin_p (expr));
 
   if (DECL_BUILT_IN_CLASS (expr) == BUILT_IN_MD
       && !targetm.builtin_decl)
-    sorry ("gimple bytecode streams do not support machine specific builtin "
+    sorry ("tree bytecode streams do not support machine specific builtin "
           "functions on this target");
 
-  output_record_start (ob, LTO_builtin_decl);
-  lto_output_enum (ob->main_stream, built_in_class, BUILT_IN_LAST,
-                  DECL_BUILT_IN_CLASS (expr));
-  output_uleb128 (ob, DECL_FUNCTION_CODE (expr));
+  streamer_write_record_start (ob, LTO_builtin_decl);
+  streamer_write_enum (ob->main_stream, built_in_class, BUILT_IN_LAST,
+                      DECL_BUILT_IN_CLASS (expr));
+  streamer_write_uhwi (ob, DECL_FUNCTION_CODE (expr));
 
   if (DECL_ASSEMBLER_NAME_SET_P (expr))
     {
@@ -371,12 +372,12 @@ lto_output_builtin_tree (struct output_block *ob, tree expr)
         reader side from adding a second '*', we omit it here.  */
       const char *str = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (expr));
       if (strlen (str) > 1 && str[0] == '*')
-       lto_output_string (ob, ob->main_stream, &str[1], true);
+       streamer_write_string (ob, ob->main_stream, &str[1], true);
       else
-       lto_output_string (ob, ob->main_stream, NULL, true);
+       streamer_write_string (ob, ob->main_stream, NULL, true);
     }
   else
-    lto_output_string (ob, ob->main_stream, NULL, true);
+    streamer_write_string (ob, ob->main_stream, NULL, true);
 }
 
 
@@ -385,12 +386,12 @@ lto_output_builtin_tree (struct output_block *ob, tree expr)
    as references.  */
 
 void
-lto_output_chain (struct output_block *ob, tree t, bool ref_p)
+streamer_write_chain (struct output_block *ob, tree t, bool ref_p)
 {
   int i, count;
 
   count = list_length (t);
-  output_sleb128 (ob, count);
+  streamer_write_hwi (ob, count);
   for (i = 0; i < count; i++)
     {
       tree saved_chain;
@@ -413,8 +414,7 @@ lto_output_chain (struct output_block *ob, tree t, bool ref_p)
    fields.  */
 
 static void
-lto_output_ts_common_tree_pointers (struct output_block *ob, tree expr,
-                                   bool ref_p)
+write_ts_common_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
 {
   if (TREE_CODE (expr) != IDENTIFIER_NODE)
     stream_write_tree (ob, TREE_TYPE (expr), ref_p);
@@ -426,10 +426,9 @@ lto_output_ts_common_tree_pointers (struct output_block *ob, tree expr,
    fields.  */
 
 static void
-lto_output_ts_vector_tree_pointers (struct output_block *ob, tree expr,
-                                   bool ref_p)
+write_ts_vector_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
 {
-  lto_output_chain (ob, TREE_VECTOR_CST_ELTS (expr), ref_p);
+  streamer_write_chain (ob, TREE_VECTOR_CST_ELTS (expr), ref_p);
 }
 
 
@@ -438,8 +437,7 @@ lto_output_ts_vector_tree_pointers (struct output_block *ob, tree expr,
    fields.  */
 
 static void
-lto_output_ts_complex_tree_pointers (struct output_block *ob, tree expr,
-                                    bool ref_p)
+write_ts_complex_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
 {
   stream_write_tree (ob, TREE_REALPART (expr), ref_p);
   stream_write_tree (ob, TREE_IMAGPART (expr), ref_p);
@@ -451,8 +449,8 @@ lto_output_ts_complex_tree_pointers (struct output_block *ob, tree expr,
    pointer fields.  */
 
 static void
-lto_output_ts_decl_minimal_tree_pointers (struct output_block *ob, tree expr,
-                                         bool ref_p)
+write_ts_decl_minimal_tree_pointers (struct output_block *ob, tree expr,
+                                    bool ref_p)
 {
   stream_write_tree (ob, DECL_NAME (expr), ref_p);
   stream_write_tree (ob, DECL_CONTEXT (expr), ref_p);
@@ -465,8 +463,8 @@ lto_output_ts_decl_minimal_tree_pointers (struct output_block *ob, tree expr,
    pointer fields.  */
 
 static void
-lto_output_ts_decl_common_tree_pointers (struct output_block *ob, tree expr,
-                                        bool ref_p)
+write_ts_decl_common_tree_pointers (struct output_block *ob, tree expr,
+                                   bool ref_p)
 {
   stream_write_tree (ob, DECL_SIZE (expr), ref_p);
   stream_write_tree (ob, DECL_SIZE_UNIT (expr), ref_p);
@@ -481,7 +479,7 @@ lto_output_ts_decl_common_tree_pointers (struct output_block *ob, tree expr,
      dwarf2out.c.  */
 
   if (TREE_CODE (expr) == PARM_DECL)
-    lto_output_chain (ob, TREE_CHAIN (expr), ref_p);
+    streamer_write_chain (ob, TREE_CHAIN (expr), ref_p);
 
   if ((TREE_CODE (expr) == VAR_DECL
        || TREE_CODE (expr) == PARM_DECL)
@@ -498,8 +496,8 @@ lto_output_ts_decl_common_tree_pointers (struct output_block *ob, tree expr,
    pointer fields.  */
 
 static void
-lto_output_ts_decl_non_common_tree_pointers (struct output_block *ob,
-                                            tree expr, bool ref_p)
+write_ts_decl_non_common_tree_pointers (struct output_block *ob, tree expr,
+                                       bool ref_p)
 {
   if (TREE_CODE (expr) == FUNCTION_DECL)
     {
@@ -515,8 +513,8 @@ lto_output_ts_decl_non_common_tree_pointers (struct output_block *ob,
    pointer fields.  */
 
 static void
-lto_output_ts_decl_with_vis_tree_pointers (struct output_block *ob, tree expr,
-                                          bool ref_p)
+write_ts_decl_with_vis_tree_pointers (struct output_block *ob, tree expr,
+                                     bool ref_p)
 {
   /* Make sure we don't inadvertently set the assembler name.  */
   if (DECL_ASSEMBLER_NAME_SET_P (expr))
@@ -534,15 +532,15 @@ lto_output_ts_decl_with_vis_tree_pointers (struct output_block *ob, tree expr,
    pointer fields.  */
 
 static void
-lto_output_ts_field_decl_tree_pointers (struct output_block *ob, tree expr,
-                                       bool ref_p)
+write_ts_field_decl_tree_pointers (struct output_block *ob, tree expr,
+                                  bool ref_p)
 {
   stream_write_tree (ob, DECL_FIELD_OFFSET (expr), ref_p);
   stream_write_tree (ob, DECL_BIT_FIELD_TYPE (expr), ref_p);
   stream_write_tree (ob, DECL_QUALIFIER (expr), ref_p);
   stream_write_tree (ob, DECL_FIELD_BIT_OFFSET (expr), ref_p);
   stream_write_tree (ob, DECL_FCONTEXT (expr), ref_p);
-  lto_output_chain (ob, TREE_CHAIN (expr), ref_p);
+  streamer_write_chain (ob, TREE_CHAIN (expr), ref_p);
 }
 
 
@@ -551,8 +549,8 @@ lto_output_ts_field_decl_tree_pointers (struct output_block *ob, tree expr,
    pointer fields.  */
 
 static void
-lto_output_ts_function_decl_tree_pointers (struct output_block *ob, tree expr,
-                                          bool ref_p)
+write_ts_function_decl_tree_pointers (struct output_block *ob, tree expr,
+                                     bool ref_p)
 {
   /* DECL_STRUCT_FUNCTION is handled by lto_output_function.  FIXME lto,
      maybe it should be handled here?  */
@@ -567,8 +565,8 @@ lto_output_ts_function_decl_tree_pointers (struct output_block *ob, tree expr,
    pointer fields.  */
 
 static void
-lto_output_ts_type_common_tree_pointers (struct output_block *ob, tree expr,
-                                        bool ref_p)
+write_ts_type_common_tree_pointers (struct output_block *ob, tree expr,
+                                   bool ref_p)
 {
   stream_write_tree (ob, TYPE_SIZE (expr), ref_p);
   stream_write_tree (ob, TYPE_SIZE_UNIT (expr), ref_p);
@@ -590,8 +588,8 @@ lto_output_ts_type_common_tree_pointers (struct output_block *ob, tree expr,
    pointer fields.  */
 
 static void
-lto_output_ts_type_non_common_tree_pointers (struct output_block *ob,
-                                            tree expr, bool ref_p)
+write_ts_type_non_common_tree_pointers (struct output_block *ob, tree expr,
+                                       bool ref_p)
 {
   if (TREE_CODE (expr) == ENUMERAL_TYPE)
     stream_write_tree (ob, TYPE_VALUES (expr), ref_p);
@@ -616,12 +614,11 @@ lto_output_ts_type_non_common_tree_pointers (struct output_block *ob,
    fields.  */
 
 static void
-lto_output_ts_list_tree_pointers (struct output_block *ob, tree expr,
-                                 bool ref_p)
+write_ts_list_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
 {
   stream_write_tree (ob, TREE_PURPOSE (expr), ref_p);
   stream_write_tree (ob, TREE_VALUE (expr), ref_p);
-  lto_output_chain (ob, TREE_CHAIN (expr), ref_p);
+  streamer_write_chain (ob, TREE_CHAIN (expr), ref_p);
 }
 
 
@@ -630,12 +627,12 @@ lto_output_ts_list_tree_pointers (struct output_block *ob, tree expr,
    fields.  */
 
 static void
-lto_output_ts_vec_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
+write_ts_vec_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
 {
   int i;
 
   /* Note that the number of slots for EXPR has already been emitted
-     in EXPR's header (see lto_output_tree_header).  */
+     in EXPR's header (see streamer_write_tree_header).  */
   for (i = 0; i < TREE_VEC_LENGTH (expr); i++)
     stream_write_tree (ob, TREE_VEC_ELT (expr, i), ref_p);
 }
@@ -646,11 +643,11 @@ lto_output_ts_vec_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
    fields.  */
 
 static void
-lto_output_ts_exp_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
+write_ts_exp_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
 {
   int i;
 
-  output_sleb128 (ob, TREE_OPERAND_LENGTH (expr));
+  streamer_write_hwi (ob, TREE_OPERAND_LENGTH (expr));
   for (i = 0; i < TREE_OPERAND_LENGTH (expr); i++)
     stream_write_tree (ob, TREE_OPERAND (expr, i), ref_p);
   lto_output_location (ob, EXPR_LOCATION (expr));
@@ -663,13 +660,12 @@ lto_output_ts_exp_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
    fields.  */
 
 static void
-lto_output_ts_block_tree_pointers (struct output_block *ob, tree expr,
-                                  bool ref_p)
+write_ts_block_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
 {
   /* Do not stream BLOCK_SOURCE_LOCATION.  We cannot handle debug information
      for early inlining so drop it on the floor instead of ICEing in
      dwarf2out.c.  */
-  lto_output_chain (ob, BLOCK_VARS (expr), ref_p);
+  streamer_write_chain (ob, BLOCK_VARS (expr), ref_p);
 
   /* Do not stream BLOCK_NONLOCALIZED_VARS.  We cannot handle debug information
      for early inlining so drop it on the floor instead of ICEing in
@@ -691,14 +687,13 @@ lto_output_ts_block_tree_pointers (struct output_block *ob, tree expr,
    fields.  */
 
 static void
-lto_output_ts_binfo_tree_pointers (struct output_block *ob, tree expr,
-                                  bool ref_p)
+write_ts_binfo_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
 {
   unsigned i;
   tree t;
 
   /* Note that the number of BINFO slots has already been emitted in
-     EXPR's header (see lto_output_tree_header) because this length
+     EXPR's header (see streamer_write_tree_header) because this length
      is needed to build the empty BINFO node on the reader side.  */
   FOR_EACH_VEC_ELT (tree, BINFO_BASE_BINFOS (expr), i, t)
     stream_write_tree (ob, t, ref_p);
@@ -713,7 +708,7 @@ lto_output_ts_binfo_tree_pointers (struct output_block *ob, tree expr,
   stream_write_tree (ob, flag_wpa ? NULL : BINFO_VIRTUALS (expr), ref_p);
   stream_write_tree (ob, BINFO_VPTR_FIELD (expr), ref_p);
 
-  output_uleb128 (ob, VEC_length (tree, BINFO_BASE_ACCESSES (expr)));
+  streamer_write_uhwi (ob, VEC_length (tree, BINFO_BASE_ACCESSES (expr)));
   FOR_EACH_VEC_ELT (tree, BINFO_BASE_ACCESSES (expr), i, t)
     stream_write_tree (ob, t, ref_p);
 
@@ -728,13 +723,13 @@ lto_output_ts_binfo_tree_pointers (struct output_block *ob, tree expr,
    pointer fields.  */
 
 static void
-lto_output_ts_constructor_tree_pointers (struct output_block *ob, tree expr,
-                                        bool ref_p)
+write_ts_constructor_tree_pointers (struct output_block *ob, tree expr,
+                                   bool ref_p)
 {
   unsigned i;
   tree index, value;
 
-  output_uleb128 (ob, CONSTRUCTOR_NELTS (expr));
+  streamer_write_uhwi (ob, CONSTRUCTOR_NELTS (expr));
   FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (expr), i, index, value)
     {
       stream_write_tree (ob, index, ref_p);
@@ -745,7 +740,7 @@ lto_output_ts_constructor_tree_pointers (struct output_block *ob, tree expr,
 /* Write a TS_TARGET_OPTION tree in EXPR to OB.  */
 
 static void
-lto_output_ts_target_option (struct output_block *ob, tree expr)
+write_ts_target_option (struct output_block *ob, tree expr)
 {
   struct cl_target_option *t = TREE_TARGET_OPTION (expr);
   struct bitpack_d bp;
@@ -760,85 +755,85 @@ lto_output_ts_target_option (struct output_block *ob, tree expr)
     bp_pack_value (&bp, ((unsigned char *)t)[i], 8);
   /* Catch struct size mismatches between reader and writer. */
   bp_pack_value (&bp, 0x12345678, 32);
-  lto_output_bitpack (&bp);
+  streamer_write_bitpack (&bp);
 }
 
 /* Write a TS_TRANSLATION_UNIT_DECL tree in EXPR to OB.  */
 
 static void
-lto_output_ts_translation_unit_decl_tree_pointers (struct output_block *ob,
-                                                  tree expr)
+write_ts_translation_unit_decl_tree_pointers (struct output_block *ob,
+                                             tree expr)
 {
-  lto_output_string (ob, ob->main_stream,
-                    TRANSLATION_UNIT_LANGUAGE (expr), true);
+  streamer_write_string (ob, ob->main_stream,
+                        TRANSLATION_UNIT_LANGUAGE (expr), true);
 }
 
 /* Write all pointer fields in EXPR to output block OB.  If REF_P is true,
    the leaves of EXPR are emitted as references.  */
 
 void
-lto_output_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
+streamer_write_tree_body (struct output_block *ob, tree expr, bool ref_p)
 {
   enum tree_code code;
 
   code = TREE_CODE (expr);
 
   if (CODE_CONTAINS_STRUCT (code, TS_TYPED))
-    lto_output_ts_common_tree_pointers (ob, expr, ref_p);
+    write_ts_common_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_VECTOR))
-    lto_output_ts_vector_tree_pointers (ob, expr, ref_p);
+    write_ts_vector_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_COMPLEX))
-    lto_output_ts_complex_tree_pointers (ob, expr, ref_p);
+    write_ts_complex_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_DECL_MINIMAL))
-    lto_output_ts_decl_minimal_tree_pointers (ob, expr, ref_p);
+    write_ts_decl_minimal_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
-    lto_output_ts_decl_common_tree_pointers (ob, expr, ref_p);
+    write_ts_decl_common_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON))
-    lto_output_ts_decl_non_common_tree_pointers (ob, expr, ref_p);
+    write_ts_decl_non_common_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
-    lto_output_ts_decl_with_vis_tree_pointers (ob, expr, ref_p);
+    write_ts_decl_with_vis_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_FIELD_DECL))
-    lto_output_ts_field_decl_tree_pointers (ob, expr, ref_p);
+    write_ts_field_decl_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL))
-    lto_output_ts_function_decl_tree_pointers (ob, expr, ref_p);
+    write_ts_function_decl_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON))
-    lto_output_ts_type_common_tree_pointers (ob, expr, ref_p);
+    write_ts_type_common_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_TYPE_NON_COMMON))
-    lto_output_ts_type_non_common_tree_pointers (ob, expr, ref_p);
+    write_ts_type_non_common_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_LIST))
-    lto_output_ts_list_tree_pointers (ob, expr, ref_p);
+    write_ts_list_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_VEC))
-    lto_output_ts_vec_tree_pointers (ob, expr, ref_p);
+    write_ts_vec_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_EXP))
-    lto_output_ts_exp_tree_pointers (ob, expr, ref_p);
+    write_ts_exp_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_BLOCK))
-    lto_output_ts_block_tree_pointers (ob, expr, ref_p);
+    write_ts_block_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_BINFO))
-    lto_output_ts_binfo_tree_pointers (ob, expr, ref_p);
+    write_ts_binfo_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
-    lto_output_ts_constructor_tree_pointers (ob, expr, ref_p);
+    write_ts_constructor_tree_pointers (ob, expr, ref_p);
 
   if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
-    lto_output_ts_target_option (ob, expr);
+    write_ts_target_option (ob, expr);
 
   if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
-    lto_output_ts_translation_unit_decl_tree_pointers (ob, expr);
+    write_ts_translation_unit_decl_tree_pointers (ob, expr);
 }
 
 
@@ -848,7 +843,7 @@ lto_output_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
    where EXPR is stored.  */
 
 void
-lto_output_tree_header (struct output_block *ob, tree expr)
+streamer_write_tree_header (struct output_block *ob, tree expr)
 {
   enum LTO_tags tag;
   enum tree_code code;
@@ -861,7 +856,7 @@ lto_output_tree_header (struct output_block *ob, tree expr)
      EXPR on the reading side (such as the number of slots in
      variable sized nodes).  */
   tag = lto_tree_code_to_tag (code);
-  output_record_start (ob, tag);
+  streamer_write_record_start (ob, tag);
 
   /* The following will cause bootstrap miscomparisons.  Enable with care.  */
 #ifdef LTO_STREAMER_DEBUG
@@ -870,21 +865,21 @@ lto_output_tree_header (struct output_block *ob, tree expr)
      value for EXPR can be used to track down the differences in
      the debugger.  */
   gcc_assert ((HOST_WIDEST_INT) (intptr_t) expr == (intptr_t) expr);
-  output_sleb128 (ob, (HOST_WIDEST_INT) (intptr_t) expr);
+  streamer_write_hwi (ob, (HOST_WIDEST_INT) (intptr_t) expr);
 #endif
 
   /* The text in strings and identifiers are completely emitted in
      the header.  */
   if (CODE_CONTAINS_STRUCT (code, TS_STRING))
-    output_string_cst (ob, ob->main_stream, expr);
+    write_string_cst (ob, ob->main_stream, expr);
   else if (CODE_CONTAINS_STRUCT (code, TS_IDENTIFIER))
-    output_identifier (ob, ob->main_stream, expr);
+    write_identifier (ob, ob->main_stream, expr);
   else if (CODE_CONTAINS_STRUCT (code, TS_VEC))
-    output_sleb128 (ob, TREE_VEC_LENGTH (expr));
+    streamer_write_hwi (ob, TREE_VEC_LENGTH (expr));
   else if (CODE_CONTAINS_STRUCT (code, TS_BINFO))
-    output_uleb128 (ob, BINFO_N_BASE_BINFOS (expr));
+    streamer_write_uhwi (ob, BINFO_N_BASE_BINFOS (expr));
   else if (TREE_CODE (expr) == CALL_EXPR)
-    output_uleb128 (ob, call_expr_nargs (expr));
+    streamer_write_uhwi (ob, call_expr_nargs (expr));
 }
 
 
@@ -892,11 +887,11 @@ lto_output_tree_header (struct output_block *ob, tree expr)
    CST's type will be emitted as a reference.  */
 
 void
-lto_output_integer_cst (struct output_block *ob, tree cst, bool ref_p)
+streamer_write_integer_cst (struct output_block *ob, tree cst, bool ref_p)
 {
-  output_record_start (ob, lto_tree_code_to_tag (INTEGER_CST));
+  streamer_write_record_start (ob, lto_tree_code_to_tag (INTEGER_CST));
   stream_write_tree (ob, TREE_TYPE (cst), ref_p);
-  lto_output_1_stream (ob->main_stream, TREE_OVERFLOW_P (cst));
-  output_uleb128 (ob, TREE_INT_CST_LOW (cst));
-  output_uleb128 (ob, TREE_INT_CST_HIGH (cst));
+  streamer_write_char_stream (ob->main_stream, TREE_OVERFLOW_P (cst));
+  streamer_write_uhwi (ob, TREE_INT_CST_LOW (cst));
+  streamer_write_uhwi (ob, TREE_INT_CST_HIGH (cst));
 }
index 0517441013aeaf8c24cbf2c9d7729d8b1c696eea..94d540b59843e8cedd81228aa18a5d198b08f66c 100644 (file)
@@ -26,12 +26,12 @@ along with GCC; see the file COPYING3.  If not see
 #include "streamer-hooks.h"
 #include "tree-streamer.h"
 
-/* Check that all the TS_* structures handled by the lto_output_* and
-   lto_input_* routines are exactly ALL the structures defined in
+/* Check that all the TS_* structures handled by the streamer_write_* and
+   streamer_read_* routines are exactly ALL the structures defined in
    treestruct.def.  */
 
 void
-check_handled_ts_structures (void)
+streamer_check_handled_ts_structures (void)
 {
   bool handled_p[LAST_TS_ENUM];
   unsigned i;
@@ -87,12 +87,12 @@ check_handled_ts_structures (void)
 }
 
 
-/* Helper for lto_streamer_cache_insert_1.  Add T to CACHE->NODES at
+/* Helper for streamer_tree_cache_insert_1.  Add T to CACHE->NODES at
    slot IX.  */
 
 static void
-lto_streamer_cache_add_to_node_array (struct lto_streamer_cache_d *cache,
-                                     unsigned ix, tree t)
+streamer_tree_cache_add_to_node_array (struct streamer_tree_cache_d *cache,
+                                      unsigned ix, tree t)
 {
   /* Make sure we're either replacing an old element or
      appending consecutively.  */
@@ -105,8 +105,8 @@ lto_streamer_cache_add_to_node_array (struct lto_streamer_cache_d *cache,
 }
 
 
-/* Helper for lto_streamer_cache_insert and lto_streamer_cache_insert_at.
-   CACHE, T, and IX_P are as in lto_streamer_cache_insert.
+/* Helper for streamer_tree_cache_insert and streamer_tree_cache_insert_at.
+   CACHE, T, and IX_P are as in streamer_tree_cache_insert.
 
    If INSERT_AT_NEXT_SLOT_P is true, T is inserted at the next available
    slot in the cache.  Otherwise, T is inserted at the position indicated
@@ -116,9 +116,9 @@ lto_streamer_cache_add_to_node_array (struct lto_streamer_cache_d *cache,
    return false.  */
 
 static bool
-lto_streamer_cache_insert_1 (struct lto_streamer_cache_d *cache,
-                            tree t, unsigned *ix_p,
-                            bool insert_at_next_slot_p)
+streamer_tree_cache_insert_1 (struct streamer_tree_cache_d *cache,
+                             tree t, unsigned *ix_p,
+                             bool insert_at_next_slot_p)
 {
   void **slot;
   unsigned ix;
@@ -136,7 +136,7 @@ lto_streamer_cache_insert_1 (struct lto_streamer_cache_d *cache,
        ix = *ix_p;
        *slot = (void *)(size_t) (ix + 1);
 
-      lto_streamer_cache_add_to_node_array (cache, ix, t);
+      streamer_tree_cache_add_to_node_array (cache, ix, t);
 
       /* Indicate that the item was not present in the cache.  */
       existed_p = false;
@@ -151,7 +151,7 @@ lto_streamer_cache_insert_1 (struct lto_streamer_cache_d *cache,
             location, and ENTRY->TO does not match *IX_P, add T to
             the requested location slot.  */
          ix = *ix_p;
-         lto_streamer_cache_add_to_node_array (cache, ix, t);
+         streamer_tree_cache_add_to_node_array (cache, ix, t);
        }
 
       /* Indicate that T was already in the cache.  */
@@ -172,10 +172,10 @@ lto_streamer_cache_insert_1 (struct lto_streamer_cache_d *cache,
    T has been stored.  */
 
 bool
-lto_streamer_cache_insert (struct lto_streamer_cache_d *cache, tree t,
-                          unsigned *ix_p)
+streamer_tree_cache_insert (struct streamer_tree_cache_d *cache, tree t,
+                           unsigned *ix_p)
 {
-  return lto_streamer_cache_insert_1 (cache, t, ix_p, true);
+  return streamer_tree_cache_insert_1 (cache, t, ix_p, true);
 }
 
 
@@ -183,20 +183,20 @@ lto_streamer_cache_insert (struct lto_streamer_cache_d *cache, tree t,
    existed in the cache return true.  Otherwise, return false.  */
 
 bool
-lto_streamer_cache_insert_at (struct lto_streamer_cache_d *cache,
-                             tree t, unsigned ix)
+streamer_tree_cache_insert_at (struct streamer_tree_cache_d *cache,
+                              tree t, unsigned ix)
 {
-  return lto_streamer_cache_insert_1 (cache, t, &ix, false);
+  return streamer_tree_cache_insert_1 (cache, t, &ix, false);
 }
 
 
 /* Appends tree node T to CACHE, even if T already existed in it.  */
 
 void
-lto_streamer_cache_append (struct lto_streamer_cache_d *cache, tree t)
+streamer_tree_cache_append (struct streamer_tree_cache_d *cache, tree t)
 {
   unsigned ix = VEC_length (tree, cache->nodes);
-  lto_streamer_cache_insert_1 (cache, t, &ix, false);
+  streamer_tree_cache_insert_1 (cache, t, &ix, false);
 }
 
 /* Return true if tree node T exists in CACHE, otherwise false.  If IX_P is
@@ -204,8 +204,8 @@ lto_streamer_cache_append (struct lto_streamer_cache_d *cache, tree t)
    ((unsigned)-1 if T is not found).  */
 
 bool
-lto_streamer_cache_lookup (struct lto_streamer_cache_d *cache, tree t,
-                          unsigned *ix_p)
+streamer_tree_cache_lookup (struct streamer_tree_cache_d *cache, tree t,
+                           unsigned *ix_p)
 {
   void **slot;
   bool retval;
@@ -235,7 +235,7 @@ lto_streamer_cache_lookup (struct lto_streamer_cache_d *cache, tree t,
 /* Return the tree node at slot IX in CACHE.  */
 
 tree
-lto_streamer_cache_get (struct lto_streamer_cache_d *cache, unsigned ix)
+streamer_tree_cache_get (struct streamer_tree_cache_d *cache, unsigned ix)
 {
   gcc_assert (cache);
 
@@ -249,7 +249,7 @@ lto_streamer_cache_get (struct lto_streamer_cache_d *cache, unsigned ix)
 /* Record NODE in CACHE.  */
 
 static void
-lto_record_common_node (struct lto_streamer_cache_d *cache, tree node)
+record_common_node (struct streamer_tree_cache_d *cache, tree node)
 {
   /* We have to make sure to fill exactly the same number of
      elements for all frontends.  That can include NULL trees.
@@ -260,12 +260,12 @@ lto_record_common_node (struct lto_streamer_cache_d *cache, tree node)
   if (!node)
     node = error_mark_node;
 
-  lto_streamer_cache_append (cache, node);
+  streamer_tree_cache_append (cache, node);
 
   if (POINTER_TYPE_P (node)
       || TREE_CODE (node) == COMPLEX_TYPE
       || TREE_CODE (node) == ARRAY_TYPE)
-    lto_record_common_node (cache, TREE_TYPE (node));
+    record_common_node (cache, TREE_TYPE (node));
   else if (TREE_CODE (node) == RECORD_TYPE)
     {
       /* The FIELD_DECLs of structures should be shared, so that every
@@ -275,7 +275,7 @@ lto_record_common_node (struct lto_streamer_cache_d *cache, tree node)
         nonoverlapping_component_refs_p).  */
       tree f;
       for (f = TYPE_FIELDS (node); f; f = TREE_CHAIN (f))
-       lto_record_common_node (cache, f);
+       record_common_node (cache, f);
     }
 }
 
@@ -284,35 +284,35 @@ lto_record_common_node (struct lto_streamer_cache_d *cache, tree node)
    properly according to the gimple type table.  */
 
 static void
-preload_common_nodes (struct lto_streamer_cache_d *cache)
+preload_common_nodes (struct streamer_tree_cache_d *cache)
 {
   unsigned i;
 
   for (i = 0; i < itk_none; i++)
     /* Skip itk_char.  char_type_node is dependent on -f[un]signed-char.  */
     if (i != itk_char)
-      lto_record_common_node (cache, integer_types[i]);
+      record_common_node (cache, integer_types[i]);
 
   for (i = 0; i < TYPE_KIND_LAST; i++)
-    lto_record_common_node (cache, sizetype_tab[i]);
+    record_common_node (cache, sizetype_tab[i]);
 
   for (i = 0; i < TI_MAX; i++)
     /* Skip boolean type and constants, they are frontend dependent.  */
     if (i != TI_BOOLEAN_TYPE
        && i != TI_BOOLEAN_FALSE
        && i != TI_BOOLEAN_TRUE)
-      lto_record_common_node (cache, global_trees[i]);
+      record_common_node (cache, global_trees[i]);
 }
 
 
 /* Create a cache of pickled nodes.  */
 
-struct lto_streamer_cache_d *
-lto_streamer_cache_create (void)
+struct streamer_tree_cache_d *
+streamer_tree_cache_create (void)
 {
-  struct lto_streamer_cache_d *cache;
+  struct streamer_tree_cache_d *cache;
 
-  cache = XCNEW (struct lto_streamer_cache_d);
+  cache = XCNEW (struct streamer_tree_cache_d);
 
   cache->node_map = pointer_map_create ();
 
@@ -328,7 +328,7 @@ lto_streamer_cache_create (void)
 /* Delete the streamer cache C.  */
 
 void
-lto_streamer_cache_delete (struct lto_streamer_cache_d *c)
+streamer_tree_cache_delete (struct streamer_tree_cache_d *c)
 {
   if (c == NULL)
     return;
index ee1c0b15ffee6fa1b37a08e8e3ec9e59eafb5162..b8f2d1fd335d7be9bb4d8a649e5a1f2263284add 100644 (file)
@@ -43,7 +43,7 @@ along with GCC; see the file COPYING3.  If not see
      T.  The reconstructed T is inserted in some array so that when
      the reference index for T is found in the input stream, it can be
      used to look up into the array to get the reconstructed T.  */
-struct lto_streamer_cache_d
+struct streamer_tree_cache_d
 {
   /* The mapping between tree nodes and slots into the nodes array.  */
   struct pointer_map_t *node_map;
@@ -55,7 +55,7 @@ struct lto_streamer_cache_d
 /* Return true if tree node EXPR should be streamed as a builtin.  For
    these nodes, we just emit the class and function code.  */
 static inline bool
-lto_stream_as_builtin_p (tree expr)
+streamer_handle_as_builtin_p (tree expr)
 {
   return (TREE_CODE (expr) == FUNCTION_DECL
          && DECL_IS_BUILTIN (expr)
@@ -64,35 +64,35 @@ lto_stream_as_builtin_p (tree expr)
 }
 
 /* In tree-streamer-in.c.  */
-tree input_string_cst (struct data_in *, struct lto_input_block *);
-void lto_streamer_read_tree (struct lto_input_block *, struct data_in *, tree);
-tree lto_materialize_tree (struct lto_input_block *, struct data_in *,
-                          enum LTO_tags);
-void lto_input_tree_pointers (struct lto_input_block *, struct data_in *, tree);
-tree lto_get_pickled_tree (struct lto_input_block *, struct data_in *);
-tree lto_get_builtin_tree (struct lto_input_block *, struct data_in *);
-tree lto_input_integer_cst (struct lto_input_block *, struct data_in *);
-struct bitpack_d tree_read_bitfields (struct lto_input_block *, tree);
+tree streamer_read_string_cst (struct data_in *, struct lto_input_block *);
+tree streamer_read_chain (struct lto_input_block *, struct data_in *);
+tree streamer_alloc_tree (struct lto_input_block *, struct data_in *,
+                         enum LTO_tags);
+void streamer_read_tree_body (struct lto_input_block *, struct data_in *, tree);
+tree streamer_get_pickled_tree (struct lto_input_block *, struct data_in *);
+tree streamer_get_builtin_tree (struct lto_input_block *, struct data_in *);
+tree streamer_read_integer_cst (struct lto_input_block *, struct data_in *);
+struct bitpack_d streamer_read_tree_bitfields (struct lto_input_block *, tree);
 
 /* In tree-streamer-out.c.  */
-void lto_output_chain (struct output_block *, tree, bool);
-void lto_output_tree_header (struct output_block *, tree);
-void pack_value_fields (struct bitpack_d *, tree);
-void lto_output_tree_pointers (struct output_block *, tree, bool);
-void lto_output_integer_cst (struct output_block *, tree, bool);
-void lto_output_builtin_tree (struct output_block *, tree);
+void streamer_write_chain (struct output_block *, tree, bool);
+void streamer_write_tree_header (struct output_block *, tree);
+void streamer_pack_tree_bitfields (struct bitpack_d *, tree);
+void streamer_write_tree_body (struct output_block *, tree, bool);
+void streamer_write_integer_cst (struct output_block *, tree, bool);
+void streamer_write_builtin (struct output_block *, tree);
 
 /* In tree-streamer.c.  */
-void check_handled_ts_structures (void);
-bool lto_streamer_cache_insert (struct lto_streamer_cache_d *, tree,
-                               unsigned *);
-bool lto_streamer_cache_insert_at (struct lto_streamer_cache_d *, tree,
-                                  unsigned);
-void lto_streamer_cache_append (struct lto_streamer_cache_d *, tree);
-bool lto_streamer_cache_lookup (struct lto_streamer_cache_d *, tree,
-                               unsigned *);
-tree lto_streamer_cache_get (struct lto_streamer_cache_d *, unsigned);
-struct lto_streamer_cache_d *lto_streamer_cache_create (void);
-void lto_streamer_cache_delete (struct lto_streamer_cache_d *);
+void streamer_check_handled_ts_structures (void);
+bool streamer_tree_cache_insert (struct streamer_tree_cache_d *, tree,
+                                unsigned *);
+bool streamer_tree_cache_insert_at (struct streamer_tree_cache_d *, tree,
+                                   unsigned);
+void streamer_tree_cache_append (struct streamer_tree_cache_d *, tree);
+bool streamer_tree_cache_lookup (struct streamer_tree_cache_d *, tree,
+                                unsigned *);
+tree streamer_tree_cache_get (struct streamer_tree_cache_d *, unsigned);
+struct streamer_tree_cache_d *streamer_tree_cache_create (void);
+void streamer_tree_cache_delete (struct streamer_tree_cache_d *);
 
 #endif  /* GCC_TREE_STREAMER_H  */