[PATCH][LTO] Hide string streaming details
Richard Biener
rguenther@suse.de
Thu Aug 14 14:37:00 GMT 2014
This hides a part of the internal strings processing detail by
using appropriate APIs.
LTO bootstrap ongoing on x86_64-unknown-linux-gnu.
Richard.
2014-08-14 Richard Biener <rguenther@suse.de>
* data-streamer.h (streamer_string_index, string_for_index):
Remove.
* data-streamer-out.c (streamer_string_index): Make static.
* data-streamer-in.c (string_for_index): Likewise.
* lto-streamer-out.c (lto_output_location): Use bp_pack_string.
* lto-streamer-in.c (lto_input_location): Use bp_unpack_string.
Index: gcc/data-streamer.h
===================================================================
--- gcc/data-streamer.h (revision 213966)
+++ gcc/data-streamer.h (working copy)
@@ -57,8 +57,6 @@ void streamer_write_hwi (struct output_b
void streamer_write_gcov_count (struct output_block *, gcov_type);
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);
@@ -74,7 +72,6 @@ void streamer_write_data_stream (struct
size_t);
/* 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 *,
Index: gcc/data-streamer-out.c
===================================================================
--- gcc/data-streamer-out.c (revision 213966)
+++ gcc/data-streamer-out.c (working copy)
@@ -81,7 +81,7 @@ lto_append_block (struct lto_output_stre
When PERSISTENT is set, the string S is supposed to not change during
duration of the OB and thus OB can keep pointer into it. */
-unsigned
+static unsigned
streamer_string_index (struct output_block *ob, const char *s, unsigned int len,
bool persistent)
{
Index: gcc/data-streamer-in.c
===================================================================
--- gcc/data-streamer-in.c (revision 213966)
+++ gcc/data-streamer-in.c (working copy)
@@ -36,7 +36,7 @@ along with GCC; see the file COPYING3.
/* Read a string from the string table in DATA_IN using input block
IB. Write the length to RLEN. */
-const char *
+static const char *
string_for_index (struct data_in *data_in, unsigned int loc, unsigned int *rlen)
{
unsigned int len;
Index: gcc/lto-streamer-out.c
===================================================================
--- gcc/lto-streamer-out.c (revision 213966)
+++ gcc/lto-streamer-out.c (working copy)
@@ -189,10 +189,7 @@ lto_output_location (struct output_block
bp_pack_value (bp, ob->current_col != xloc.column, 1);
if (ob->current_file != xloc.file)
- bp_pack_var_len_unsigned (bp,
- streamer_string_index (ob, xloc.file,
- strlen (xloc.file) + 1,
- true));
+ bp_pack_string (ob, bp, xloc.file, true);
ob->current_file = xloc.file;
if (ob->current_line != xloc.line)
Index: gcc/lto-streamer-in.c
===================================================================
--- gcc/lto-streamer-in.c (revision 213966)
+++ gcc/lto-streamer-in.c (working copy)
@@ -154,7 +154,6 @@ lto_input_location (struct bitpack_d *bp
static int current_line;
static int current_col;
bool file_change, line_change, column_change;
- unsigned len;
bool prev_file = current_file != NULL;
if (bp_unpack_value (bp, 1))
@@ -165,10 +164,7 @@ lto_input_location (struct bitpack_d *bp
column_change = bp_unpack_value (bp, 1);
if (file_change)
- current_file = canon_file_name
- (string_for_index (data_in,
- bp_unpack_var_len_unsigned (bp),
- &len));
+ current_file = canon_file_name (bp_unpack_string (data_in, bp));
if (line_change)
current_line = bp_unpack_var_len_unsigned (bp);
More information about the Gcc-patches
mailing list