data-streamer.h (bp_pack_string_with_length): New function.
2012-10-15 Richard Biener <rguenther@suse.de> * data-streamer.h (bp_pack_string_with_length): New function. (bp_pack_string): Likewise. (bp_unpack_indexed_string): Likewise. (bp_unpack_string): Likewise. * data-streamer-out.c (bp_pack_string_with_length): Likewise. (bp_pack_string): Likewise. * data-streamer-in.c (bp_unpack_indexed_string): Likewise. (bp_unpack_string): Likewise. * tree-streamer-out.c (pack_ts_translation_unit_decl_value_fields): Pack TRANSLATION_UNIT_LANGUAGE here, not ... (write_ts_translation_unit_decl_tree_pointers): ... here. Remove. (streamer_pack_tree_bitfields): Adjust. (streamer_write_tree_body): Likewise. * tree-streamer-in.c (unpack_ts_translation_unit_decl_value_fields): Unpack TRANSLATION_UNIT_LANGUAGE here, not ... (lto_input_ts_translation_unit_decl_tree_pointers): ... here. Remove. (unpack_value_fields): Adjust. (streamer_read_tree_body): Likewise. From-SVN: r192460
This commit is contained in:
parent
1183dc2cd8
commit
8135e1e691
|
@ -1,3 +1,24 @@
|
|||
2012-10-15 Richard Biener <rguenther@suse.de>
|
||||
|
||||
* data-streamer.h (bp_pack_string_with_length): New function.
|
||||
(bp_pack_string): Likewise.
|
||||
(bp_unpack_indexed_string): Likewise.
|
||||
(bp_unpack_string): Likewise.
|
||||
* data-streamer-out.c (bp_pack_string_with_length): Likewise.
|
||||
(bp_pack_string): Likewise.
|
||||
* data-streamer-in.c (bp_unpack_indexed_string): Likewise.
|
||||
(bp_unpack_string): Likewise.
|
||||
* tree-streamer-out.c (pack_ts_translation_unit_decl_value_fields):
|
||||
Pack TRANSLATION_UNIT_LANGUAGE here, not ...
|
||||
(write_ts_translation_unit_decl_tree_pointers): ... here. Remove.
|
||||
(streamer_pack_tree_bitfields): Adjust.
|
||||
(streamer_write_tree_body): Likewise.
|
||||
* tree-streamer-in.c (unpack_ts_translation_unit_decl_value_fields):
|
||||
Unpack TRANSLATION_UNIT_LANGUAGE here, not ...
|
||||
(lto_input_ts_translation_unit_decl_tree_pointers): ... here. Remove.
|
||||
(unpack_value_fields): Adjust.
|
||||
(streamer_read_tree_body): Likewise.
|
||||
|
||||
2012-10-15 J"orn Rennecke <joern.rennecke@arc.com>
|
||||
|
||||
* genoutput.c (process_template): Process '*' in '@' alternatives.
|
||||
|
|
|
@ -86,6 +86,35 @@ streamer_read_string (struct data_in *data_in, struct lto_input_block *ib)
|
|||
}
|
||||
|
||||
|
||||
/* Read a string from the string table in DATA_IN using the bitpack BP.
|
||||
Write the length to RLEN. */
|
||||
|
||||
const char *
|
||||
bp_unpack_indexed_string (struct data_in *data_in,
|
||||
struct bitpack_d *bp, unsigned int *rlen)
|
||||
{
|
||||
return string_for_index (data_in, bp_unpack_var_len_unsigned (bp), rlen);
|
||||
}
|
||||
|
||||
|
||||
/* Read a NULL terminated string from the string table in DATA_IN. */
|
||||
|
||||
const char *
|
||||
bp_unpack_string (struct data_in *data_in, struct bitpack_d *bp)
|
||||
{
|
||||
unsigned int len;
|
||||
const char *ptr;
|
||||
|
||||
ptr = bp_unpack_indexed_string (data_in, bp, &len);
|
||||
if (!ptr)
|
||||
return NULL;
|
||||
if (ptr[len - 1] != '\0')
|
||||
internal_error ("bytecode stream: found non-null terminated string");
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
/* Read an unsigned HOST_WIDE_INT number from IB. */
|
||||
|
||||
unsigned HOST_WIDE_INT
|
||||
|
|
|
@ -115,6 +115,39 @@ streamer_write_string (struct output_block *ob,
|
|||
}
|
||||
|
||||
|
||||
/* Output STRING of LEN characters to the string table in OB. Then
|
||||
put the index into BP.
|
||||
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. */
|
||||
|
||||
void
|
||||
bp_pack_string_with_length (struct output_block *ob, struct bitpack_d *bp,
|
||||
const char *s, unsigned int len, bool persistent)
|
||||
{
|
||||
unsigned index = 0;
|
||||
if (s)
|
||||
index = streamer_string_index (ob, s, len, persistent);
|
||||
bp_pack_var_len_unsigned (bp, index);
|
||||
}
|
||||
|
||||
|
||||
/* Output the '\0' terminated STRING to the string
|
||||
table in OB. Then put the index onto the bitpack BP.
|
||||
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. */
|
||||
|
||||
void
|
||||
bp_pack_string (struct output_block *ob, struct bitpack_d *bp,
|
||||
const char *s, bool persistent)
|
||||
{
|
||||
unsigned index = 0;
|
||||
if (s)
|
||||
index = streamer_string_index (ob, s, strlen (s) + 1, persistent);
|
||||
bp_pack_var_len_unsigned (bp, index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Write a zero to the output stream. */
|
||||
|
||||
void
|
||||
|
|
|
@ -72,6 +72,10 @@ unsigned streamer_string_index (struct output_block *, const char *,
|
|||
void streamer_write_string_with_length (struct output_block *,
|
||||
struct lto_output_stream *,
|
||||
const char *, unsigned int, bool);
|
||||
void bp_pack_string_with_length (struct output_block *, struct bitpack_d *,
|
||||
const char *, unsigned int, bool);
|
||||
void bp_pack_string (struct output_block *, struct bitpack_d *,
|
||||
const char *, 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);
|
||||
|
@ -82,6 +86,9 @@ 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 *);
|
||||
const char *bp_unpack_indexed_string (struct data_in *, struct bitpack_d *,
|
||||
unsigned int *);
|
||||
const char *bp_unpack_string (struct data_in *, struct bitpack_d *);
|
||||
unsigned HOST_WIDE_INT streamer_read_uhwi (struct lto_input_block *);
|
||||
HOST_WIDE_INT streamer_read_hwi (struct lto_input_block *);
|
||||
|
||||
|
|
|
@ -365,8 +365,11 @@ unpack_ts_block_value_fields (struct data_in *data_in,
|
|||
structure of expression EXPR from bitpack BP. */
|
||||
|
||||
static void
|
||||
unpack_ts_translation_unit_decl_value_fields (struct bitpack_d *bp ATTRIBUTE_UNUSED, tree expr ATTRIBUTE_UNUSED)
|
||||
unpack_ts_translation_unit_decl_value_fields (struct data_in *data_in,
|
||||
struct bitpack_d *bp, tree expr)
|
||||
{
|
||||
TRANSLATION_UNIT_LANGUAGE (expr) = xstrdup (bp_unpack_string (data_in, bp));
|
||||
VEC_safe_push (tree, gc, all_translation_units, expr);
|
||||
}
|
||||
|
||||
/* Unpack a TS_TARGET_OPTION tree from BP into EXPR. */
|
||||
|
@ -444,7 +447,7 @@ unpack_value_fields (struct data_in *data_in, struct bitpack_d *bp, tree expr)
|
|||
unpack_ts_block_value_fields (data_in, bp, expr);
|
||||
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
|
||||
unpack_ts_translation_unit_decl_value_fields (bp, expr);
|
||||
unpack_ts_translation_unit_decl_value_fields (data_in, bp, expr);
|
||||
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
|
||||
unpack_ts_target_option (bp, expr);
|
||||
|
@ -942,17 +945,6 @@ lto_input_ts_constructor_tree_pointers (struct lto_input_block *ib,
|
|||
}
|
||||
|
||||
|
||||
/* Input a TS_TRANSLATION_UNIT_DECL tree from IB and DATA_IN into EXPR. */
|
||||
|
||||
static void
|
||||
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 (streamer_read_string (data_in, ib));
|
||||
VEC_safe_push (tree, gc, all_translation_units, expr);
|
||||
}
|
||||
|
||||
/* Read all pointer fields in EXPR from input block IB. DATA_IN
|
||||
contains tables and descriptors for the file being read. */
|
||||
|
||||
|
@ -1014,9 +1006,6 @@ streamer_read_tree_body (struct lto_input_block *ib, struct data_in *data_in,
|
|||
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
|
||||
lto_input_ts_constructor_tree_pointers (ib, data_in, expr);
|
||||
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
|
||||
lto_input_ts_translation_unit_decl_tree_pointers (ib, data_in, expr);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -316,8 +316,10 @@ pack_ts_block_value_fields (struct output_block *ob,
|
|||
of expression EXPR into bitpack BP. */
|
||||
|
||||
static void
|
||||
pack_ts_translation_unit_decl_value_fields (struct bitpack_d *bp ATTRIBUTE_UNUSED, tree expr ATTRIBUTE_UNUSED)
|
||||
pack_ts_translation_unit_decl_value_fields (struct output_block *ob,
|
||||
struct bitpack_d *bp, tree expr)
|
||||
{
|
||||
bp_pack_string (ob, bp, TRANSLATION_UNIT_LANGUAGE (expr), true);
|
||||
}
|
||||
|
||||
/* Pack a TS_TARGET_OPTION tree in EXPR to BP. */
|
||||
|
@ -402,7 +404,7 @@ streamer_pack_tree_bitfields (struct output_block *ob,
|
|||
pack_ts_block_value_fields (ob, bp, expr);
|
||||
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
|
||||
pack_ts_translation_unit_decl_value_fields (bp, expr);
|
||||
pack_ts_translation_unit_decl_value_fields (ob, bp, expr);
|
||||
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
|
||||
pack_ts_target_option (bp, expr);
|
||||
|
@ -819,16 +821,6 @@ write_ts_constructor_tree_pointers (struct output_block *ob, tree expr,
|
|||
}
|
||||
}
|
||||
|
||||
/* Write a TS_TRANSLATION_UNIT_DECL tree in EXPR to OB. */
|
||||
|
||||
static void
|
||||
write_ts_translation_unit_decl_tree_pointers (struct output_block *ob,
|
||||
tree expr)
|
||||
{
|
||||
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. */
|
||||
|
||||
|
@ -889,9 +881,6 @@ streamer_write_tree_body (struct output_block *ob, tree expr, bool ref_p)
|
|||
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
|
||||
write_ts_constructor_tree_pointers (ob, expr, ref_p);
|
||||
|
||||
if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
|
||||
write_ts_translation_unit_decl_tree_pointers (ob, expr);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue