diff options
author | Richard Biener <rguenther@suse.de> | 2014-07-31 07:51:41 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2014-07-31 07:51:41 +0000 |
commit | bfa2ebe3d7f83bf8d38b99e4015510505ef164ea (patch) | |
tree | ff37ca736ada5ffa9cbb047d08ff03f4d6d72c52 /gcc/lto-section-out.c | |
parent | c5fbeafd47074bda9de09f2fe0e74f45c554f505 (diff) | |
download | gcc-bfa2ebe3d7f83bf8d38b99e4015510505ef164ea.zip gcc-bfa2ebe3d7f83bf8d38b99e4015510505ef164ea.tar.gz gcc-bfa2ebe3d7f83bf8d38b99e4015510505ef164ea.tar.bz2 |
data-streamer.h (streamer_write_data_stream): Declare here, renamed from ...
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
Diffstat (limited to 'gcc/lto-section-out.c')
-rw-r--r-- | gcc/lto-section-out.c | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/gcc/lto-section-out.c b/gcc/lto-section-out.c index 2494191..0c5f792 100644 --- a/gcc/lto-section-out.c +++ b/gcc/lto-section-out.c @@ -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 |