summaryrefslogtreecommitdiff
path: root/gcc/lto-streamer-out.c
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-24 12:39:59 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-24 12:39:59 +0000
commit284cc4806917b7677ea5e0780a3dbaddadff325a (patch)
treeb074b13ef42fb524859202db77acbd1630928da5 /gcc/lto-streamer-out.c
parent1d0b727d82c306aeef33ed287bec5aa9594bc4b0 (diff)
downloadgcc-284cc4806917b7677ea5e0780a3dbaddadff325a.tar.gz
* lto-opts.c (input_data_block): Move to lto-streamer-in.c.
* lto-streamer-in.c (input_string_internal): Add clarifying comments. (lto_input_data_block): Move from lto-opts.c. Make extern. Update all users. (lto_input_string): Rename from input_string. Make extern. Update all users. * lto-streamer-out.c (lto_output_string_with_length): Rename from output_string_with_length. Output 0 to indicate a non-NULL string. Update all callers to not emit 0. (lto_output_string): Rename from output_string. Make extern. Update all users. (lto_output_decl_state_streams): Make extern. (lto_output_decl_state_refs): Make extern. * lto-streamer.h (lto_input_string): Declare. (lto_input_data_block): Declare. (lto_output_string): Declare. (lto_output_string_with_length): Declare. (lto_output_decl_state_streams): Declare. (lto_output_decl_state_refs): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171387 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-streamer-out.c')
-rw-r--r--gcc/lto-streamer-out.c63
1 files changed, 29 insertions, 34 deletions
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index ba916b64c34..48579478b4d 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -154,11 +154,11 @@ destroy_output_block (struct output_block *ob)
table in OB. The string might or might not include a trailing '\0'.
Then put the index onto the INDEX_STREAM. */
-static void
-output_string_with_length (struct output_block *ob,
- struct lto_output_stream *index_stream,
- const char *s,
- unsigned int len)
+void
+lto_output_string_with_length (struct output_block *ob,
+ struct lto_output_stream *index_stream,
+ const char *s,
+ unsigned int len)
{
struct string_slot **slot;
struct string_slot s_slot;
@@ -170,6 +170,9 @@ output_string_with_length (struct output_block *ob,
s_slot.len = len;
s_slot.slot_num = 0;
+ /* Indicate that this is not a NULL string. */
+ lto_output_uleb128_stream (index_stream, 0);
+
slot = (struct string_slot **) htab_find_slot (ob->string_hash_table,
&s_slot, INSERT);
if (*slot == NULL)
@@ -200,16 +203,14 @@ output_string_with_length (struct output_block *ob,
/* Output the '\0' terminated STRING to the string
table in OB. Then put the index onto the INDEX_STREAM. */
-static void
-output_string (struct output_block *ob,
- struct lto_output_stream *index_stream,
- const char *string)
+void
+lto_output_string (struct output_block *ob,
+ struct lto_output_stream *index_stream,
+ const char *string)
{
if (string)
- {
- lto_output_uleb128_stream (index_stream, 0);
- output_string_with_length (ob, index_stream, string, strlen (string) + 1);
- }
+ lto_output_string_with_length (ob, index_stream, string,
+ strlen (string) + 1);
else
lto_output_uleb128_stream (index_stream, 1);
}
@@ -224,12 +225,9 @@ output_string_cst (struct output_block *ob,
tree string)
{
if (string)
- {
- lto_output_uleb128_stream (index_stream, 0);
- output_string_with_length (ob, index_stream,
- TREE_STRING_POINTER (string),
- TREE_STRING_LENGTH (string));
- }
+ lto_output_string_with_length (ob, index_stream,
+ TREE_STRING_POINTER (string),
+ TREE_STRING_LENGTH (string ));
else
lto_output_uleb128_stream (index_stream, 1);
}
@@ -244,12 +242,9 @@ output_identifier (struct output_block *ob,
tree id)
{
if (id)
- {
- lto_output_uleb128_stream (index_stream, 0);
- output_string_with_length (ob, index_stream,
- IDENTIFIER_POINTER (id),
- IDENTIFIER_LENGTH (id));
- }
+ lto_output_string_with_length (ob, index_stream,
+ IDENTIFIER_POINTER (id),
+ IDENTIFIER_LENGTH (id));
else
lto_output_uleb128_stream (index_stream, 1);
}
@@ -611,13 +606,13 @@ lto_output_location (struct output_block *ob, location_t loc)
if (loc == UNKNOWN_LOCATION)
{
- output_string (ob, ob->main_stream, NULL);
+ lto_output_string (ob, ob->main_stream, NULL);
return;
}
xloc = expand_location (loc);
- output_string (ob, ob->main_stream, xloc.file);
+ lto_output_string (ob, ob->main_stream, xloc.file);
output_sleb128 (ob, xloc.line);
output_sleb128 (ob, xloc.column);
output_sleb128 (ob, xloc.sysp);
@@ -1155,7 +1150,7 @@ static void
lto_output_ts_translation_unit_decl_tree_pointers (struct output_block *ob,
tree expr)
{
- output_string (ob, ob->main_stream, TRANSLATION_UNIT_LANGUAGE (expr));
+ lto_output_string (ob, ob->main_stream, TRANSLATION_UNIT_LANGUAGE (expr));
}
/* Helper for lto_output_tree. Write all pointer fields in EXPR to output
@@ -1320,12 +1315,12 @@ lto_output_builtin_tree (struct output_block *ob, tree expr, int ix)
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] == '*')
- output_string (ob, ob->main_stream, &str[1]);
+ lto_output_string (ob, ob->main_stream, &str[1]);
else
- output_string (ob, ob->main_stream, NULL);
+ lto_output_string (ob, ob->main_stream, NULL);
}
else
- output_string (ob, ob->main_stream, NULL);
+ lto_output_string (ob, ob->main_stream, NULL);
}
@@ -1745,7 +1740,7 @@ output_gimple_stmt (struct output_block *ob, gimple 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));
- output_string (ob, ob->main_stream, gimple_asm_string (stmt));
+ lto_output_string (ob, ob->main_stream, gimple_asm_string (stmt));
/* Fallthru */
case GIMPLE_ASSIGN:
@@ -2342,7 +2337,7 @@ write_global_references (struct output_block *ob,
/* Write all the streams in an lto_out_decl_state STATE using
output block OB and output stream OUT_STREAM. */
-static void
+void
lto_output_decl_state_streams (struct output_block *ob,
struct lto_out_decl_state *state)
{
@@ -2356,7 +2351,7 @@ lto_output_decl_state_streams (struct output_block *ob,
/* Write all the references in an lto_out_decl_state STATE using
output block OB and output stream OUT_STREAM. */
-static void
+void
lto_output_decl_state_refs (struct output_block *ob,
struct lto_output_stream *out_stream,
struct lto_out_decl_state *state)