]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
data-streamer.h (streamer_write_data_stream): Declare here, renamed from ...
authorRichard Biener <rguenther@suse.de>
Thu, 31 Jul 2014 07:51:41 +0000 (07:51 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 31 Jul 2014 07:51:41 +0000 (07:51 +0000)
2014-07-31  Richard Biener  <rguenther@suse.de>

* data-streamer.h (streamer_write_data_stream): Declare here,
renamed from ...
* lto-streamer.h (lto_output_data_stream): ... this.  Remove.
* lto-cgraph.c (lto_output_node): Adjust.
(lto_output_varpool_node): Likewise.
* data-streamer-out.c (streamer_string_index): Likewise.
(streamer_write_data_stream, lto_append_block): Move from ...
* lto-section-out.c (lto_output_data_stream,
lto_append_block): ... here.

From-SVN: r213317

gcc/ChangeLog
gcc/data-streamer-out.c
gcc/data-streamer.h
gcc/lto-cgraph.c
gcc/lto-section-out.c
gcc/lto-streamer.h

index 23dd6f06ab6cbf19d4e11ac7a4a2238d72d64771..7176ee8d08622d329bf5fd51d5751f0e5361af45 100644 (file)
@@ -1,3 +1,15 @@
+2014-07-31  Richard Biener  <rguenther@suse.de>
+
+       * data-streamer.h (streamer_write_data_stream): Declare here,
+       renamed from ...
+       * lto-streamer.h (lto_output_data_stream): ... this.  Remove.
+       * lto-cgraph.c (lto_output_node): Adjust.
+       (lto_output_varpool_node): Likewise.
+       * data-streamer-out.c (streamer_string_index): Likewise.
+       (streamer_write_data_stream, lto_append_block): Move from ...
+       * lto-section-out.c (lto_output_data_stream,
+       lto_append_block): ... here.
+
 2014-07-30  Mike Stump  <mikestump@comcast.net>
 
        * configure.ac: Also check for popen.
index 8eefd2f855e7f356702271ebd652da741a6a9f85..4b3a0119dbe6c850dc18bb0462c171aed20cd62d 100644 (file)
@@ -32,6 +32,49 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimple.h"
 #include "data-streamer.h"
 
+
+/* Adds a new block to output stream OBS.  */
+
+void
+lto_append_block (struct lto_output_stream *obs)
+{
+  struct lto_char_ptr_base *new_block;
+
+  gcc_assert (obs->left_in_block == 0);
+
+  if (obs->first_block == NULL)
+    {
+      /* This is the first time the stream has been written
+        into.  */
+      obs->block_size = 1024;
+      new_block = (struct lto_char_ptr_base*) xmalloc (obs->block_size);
+      obs->first_block = new_block;
+    }
+  else
+    {
+      struct lto_char_ptr_base *tptr;
+      /* Get a new block that is twice as big as the last block
+        and link it into the list.  */
+      obs->block_size *= 2;
+      new_block = (struct lto_char_ptr_base*) xmalloc (obs->block_size);
+      /* The first bytes of the block are reserved as a pointer to
+        the next block.  Set the chain of the full block to the
+        pointer to the new block.  */
+      tptr = obs->current_block;
+      tptr->ptr = (char *) new_block;
+    }
+
+  /* Set the place for the next char at the first position after the
+     chain to the next block.  */
+  obs->current_pointer
+    = ((char *) new_block) + sizeof (struct lto_char_ptr_base);
+  obs->current_block = new_block;
+  /* Null out the newly allocated block's pointer to the next block.  */
+  new_block->ptr = NULL;
+  obs->left_in_block = obs->block_size - sizeof (struct lto_char_ptr_base);
+}
+
+
 /* Return index used to reference STRING of LEN characters in the string table
    in OB.  The string might or might not include a trailing '\0'.
    Then put the index onto the INDEX_STREAM.  
@@ -71,7 +114,7 @@ streamer_string_index (struct output_block *ob, const char *s, unsigned int len,
       new_slot->slot_num = start;
       *slot = new_slot;
       streamer_write_uhwi_stream (string_stream, len);
-      lto_output_data_stream (string_stream, string, len);
+      streamer_write_data_stream (string_stream, string, len);
       return start + 1;
     }
   else
@@ -304,3 +347,34 @@ streamer_write_gcov_count_stream (struct lto_output_stream *obs, gcov_type work)
   gcc_assert ((HOST_WIDE_INT) work == work);
   streamer_write_hwi_stream (obs, work);
 }
+
+/* Write raw DATA of length LEN to the output block OB.  */
+
+void
+streamer_write_data_stream (struct lto_output_stream *obs, const void *data,
+                           size_t len)
+{
+  while (len)
+    {
+      size_t copy;
+
+      /* No space left.  */
+      if (obs->left_in_block == 0)
+       lto_append_block (obs);
+
+      /* Determine how many bytes to copy in this loop.  */
+      if (len <= obs->left_in_block)
+       copy = len;
+      else
+       copy = obs->left_in_block;
+
+      /* Copy the data and do bookkeeping.  */
+      memcpy (obs->current_pointer, data, copy);
+      obs->current_pointer += copy;
+      obs->total_size += copy;
+      obs->left_in_block -= copy;
+      data = (const char *) data + copy;
+      len -= copy;
+    }
+}
+
index dc7b7207addad2bd6826308695a63cfa9f12e1c8..56fedd2764d67a3ed5b8cde2e58f30e200295eae 100644 (file)
@@ -70,6 +70,8 @@ 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);
 void streamer_write_gcov_count_stream (struct lto_output_stream *, gcov_type);
+void streamer_write_data_stream (struct lto_output_stream *, const void *,
+                                size_t);
 
 /* In data-streamer-in.c  */
 const char *string_for_index (struct data_in *, unsigned int, unsigned int *);
index b1fcf67a02584af6ef66f258208c42149662d215..ab694a58335a670eb5664c57604bc81889ca0b23 100644 (file)
@@ -488,7 +488,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
     comdat = IDENTIFIER_POINTER (group);
   else
     comdat = "";
-  lto_output_data_stream (ob->main_stream, comdat, strlen (comdat) + 1);
+  streamer_write_data_stream (ob->main_stream, comdat, strlen (comdat) + 1);
 
   if (group)
     {
@@ -546,7 +546,7 @@ lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
   bp_pack_enum (&bp, ld_plugin_symbol_resolution,
                LDPR_NUM_KNOWN, node->resolution);
   streamer_write_bitpack (&bp);
-  lto_output_data_stream (ob->main_stream, section, strlen (section) + 1);
+  streamer_write_data_stream (ob->main_stream, section, strlen (section) + 1);
 
   if (node->thunk.thunk_p && !boundary_p)
     {
@@ -622,7 +622,7 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node,
     comdat = IDENTIFIER_POINTER (group);
   else
     comdat = "";
-  lto_output_data_stream (ob->main_stream, comdat, strlen (comdat) + 1);
+  streamer_write_data_stream (ob->main_stream, comdat, strlen (comdat) + 1);
 
   if (group)
     {
@@ -640,7 +640,7 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node,
   section = node->get_section ();
   if (!section)
     section = "";
-  lto_output_data_stream (ob->main_stream, section, strlen (section) + 1);
+  streamer_write_data_stream (ob->main_stream, section, strlen (section) + 1);
 
   streamer_write_enum (ob->main_stream, ld_plugin_symbol_resolution,
                       LDPR_NUM_KNOWN, node->resolution);
index 2494191f288906ff9bc7eedb967eaed4c6c19967..0c5f792bcde3c02cea5527d7e6f89d77264235e7 100644 (file)
@@ -147,79 +147,6 @@ lto_write_stream (struct lto_output_stream *obs)
 }
 
 
-/* Adds a new block to output stream OBS.  */
-
-void
-lto_append_block (struct lto_output_stream *obs)
-{
-  struct lto_char_ptr_base *new_block;
-
-  gcc_assert (obs->left_in_block == 0);
-
-  if (obs->first_block == NULL)
-    {
-      /* This is the first time the stream has been written
-        into.  */
-      obs->block_size = 1024;
-      new_block = (struct lto_char_ptr_base*) xmalloc (obs->block_size);
-      obs->first_block = new_block;
-    }
-  else
-    {
-      struct lto_char_ptr_base *tptr;
-      /* Get a new block that is twice as big as the last block
-        and link it into the list.  */
-      obs->block_size *= 2;
-      new_block = (struct lto_char_ptr_base*) xmalloc (obs->block_size);
-      /* The first bytes of the block are reserved as a pointer to
-        the next block.  Set the chain of the full block to the
-        pointer to the new block.  */
-      tptr = obs->current_block;
-      tptr->ptr = (char *) new_block;
-    }
-
-  /* Set the place for the next char at the first position after the
-     chain to the next block.  */
-  obs->current_pointer
-    = ((char *) new_block) + sizeof (struct lto_char_ptr_base);
-  obs->current_block = new_block;
-  /* Null out the newly allocated block's pointer to the next block.  */
-  new_block->ptr = NULL;
-  obs->left_in_block = obs->block_size - sizeof (struct lto_char_ptr_base);
-}
-
-
-/* Write raw DATA of length LEN to the output block OB.  */
-
-void
-lto_output_data_stream (struct lto_output_stream *obs, const void *data,
-                       size_t len)
-{
-  while (len)
-    {
-      size_t copy;
-
-      /* No space left.  */
-      if (obs->left_in_block == 0)
-       lto_append_block (obs);
-
-      /* Determine how many bytes to copy in this loop.  */
-      if (len <= obs->left_in_block)
-       copy = len;
-      else
-       copy = obs->left_in_block;
-
-      /* Copy the data and do bookkeeping.  */
-      memcpy (obs->current_pointer, data, copy);
-      obs->current_pointer += copy;
-      obs->total_size += copy;
-      obs->left_in_block -= copy;
-      data = (const char *) data + copy;
-      len -= copy;
-    }
-}
-
-
 /* Lookup NAME in ENCODER.  If NAME is not found, create a new entry in
    ENCODER for NAME with the next available index of ENCODER,  then
    print the index to OBS.  True is returned if NAME was added to
index 423108b60eb5257ef47dab09fdf5b2f8873a4c28..1d728f6aa0936945d64151d1941e5548ea4f89ee 100644 (file)
@@ -779,8 +779,6 @@ extern void lto_begin_section (const char *, bool);
 extern void lto_end_section (void);
 extern void lto_write_data (const void *, unsigned int);
 extern void lto_write_stream (struct lto_output_stream *);
-extern void lto_output_data_stream (struct lto_output_stream *, const void *,
-                                   size_t);
 extern bool lto_output_decl_index (struct lto_output_stream *,
                            struct lto_tree_ref_encoder *,
                            tree, unsigned int *);