Commit 412288f1 by Diego Novillo Committed by Diego Novillo

data-streamer.h (streamer_write_zero): Rename from output_zero.

	* data-streamer.h (streamer_write_zero): Rename from output_zero.
 	(streamer_write_uhwi): Rename from lto_output_uleb128.
 	(streamer_write_hwi): Rename from output_sleb128.
 	(streamer_write_string): Rename from lto_output_string.
 	(streamer_string_index): Rename from lto_string_index.
 	(streamer_write_string_with_length): Rename from
 	lto_output_string_with_length.
 	(streamer_write_uhwi_stream): Rename from lto_output_uleb128_stream.
 	(streamer_write_hwi_stream): Rename from lto_output_sleb128_stream.
 	(streamer_read_string): Rename from lto_input_string.
 	(streamer_read_indexed_string): Rename from input_string_internal.
 	(streamer_read_uhwi): Rename from lto_input_uleb128.
 	(streamer_read_hwi): Rename from lto_input_sleb128.
 	(streamer_write_hwi_in_range): Rename from lto_output_int_in_range.
 	(streamer_read_hwi_in_range): Rename from lto_input_int_in_range.
 	(streamer_write_enum): Rename from lto_output_enum.
 	(streamer_read_enum): Rename from lto_input_enum.
 	(streamer_write_record_start): Rename from output_record_start.
 	(streamer_read_record_start): Rename from input_record_start.
 	(streamer_write_bitpack): Rename from lto_output_bitpack.
 	(streamer_read_bitpack): Rename from lto_input_bitpack.
 	(streamer_write_char_stream): Rename from lto_output_1_stream.
 	(streamer_read_uchar): Rename from lto_input_1_unsigned.
 	* tree-streamer.h (streamer_cache_d): Rename from lto_streamer_cache_d.
 	(streamer_handle_as_builtin_p): Rename from lto_stream_as_builtin_p.
 	(streamer_read_string_cst): Rename from input_string_cst.
 	(streamer_read_chain): Rename from lto_input_chain.
 	(streamer_alloc_tree): Rename from lto_materialize_tree.
 	(streamer_read_tree_body): Rename from lto_input_tree_pointers.
 	(streamer_get_pickled_tree): Rename from lto_get_pickled_tree.
 	(streamer_get_builtin_tree): Rename from lto_get_builtin_tree.
 	(streamer_read_integer_cst): Rename from lto_input_integer_cst.
 	(streamer_read_tree_bitfields): Rename from tree_read_bitfields.
 	(streamer_write_chain): Rename from lto_output_chain.
 	(streamer_write_tree_header): Rename from lto_output_tree_header.
 	(streamer_pack_tree_bitfields): Rename from pack_value_fields.
 	(streamer_write_tree_body): Rename from lto_output_tree_pointers.
 	(streamer_write_integer_cst): Rename from lto_output_integer_cst.
 	(streamer_write_builtin): Rename from lto_output_builtin_tree.
 	(streamer_check_handled_ts_structures): Rename from
 	check_handled_ts_structures.
 	(streamer_tree_cache_insert): Rename from lto_streamer_cache_insert.
 	(streamer_tree_cache_insert_at): Rename from
 	lto_streamer_cache_insert_at.
 	(streamer_tree_cache_append): Rename from lto_streamer_cache_append.
 	(streamer_tree_cache_lookup): Rename from lto_streamer_cache_lookup.
 	(streamer_tree_cache_get): Rename from lto_streamer_cache_get.
 	(streamer_tree_cache_create): Rename from lto_streamer_cache_create.
 	(streamer_tree_cache_delete): Rename from lto_streamer_cache_delete.
 	* tree-streamer-out.c (write_string_cst): Rename from output_string_cst.
 	(write_identifier): Rename from output_identifier.
 	(write_ts_common_tree_pointers): Rename from
 	lto_output_ts_common_tree_pointers.
 	(write_ts_vector_tree_pointers): Rename from
 	lto_output_ts_vector_tree_pointers.
 	(write_ts_complex_tree_pointers): Rename from
 	lto_output_ts_complex_tree_pointers.
 	(write_ts_decl_minimal_tree_pointers): Rename from
 	lto_output_ts_decl_minimal_tree_pointers.
 	(write_ts_decl_common_tree_pointers): Rename from
 	lto_output_ts_decl_common_tree_pointers.
 	(write_ts_decl_non_common_tree_pointers): Rename from
 	lto_output_ts_decl_non_common_tree_pointers.
 	(write_ts_decl_with_vis_tree_pointers): Rename from
 	lto_output_ts_decl_with_vis_tree_pointers.
 	(write_ts_field_decl_tree_pointers): Rename from
 	lto_output_ts_field_decl_tree_pointers.
 	(write_ts_function_decl_tree_pointers): Rename from
 	lto_output_ts_function_decl_tree_pointers.
 	(write_ts_type_common_tree_pointers): Rename from
 	lto_output_ts_type_common_tree_pointers.
 	(write_ts_type_non_common_tree_pointers): Rename from
 	lto_output_ts_type_non_common_tree_pointers.
 	(write_ts_list_tree_pointers): Rename from
 	lto_output_ts_list_tree_pointers.
 	(write_ts_vec_tree_pointers): Rename from
 	lto_output_ts_vec_tree_pointers.
 	(write_ts_exp_tree_pointers): Rename from
 	lto_output_ts_exp_tree_pointers.
 	(write_ts_block_tree_pointers): Rename from
 	lto_output_ts_block_tree_pointers.
 	(write_ts_binfo_tree_pointers): Rename from
 	lto_output_ts_binfo_tree_pointers.
 	(write_ts_constructor_tree_pointers): Rename from
 	lto_output_ts_constructor_tree_pointers.
 	(write_ts_target_option): Rename from
 	lto_output_ts_target_option.
 	(write_ts_translation_unit_decl_tree_pointers): Rename from
 	lto_output_ts_translation_unit_decl_tree_pointers.
 	* tree-streamer.c (streamer_tree_cache_add_to_node_array):
 	Rename from lto_streamer_cache_add_to_node_array.
 	(streamer_tree_cache_insert_1): Rename from lto_streamer_cache_insert_1.
 	(record_common_node): Rename from lto_record_common_node.

	* streamer-hooks.h (bitpack_d, lto_streamer_cache_d): Remove forward
	declarations.
	* data-streamer-in.c (lto_input_widest_uint_uleb128): Remove unused
	function.
	* data-streamer-out.c (lto_output_widest_uint_uleb128_stream): Remove
	unused function.
	* Makefile.in (lto-section-out.o): Add dependency on DATA_STREAMER_H.
	(ipa-reference.o): Likewise.
	* lto-section-out.c: Include data-streamer.h.
	* ipa-reference.c: Include data-streamer.h.

From-SVN: r177704
parent 9b0f6f5e
2011-08-12 Diego Novillo <dnovillo@google.com>
* data-streamer.h (streamer_write_zero): Rename from output_zero.
(streamer_write_uhwi): Rename from lto_output_uleb128.
(streamer_write_hwi): Rename from output_sleb128.
(streamer_write_string): Rename from lto_output_string.
(streamer_string_index): Rename from lto_string_index.
(streamer_write_string_with_length): Rename from
lto_output_string_with_length.
(streamer_write_uhwi_stream): Rename from lto_output_uleb128_stream.
(streamer_write_hwi_stream): Rename from lto_output_sleb128_stream.
(streamer_read_string): Rename from lto_input_string.
(streamer_read_indexed_string): Rename from input_string_internal.
(streamer_read_uhwi): Rename from lto_input_uleb128.
(streamer_read_hwi): Rename from lto_input_sleb128.
(streamer_write_hwi_in_range): Rename from lto_output_int_in_range.
(streamer_read_hwi_in_range): Rename from lto_input_int_in_range.
(streamer_write_enum): Rename from lto_output_enum.
(streamer_read_enum): Rename from lto_input_enum.
(streamer_write_record_start): Rename from output_record_start.
(streamer_read_record_start): Rename from input_record_start.
(streamer_write_bitpack): Rename from lto_output_bitpack.
(streamer_read_bitpack): Rename from lto_input_bitpack.
(streamer_write_char_stream): Rename from lto_output_1_stream.
(streamer_read_uchar): Rename from lto_input_1_unsigned.
* tree-streamer.h (streamer_cache_d): Rename from lto_streamer_cache_d.
(streamer_handle_as_builtin_p): Rename from lto_stream_as_builtin_p.
(streamer_read_string_cst): Rename from input_string_cst.
(streamer_read_chain): Rename from lto_input_chain.
(streamer_alloc_tree): Rename from lto_materialize_tree.
(streamer_read_tree_body): Rename from lto_input_tree_pointers.
(streamer_get_pickled_tree): Rename from lto_get_pickled_tree.
(streamer_get_builtin_tree): Rename from lto_get_builtin_tree.
(streamer_read_integer_cst): Rename from lto_input_integer_cst.
(streamer_read_tree_bitfields): Rename from tree_read_bitfields.
(streamer_write_chain): Rename from lto_output_chain.
(streamer_write_tree_header): Rename from lto_output_tree_header.
(streamer_pack_tree_bitfields): Rename from pack_value_fields.
(streamer_write_tree_body): Rename from lto_output_tree_pointers.
(streamer_write_integer_cst): Rename from lto_output_integer_cst.
(streamer_write_builtin): Rename from lto_output_builtin_tree.
(streamer_check_handled_ts_structures): Rename from
check_handled_ts_structures.
(streamer_tree_cache_insert): Rename from lto_streamer_cache_insert.
(streamer_tree_cache_insert_at): Rename from
lto_streamer_cache_insert_at.
(streamer_tree_cache_append): Rename from lto_streamer_cache_append.
(streamer_tree_cache_lookup): Rename from lto_streamer_cache_lookup.
(streamer_tree_cache_get): Rename from lto_streamer_cache_get.
(streamer_tree_cache_create): Rename from lto_streamer_cache_create.
(streamer_tree_cache_delete): Rename from lto_streamer_cache_delete.
* tree-streamer-out.c (write_string_cst): Rename from output_string_cst.
(write_identifier): Rename from output_identifier.
(write_ts_common_tree_pointers): Rename from
lto_output_ts_common_tree_pointers.
(write_ts_vector_tree_pointers): Rename from
lto_output_ts_vector_tree_pointers.
(write_ts_complex_tree_pointers): Rename from
lto_output_ts_complex_tree_pointers.
(write_ts_decl_minimal_tree_pointers): Rename from
lto_output_ts_decl_minimal_tree_pointers.
(write_ts_decl_common_tree_pointers): Rename from
lto_output_ts_decl_common_tree_pointers.
(write_ts_decl_non_common_tree_pointers): Rename from
lto_output_ts_decl_non_common_tree_pointers.
(write_ts_decl_with_vis_tree_pointers): Rename from
lto_output_ts_decl_with_vis_tree_pointers.
(write_ts_field_decl_tree_pointers): Rename from
lto_output_ts_field_decl_tree_pointers.
(write_ts_function_decl_tree_pointers): Rename from
lto_output_ts_function_decl_tree_pointers.
(write_ts_type_common_tree_pointers): Rename from
lto_output_ts_type_common_tree_pointers.
(write_ts_type_non_common_tree_pointers): Rename from
lto_output_ts_type_non_common_tree_pointers.
(write_ts_list_tree_pointers): Rename from
lto_output_ts_list_tree_pointers.
(write_ts_vec_tree_pointers): Rename from
lto_output_ts_vec_tree_pointers.
(write_ts_exp_tree_pointers): Rename from
lto_output_ts_exp_tree_pointers.
(write_ts_block_tree_pointers): Rename from
lto_output_ts_block_tree_pointers.
(write_ts_binfo_tree_pointers): Rename from
lto_output_ts_binfo_tree_pointers.
(write_ts_constructor_tree_pointers): Rename from
lto_output_ts_constructor_tree_pointers.
(write_ts_target_option): Rename from
lto_output_ts_target_option.
(write_ts_translation_unit_decl_tree_pointers): Rename from
lto_output_ts_translation_unit_decl_tree_pointers.
* tree-streamer.c (streamer_tree_cache_add_to_node_array):
Rename from lto_streamer_cache_add_to_node_array.
(streamer_tree_cache_insert_1): Rename from lto_streamer_cache_insert_1.
(record_common_node): Rename from lto_record_common_node.
* streamer-hooks.h (bitpack_d, lto_streamer_cache_d): Remove forward
declarations.
* data-streamer-in.c (lto_input_widest_uint_uleb128): Remove unused
function.
* data-streamer-out.c (lto_output_widest_uint_uleb128_stream): Remove
unused function.
* Makefile.in (lto-section-out.o): Add dependency on DATA_STREAMER_H.
(ipa-reference.o): Likewise.
* lto-section-out.c: Include data-streamer.h.
* ipa-reference.c: Include data-streamer.h.
2011-08-12 Nick Clifton <nickc@redhat.com>
* builtins.c (expand_builtin_memcmp): Do not use cmpstrnsi
......
......@@ -2345,7 +2345,8 @@ lto-section-out.o : lto-section-out.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(DIAGNOSTIC_CORE_H) $(TREE_H) $(EXPR_H) $(PARAMS_H) input.h \
$(HASHTAB_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) $(TREE_PASS_H) \
$(CGRAPH_H) $(FUNCTION_H) $(GGC_H) $(EXCEPT_H) pointer-set.h \
$(BITMAP_H) langhooks.h $(LTO_STREAMER_H) lto-compress.h
$(BITMAP_H) langhooks.h $(LTO_STREAMER_H) lto-compress.h \
$(DATA_STREAMER_H)
lto-symtab.o: lto-symtab.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TREE_H) $(GIMPLE_H) $(GGC_H) $(HASHTAB_H) \
$(LTO_STREAMER_H) $(LINKER_PLUGIN_API_H) gt-lto-symtab.h
......@@ -3079,7 +3080,8 @@ ipa-reference.o : ipa-reference.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \
pointer-set.h $(GGC_H) $(IPA_REFERENCE_H) $(IPA_UTILS_H) $(SPLAY_TREE_H) \
$(GIMPLE_H) $(CGRAPH_H) output.h $(FLAGS_H) $(TREE_PASS_H) \
$(TIMEVAR_H) $(DIAGNOSTIC_H) $(FUNCTION_H) $(LTO_STREAMER_H) $(DIAGNOSTIC_CORE_H)
$(TIMEVAR_H) $(DIAGNOSTIC_H) $(FUNCTION_H) $(LTO_STREAMER_H) \
$(DIAGNOSTIC_CORE_H) $(DATA_STREAMER_H)
ipa-pure-const.o : ipa-pure-const.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_INLINE_H) langhooks.h \
pointer-set.h $(GGC_H) $(IPA_UTILS_H) $(TARGET_H) \
......
......@@ -45,7 +45,7 @@ string_for_index (struct data_in *data_in, unsigned int loc, unsigned int *rlen)
/* Get the string stored at location LOC in DATA_IN->STRINGS. */
LTO_INIT_INPUT_BLOCK (str_tab, data_in->strings, loc - 1,
data_in->strings_len);
len = lto_input_uleb128 (&str_tab);
len = streamer_read_uhwi (&str_tab);
*rlen = len;
if (str_tab.p + len > data_in->strings_len)
......@@ -61,22 +61,22 @@ string_for_index (struct data_in *data_in, unsigned int loc, unsigned int *rlen)
IB. Write the length to RLEN. */
const char *
input_string_internal (struct data_in *data_in, struct lto_input_block *ib,
unsigned int *rlen)
streamer_read_indexed_string (struct data_in *data_in,
struct lto_input_block *ib, unsigned int *rlen)
{
return string_for_index (data_in, lto_input_uleb128 (ib), rlen);
return string_for_index (data_in, streamer_read_uhwi (ib), rlen);
}
/* Read a NULL terminated string from the string table in DATA_IN. */
const char *
lto_input_string (struct data_in *data_in, struct lto_input_block *ib)
streamer_read_string (struct data_in *data_in, struct lto_input_block *ib)
{
unsigned int len;
const char *ptr;
ptr = input_string_internal (data_in, ib, &len);
ptr = streamer_read_indexed_string (data_in, ib, &len);
if (!ptr)
return NULL;
if (ptr[len - 1] != '\0')
......@@ -86,10 +86,10 @@ lto_input_string (struct data_in *data_in, struct lto_input_block *ib)
}
/* Read an ULEB128 Number of IB. */
/* Read an unsigned HOST_WIDE_INT number from IB. */
unsigned HOST_WIDE_INT
lto_input_uleb128 (struct lto_input_block *ib)
streamer_read_uhwi (struct lto_input_block *ib)
{
unsigned HOST_WIDE_INT result = 0;
int shift = 0;
......@@ -97,7 +97,7 @@ lto_input_uleb128 (struct lto_input_block *ib)
while (true)
{
byte = lto_input_1_unsigned (ib);
byte = streamer_read_uchar (ib);
result |= (byte & 0x7f) << shift;
shift += 7;
if ((byte & 0x80) == 0)
......@@ -106,31 +106,10 @@ lto_input_uleb128 (struct lto_input_block *ib)
}
/* HOST_WIDEST_INT version of lto_input_uleb128. IB is as in
lto_input_uleb128. */
unsigned HOST_WIDEST_INT
lto_input_widest_uint_uleb128 (struct lto_input_block *ib)
{
unsigned HOST_WIDEST_INT result = 0;
int shift = 0;
unsigned HOST_WIDEST_INT byte;
while (true)
{
byte = lto_input_1_unsigned (ib);
result |= (byte & 0x7f) << shift;
shift += 7;
if ((byte & 0x80) == 0)
return result;
}
}
/* Read an SLEB128 Number of IB. */
/* Read a HOST_WIDE_INT number from IB. */
HOST_WIDE_INT
lto_input_sleb128 (struct lto_input_block *ib)
streamer_read_hwi (struct lto_input_block *ib)
{
HOST_WIDE_INT result = 0;
int shift = 0;
......@@ -138,7 +117,7 @@ lto_input_sleb128 (struct lto_input_block *ib)
while (true)
{
byte = lto_input_1_unsigned (ib);
byte = streamer_read_uchar (ib);
result |= (byte & 0x7f) << shift;
shift += 7;
if ((byte & 0x80) == 0)
......
......@@ -32,8 +32,8 @@ along with GCC; see the file COPYING3. If not see
duration of the OB and thus OB can keep pointer into it. */
unsigned
lto_string_index (struct output_block *ob, const char *s, unsigned int len,
bool persistent)
streamer_string_index (struct output_block *ob, const char *s, unsigned int len,
bool persistent)
{
struct string_slot **slot;
struct string_slot s_slot;
......@@ -64,7 +64,7 @@ lto_string_index (struct output_block *ob, const char *s, unsigned int len,
new_slot->len = len;
new_slot->slot_num = start;
*slot = new_slot;
lto_output_uleb128_stream (string_stream, len);
streamer_write_uhwi_stream (string_stream, len);
lto_output_data_stream (string_stream, string, len);
return start + 1;
}
......@@ -83,15 +83,16 @@ lto_string_index (struct output_block *ob, const char *s, unsigned int len,
duration of the OB and thus OB can keep pointer into it. */
void
lto_output_string_with_length (struct output_block *ob,
struct lto_output_stream *index_stream,
const char *s, unsigned int len, bool persistent)
streamer_write_string_with_length (struct output_block *ob,
struct lto_output_stream *index_stream,
const char *s, unsigned int len,
bool persistent)
{
if (s)
lto_output_uleb128_stream (index_stream,
lto_string_index (ob, s, len, persistent));
streamer_write_uhwi_stream (index_stream,
streamer_string_index (ob, s, len, persistent));
else
lto_output_1_stream (index_stream, 0);
streamer_write_char_stream (index_stream, 0);
}
......@@ -101,51 +102,51 @@ lto_output_string_with_length (struct output_block *ob,
duration of the OB and thus OB can keep pointer into it. */
void
lto_output_string (struct output_block *ob,
struct lto_output_stream *index_stream,
const char *string, bool persistent)
streamer_write_string (struct output_block *ob,
struct lto_output_stream *index_stream,
const char *string, bool persistent)
{
if (string)
lto_output_string_with_length (ob, index_stream, string,
strlen (string) + 1,
persistent);
streamer_write_string_with_length (ob, index_stream, string,
strlen (string) + 1,
persistent);
else
lto_output_1_stream (index_stream, 0);
streamer_write_char_stream (index_stream, 0);
}
/* Write a zero to the output stream. */
void
output_zero (struct output_block *ob)
streamer_write_zero (struct output_block *ob)
{
lto_output_1_stream (ob->main_stream, 0);
streamer_write_char_stream (ob->main_stream, 0);
}
/* Output an unsigned LEB128 quantity to OB->main_stream. */
/* Write an unsigned HOST_WIDE_INT value WORK to OB->main_stream. */
void
output_uleb128 (struct output_block *ob, unsigned HOST_WIDE_INT work)
streamer_write_uhwi (struct output_block *ob, unsigned HOST_WIDE_INT work)
{
lto_output_uleb128_stream (ob->main_stream, work);
streamer_write_uhwi_stream (ob->main_stream, work);
}
/* Output a signed LEB128 quantity to OB->main_stream. */
/* Write a HOST_WIDE_INT value WORK to OB->main_stream. */
void
output_sleb128 (struct output_block *ob, HOST_WIDE_INT work)
streamer_write_hwi (struct output_block *ob, HOST_WIDE_INT work)
{
lto_output_sleb128_stream (ob->main_stream, work);
streamer_write_hwi_stream (ob->main_stream, work);
}
/* Output an unsigned LEB128 quantity to OBS. */
/* Write an unsigned HOST_WIDE_INT value WORK to OBS. */
void
lto_output_uleb128_stream (struct lto_output_stream *obs,
unsigned HOST_WIDE_INT work)
streamer_write_uhwi_stream (struct lto_output_stream *obs,
unsigned HOST_WIDE_INT work)
{
do
{
......@@ -155,39 +156,16 @@ lto_output_uleb128_stream (struct lto_output_stream *obs,
/* More bytes to follow. */
byte |= 0x80;
lto_output_1_stream (obs, byte);
streamer_write_char_stream (obs, byte);
}
while (work != 0);
}
/* Identical to output_uleb128_stream above except using unsigned
HOST_WIDEST_INT type. For efficiency on host where unsigned HOST_WIDEST_INT
is not native, we only use this if we know that HOST_WIDE_INT is not wide
enough. */
/* Write a HOST_WIDE_INT value WORK to OBS. */
void
lto_output_widest_uint_uleb128_stream (struct lto_output_stream *obs,
unsigned HOST_WIDEST_INT work)
{
do
{
unsigned int byte = (work & 0x7f);
work >>= 7;
if (work != 0)
/* More bytes to follow. */
byte |= 0x80;
lto_output_1_stream (obs, byte);
}
while (work != 0);
}
/* Output a signed LEB128 quantity. */
void
lto_output_sleb128_stream (struct lto_output_stream *obs, HOST_WIDE_INT work)
streamer_write_hwi_stream (struct lto_output_stream *obs, HOST_WIDE_INT work)
{
int more, byte;
......@@ -201,7 +179,7 @@ lto_output_sleb128_stream (struct lto_output_stream *obs, HOST_WIDE_INT work)
if (more)
byte |= 0x80;
lto_output_1_stream (obs, byte);
streamer_write_char_stream (obs, byte);
}
while (more);
}
......@@ -55,6 +55,35 @@ struct string_slot
unsigned int slot_num;
};
/* In data-streamer.c */
void bp_pack_var_len_unsigned (struct bitpack_d *, unsigned HOST_WIDE_INT);
void bp_pack_var_len_int (struct bitpack_d *, HOST_WIDE_INT);
unsigned HOST_WIDE_INT bp_unpack_var_len_unsigned (struct bitpack_d *);
HOST_WIDE_INT bp_unpack_var_len_int (struct bitpack_d *);
/* In data-streamer-out.c */
void streamer_write_zero (struct output_block *);
void streamer_write_uhwi (struct output_block *, unsigned HOST_WIDE_INT);
void streamer_write_hwi (struct output_block *, HOST_WIDE_INT);
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);
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);
/* 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 *,
unsigned int *);
unsigned HOST_WIDE_INT streamer_read_uhwi (struct lto_input_block *);
HOST_WIDE_INT streamer_read_hwi (struct lto_input_block *);
/* Returns a hash code for P. Adapted from libiberty's htab_hash_string
to support strings that may not end in '\0'. */
......@@ -111,7 +140,8 @@ bp_pack_value (struct bitpack_d *bp, bitpack_word_t val, unsigned nbits)
next one. */
if (pos + nbits > BITS_PER_BITPACK_WORD)
{
lto_output_uleb128_stream ((struct lto_output_stream *) bp->stream, word);
streamer_write_uhwi_stream ((struct lto_output_stream *) bp->stream,
word);
word = val;
pos = nbits;
}
......@@ -126,20 +156,20 @@ bp_pack_value (struct bitpack_d *bp, bitpack_word_t val, unsigned nbits)
/* Finishes bit-packing of BP. */
static inline void
lto_output_bitpack (struct bitpack_d *bp)
streamer_write_bitpack (struct bitpack_d *bp)
{
lto_output_uleb128_stream ((struct lto_output_stream *) bp->stream,
bp->word);
streamer_write_uhwi_stream ((struct lto_output_stream *) bp->stream,
bp->word);
bp->word = 0;
bp->pos = 0;
}
/* Returns a new bit-packing context for bit-unpacking from IB. */
static inline struct bitpack_d
lto_input_bitpack (struct lto_input_block *ib)
streamer_read_bitpack (struct lto_input_block *ib)
{
struct bitpack_d bp;
bp.word = lto_input_uleb128 (ib);
bp.word = streamer_read_uhwi (ib);
bp.pos = 0;
bp.stream = (void *)ib;
return bp;
......@@ -160,7 +190,8 @@ bp_unpack_value (struct bitpack_d *bp, unsigned nbits)
switch to the next one. */
if (pos + nbits > BITS_PER_BITPACK_WORD)
{
bp->word = val = lto_input_uleb128 ((struct lto_input_block *)bp->stream);
bp->word = val
= streamer_read_uhwi ((struct lto_input_block *)bp->stream);
bp->pos = nbits;
return val & mask;
}
......@@ -175,7 +206,7 @@ bp_unpack_value (struct bitpack_d *bp, unsigned nbits)
/* Write a character to the output block. */
static inline void
lto_output_1_stream (struct lto_output_stream *obs, char c)
streamer_write_char_stream (struct lto_output_stream *obs, char c)
{
/* No space left. */
if (obs->left_in_block == 0)
......@@ -192,7 +223,7 @@ lto_output_1_stream (struct lto_output_stream *obs, char c)
/* Read byte from the input block. */
static inline unsigned char
lto_input_1_unsigned (struct lto_input_block *ib)
streamer_read_uchar (struct lto_input_block *ib)
{
if (ib->p >= ib->len)
lto_section_overrun (ib);
......@@ -204,10 +235,10 @@ lto_input_1_unsigned (struct lto_input_block *ib)
Be host independent, limit range to 31bits. */
static inline void
lto_output_int_in_range (struct lto_output_stream *obs,
HOST_WIDE_INT min,
HOST_WIDE_INT max,
HOST_WIDE_INT val)
streamer_write_hwi_in_range (struct lto_output_stream *obs,
HOST_WIDE_INT min,
HOST_WIDE_INT max,
HOST_WIDE_INT val)
{
HOST_WIDE_INT range = max - min;
......@@ -215,35 +246,35 @@ lto_output_int_in_range (struct lto_output_stream *obs,
&& range < 0x7fffffff);
val -= min;
lto_output_1_stream (obs, val & 255);
streamer_write_char_stream (obs, val & 255);
if (range >= 0xff)
lto_output_1_stream (obs, (val >> 8) & 255);
streamer_write_char_stream (obs, (val >> 8) & 255);
if (range >= 0xffff)
lto_output_1_stream (obs, (val >> 16) & 255);
streamer_write_char_stream (obs, (val >> 16) & 255);
if (range >= 0xffffff)
lto_output_1_stream (obs, (val >> 24) & 255);
streamer_write_char_stream (obs, (val >> 24) & 255);
}
/* Input VAL into OBS and verify it is in range MIN...MAX that is supposed
to be compile time constant. PURPOSE is used for error reporting. */
static inline HOST_WIDE_INT
lto_input_int_in_range (struct lto_input_block *ib,
const char *purpose,
HOST_WIDE_INT min,
HOST_WIDE_INT max)
streamer_read_hwi_in_range (struct lto_input_block *ib,
const char *purpose,
HOST_WIDE_INT min,
HOST_WIDE_INT max)
{
HOST_WIDE_INT range = max - min;
HOST_WIDE_INT val = lto_input_1_unsigned (ib);
HOST_WIDE_INT val = streamer_read_uchar (ib);
gcc_checking_assert (range > 0 && range < 0x7fffffff);
if (range >= 0xff)
val |= ((HOST_WIDE_INT)lto_input_1_unsigned (ib)) << 8;
val |= ((HOST_WIDE_INT)streamer_read_uchar (ib)) << 8;
if (range >= 0xffff)
val |= ((HOST_WIDE_INT)lto_input_1_unsigned (ib)) << 16;
val |= ((HOST_WIDE_INT)streamer_read_uchar (ib)) << 16;
if (range >= 0xffffff)
val |= ((HOST_WIDE_INT)lto_input_1_unsigned (ib)) << 24;
val |= ((HOST_WIDE_INT)streamer_read_uchar (ib)) << 24;
val += min;
if (val < min || val > max)
lto_value_range_error (purpose, val, min, max);
......@@ -292,14 +323,14 @@ bp_unpack_int_in_range (struct bitpack_d *bp,
/* Output VAL of type "enum enum_name" into OBS.
Assume range 0...ENUM_LAST - 1. */
#define lto_output_enum(obs,enum_name,enum_last,val) \
lto_output_int_in_range ((obs), 0, (int)(enum_last) - 1, (int)(val))
#define streamer_write_enum(obs,enum_name,enum_last,val) \
streamer_write_hwi_in_range ((obs), 0, (int)(enum_last) - 1, (int)(val))
/* Input enum of type "enum enum_name" from IB.
Assume range 0...ENUM_LAST - 1. */
#define lto_input_enum(ib,enum_name,enum_last) \
(enum enum_name)lto_input_int_in_range ((ib), #enum_name, 0, \
(int)(enum_last) - 1)
#define streamer_read_enum(ib,enum_name,enum_last) \
(enum enum_name)streamer_read_hwi_in_range ((ib), #enum_name, 0, \
(int)(enum_last) - 1)
/* Output VAL of type "enum enum_name" into BP.
Assume range 0...ENUM_LAST - 1. */
......@@ -315,41 +346,17 @@ bp_unpack_int_in_range (struct bitpack_d *bp,
/* Output the start of a record with TAG to output block OB. */
static inline void
output_record_start (struct output_block *ob, enum LTO_tags tag)
streamer_write_record_start (struct output_block *ob, enum LTO_tags tag)
{
lto_output_enum (ob->main_stream, LTO_tags, LTO_NUM_TAGS, tag);
streamer_write_enum (ob->main_stream, LTO_tags, LTO_NUM_TAGS, tag);
}
/* Return the next tag in the input block IB. */
static inline enum LTO_tags
input_record_start (struct lto_input_block *ib)
streamer_read_record_start (struct lto_input_block *ib)
{
return lto_input_enum (ib, LTO_tags, LTO_NUM_TAGS);
return streamer_read_enum (ib, LTO_tags, LTO_NUM_TAGS);
}
/* In data-streamer.c */
void bp_pack_var_len_unsigned (struct bitpack_d *, unsigned HOST_WIDE_INT);
void bp_pack_var_len_int (struct bitpack_d *, HOST_WIDE_INT);
unsigned HOST_WIDE_INT bp_unpack_var_len_unsigned (struct bitpack_d *);
HOST_WIDE_INT bp_unpack_var_len_int (struct bitpack_d *);
/* In data-streamer-out.c */
void output_zero (struct output_block *);
void output_uleb128 (struct output_block *, unsigned HOST_WIDE_INT);
void output_sleb128 (struct output_block *, HOST_WIDE_INT);
void lto_output_string (struct output_block *, struct lto_output_stream *,
const char *, bool);
unsigned lto_string_index (struct output_block *, const char *, unsigned int,
bool);
void lto_output_string_with_length (struct output_block *,
struct lto_output_stream *,
const char *, unsigned int, bool);
const char *input_string_internal (struct data_in *, struct lto_input_block *,
unsigned int *);
/* In data-streamer-in.c */
const char *string_for_index (struct data_in *, unsigned int, unsigned int *);
const char *lto_input_string (struct data_in *, struct lto_input_block *);
#endif /* GCC_DATA_STREAMER_H */
......@@ -41,7 +41,7 @@ input_phi (struct lto_input_block *ib, basic_block bb, struct data_in *data_in,
int i, len;
gimple result;
ix = lto_input_uleb128 (ib);
ix = streamer_read_uhwi (ib);
phi_result = VEC_index (tree, SSANAMES (fn), ix);
len = EDGE_COUNT (bb->preds);
result = create_phi_node (phi_result, bb);
......@@ -53,7 +53,7 @@ input_phi (struct lto_input_block *ib, basic_block bb, struct data_in *data_in,
for (i = 0; i < len; i++)
{
tree def = stream_read_tree (ib, data_in);
int src_index = lto_input_uleb128 (ib);
int src_index = streamer_read_uhwi (ib);
location_t arg_loc = lto_input_location (ib, data_in);
basic_block sbb = BASIC_BLOCK_FOR_FUNCTION (fn, src_index);
......@@ -90,7 +90,7 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
code = lto_tag_to_gimple_code (tag);
/* Read the tuple header. */
bp = lto_input_bitpack (ib);
bp = streamer_read_bitpack (ib);
num_ops = bp_unpack_var_len_unsigned (&bp);
stmt = gimple_alloc (code, num_ops);
stmt->gsbase.no_warning = bp_unpack_value (&bp, 1);
......@@ -109,7 +109,7 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
switch (code)
{
case GIMPLE_RESX:
gimple_resx_set_region (stmt, lto_input_sleb128 (ib));
gimple_resx_set_region (stmt, streamer_read_hwi (ib));
break;
case GIMPLE_EH_MUST_NOT_THROW:
......@@ -117,18 +117,18 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
break;
case GIMPLE_EH_DISPATCH:
gimple_eh_dispatch_set_region (stmt, lto_input_sleb128 (ib));
gimple_eh_dispatch_set_region (stmt, streamer_read_hwi (ib));
break;
case GIMPLE_ASM:
{
/* FIXME lto. Move most of this into a new gimple_asm_set_string(). */
tree str;
stmt->gimple_asm.ni = lto_input_uleb128 (ib);
stmt->gimple_asm.no = lto_input_uleb128 (ib);
stmt->gimple_asm.nc = lto_input_uleb128 (ib);
stmt->gimple_asm.nl = lto_input_uleb128 (ib);
str = input_string_cst (data_in, ib);
stmt->gimple_asm.ni = streamer_read_uhwi (ib);
stmt->gimple_asm.no = streamer_read_uhwi (ib);
stmt->gimple_asm.nc = streamer_read_uhwi (ib);
stmt->gimple_asm.nl = streamer_read_uhwi (ib);
str = streamer_read_string_cst (data_in, ib);
stmt->gimple_asm.string = TREE_STRING_POINTER (str);
}
/* Fallthru */
......@@ -221,7 +221,7 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
{
if (gimple_call_internal_p (stmt))
gimple_call_set_internal_fn
(stmt, lto_input_enum (ib, internal_fn, IFN_LAST));
(stmt, streamer_read_enum (ib, internal_fn, IFN_LAST));
else
gimple_call_set_fntype (stmt, stream_read_tree (ib, data_in));
}
......@@ -286,21 +286,21 @@ input_bb (struct lto_input_block *ib, enum LTO_tags tag,
basic GIMPLE routines that use CFUN. */
gcc_assert (cfun == fn);
index = lto_input_uleb128 (ib);
index = streamer_read_uhwi (ib);
bb = BASIC_BLOCK_FOR_FUNCTION (fn, index);
bb->count = (lto_input_sleb128 (ib) * count_materialization_scale
bb->count = (streamer_read_hwi (ib) * count_materialization_scale
+ REG_BR_PROB_BASE / 2) / REG_BR_PROB_BASE;
bb->loop_depth = lto_input_sleb128 (ib);
bb->frequency = lto_input_sleb128 (ib);
bb->flags = lto_input_sleb128 (ib);
bb->loop_depth = streamer_read_hwi (ib);
bb->frequency = streamer_read_hwi (ib);
bb->flags = streamer_read_hwi (ib);
/* LTO_bb1 has statements. LTO_bb0 does not. */
if (tag == LTO_bb0)
return;
bsi = gsi_start_bb (bb);
tag = input_record_start (ib);
tag = streamer_read_record_start (ib);
while (tag)
{
gimple stmt = input_gimple_stmt (ib, data_in, fn, tag);
......@@ -310,24 +310,24 @@ input_bb (struct lto_input_block *ib, enum LTO_tags tag,
/* After the statement, expect a 0 delimiter or the EH region
that the previous statement belongs to. */
tag = input_record_start (ib);
tag = streamer_read_record_start (ib);
lto_tag_check_set (tag, 2, LTO_eh_region, LTO_null);
if (tag == LTO_eh_region)
{
HOST_WIDE_INT region = lto_input_sleb128 (ib);
HOST_WIDE_INT region = streamer_read_hwi (ib);
gcc_assert (region == (int) region);
add_stmt_to_eh_lp (stmt, region);
}
tag = input_record_start (ib);
tag = streamer_read_record_start (ib);
}
tag = input_record_start (ib);
tag = streamer_read_record_start (ib);
while (tag)
{
gimple phi = input_phi (ib, bb, data_in, fn);
find_referenced_vars_in (phi);
tag = input_record_start (ib);
tag = streamer_read_record_start (ib);
}
}
......@@ -36,13 +36,13 @@ output_phi (struct output_block *ob, gimple phi)
{
unsigned i, len = gimple_phi_num_args (phi);
output_record_start (ob, lto_gimple_code_to_tag (GIMPLE_PHI));
output_uleb128 (ob, SSA_NAME_VERSION (PHI_RESULT (phi)));
streamer_write_record_start (ob, lto_gimple_code_to_tag (GIMPLE_PHI));
streamer_write_uhwi (ob, SSA_NAME_VERSION (PHI_RESULT (phi)));
for (i = 0; i < len; i++)
{
stream_write_tree (ob, gimple_phi_arg_def (phi, i), true);
output_uleb128 (ob, gimple_phi_arg_edge (phi, i)->src->index);
streamer_write_uhwi (ob, gimple_phi_arg_edge (phi, i)->src->index);
lto_output_location (ob, gimple_phi_arg_location (phi, i));
}
}
......@@ -61,7 +61,7 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
/* Emit identifying tag. */
code = gimple_code (stmt);
tag = lto_gimple_code_to_tag (code);
output_record_start (ob, tag);
streamer_write_record_start (ob, tag);
/* Emit the tuple header. */
bp = bitpack_create (ob->main_stream);
......@@ -71,7 +71,7 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
bp_pack_value (&bp, gimple_assign_nontemporal_move_p (stmt), 1);
bp_pack_value (&bp, gimple_has_volatile_ops (stmt), 1);
bp_pack_var_len_unsigned (&bp, stmt->gsbase.subcode);
lto_output_bitpack (&bp);
streamer_write_bitpack (&bp);
/* Emit location information for the statement. */
lto_output_location (ob, gimple_location (stmt));
......@@ -83,7 +83,7 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
switch (gimple_code (stmt))
{
case GIMPLE_RESX:
output_sleb128 (ob, gimple_resx_region (stmt));
streamer_write_hwi (ob, gimple_resx_region (stmt));
break;
case GIMPLE_EH_MUST_NOT_THROW:
......@@ -91,15 +91,16 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
break;
case GIMPLE_EH_DISPATCH:
output_sleb128 (ob, gimple_eh_dispatch_region (stmt));
streamer_write_hwi (ob, gimple_eh_dispatch_region (stmt));
break;
case GIMPLE_ASM:
lto_output_uleb128_stream (ob->main_stream, gimple_asm_ninputs (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));
lto_output_string (ob, ob->main_stream, gimple_asm_string (stmt), true);
streamer_write_uhwi (ob, gimple_asm_ninputs (stmt));
streamer_write_uhwi (ob, gimple_asm_noutputs (stmt));
streamer_write_uhwi (ob, gimple_asm_nclobbers (stmt));
streamer_write_uhwi (ob, gimple_asm_nlabels (stmt));
streamer_write_string (ob, ob->main_stream, gimple_asm_string (stmt),
true);
/* Fallthru */
case GIMPLE_ASSIGN:
......@@ -139,8 +140,8 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
if (is_gimple_call (stmt))
{
if (gimple_call_internal_p (stmt))
lto_output_enum (ob->main_stream, internal_fn,
IFN_LAST, gimple_call_internal_fn (stmt));
streamer_write_enum (ob->main_stream, internal_fn,
IFN_LAST, gimple_call_internal_fn (stmt));
else
stream_write_tree (ob, gimple_call_fntype (stmt), true);
}
......@@ -163,16 +164,16 @@ output_bb (struct output_block *ob, basic_block bb, struct function *fn)
{
gimple_stmt_iterator bsi = gsi_start_bb (bb);
output_record_start (ob,
(!gsi_end_p (bsi)) || phi_nodes (bb)
? LTO_bb1
: LTO_bb0);
streamer_write_record_start (ob,
(!gsi_end_p (bsi)) || phi_nodes (bb)
? LTO_bb1
: LTO_bb0);
output_uleb128 (ob, bb->index);
output_sleb128 (ob, bb->count);
output_sleb128 (ob, bb->loop_depth);
output_sleb128 (ob, bb->frequency);
output_sleb128 (ob, bb->flags);
streamer_write_uhwi (ob, bb->index);
streamer_write_hwi (ob, bb->count);
streamer_write_hwi (ob, bb->loop_depth);
streamer_write_hwi (ob, bb->frequency);
streamer_write_hwi (ob, bb->flags);
if (!gsi_end_p (bsi) || phi_nodes (bb))
{
......@@ -189,14 +190,14 @@ output_bb (struct output_block *ob, basic_block bb, struct function *fn)
region = lookup_stmt_eh_lp_fn (fn, stmt);
if (region != 0)
{
output_record_start (ob, LTO_eh_region);
output_sleb128 (ob, region);
streamer_write_record_start (ob, LTO_eh_region);
streamer_write_hwi (ob, region);
}
else
output_record_start (ob, LTO_null);
streamer_write_record_start (ob, LTO_null);
}
output_record_start (ob, LTO_null);
streamer_write_record_start (ob, LTO_null);
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi))
{
......@@ -209,6 +210,6 @@ output_bb (struct output_block *ob, basic_block bb, struct function *fn)
output_phi (ob, phi);
}
output_record_start (ob, LTO_null);
streamer_write_record_start (ob, LTO_null);
}
}
......@@ -2326,7 +2326,7 @@ read_predicate (struct lto_input_block *ib)
do
{
gcc_assert (k <= MAX_CLAUSES);
clause = out.clause[k++] = lto_input_uleb128 (ib);
clause = out.clause[k++] = streamer_read_uhwi (ib);
}
while (clause);
......@@ -2346,9 +2346,9 @@ read_inline_edge_summary (struct lto_input_block *ib, struct cgraph_edge *e)
struct inline_edge_summary *es = inline_edge_summary (e);
struct predicate p;
es->call_stmt_size = lto_input_uleb128 (ib);
es->call_stmt_time = lto_input_uleb128 (ib);
es->loop_depth = lto_input_uleb128 (ib);
es->call_stmt_size = streamer_read_uhwi (ib);
es->call_stmt_time = streamer_read_uhwi (ib);
es->loop_depth = streamer_read_uhwi (ib);
p = read_predicate (ib);
edge_set_predicate (e, &p);
}
......@@ -2376,7 +2376,7 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
data_in =
lto_data_in_create (file_data, (const char *) data + string_offset,
header->string_size, NULL);
f_count = lto_input_uleb128 (&ib);
f_count = streamer_read_uhwi (&ib);
for (i = 0; i < f_count; i++)
{
unsigned int index;
......@@ -2386,38 +2386,38 @@ inline_read_section (struct lto_file_decl_data *file_data, const char *data,
struct bitpack_d bp;
struct cgraph_edge *e;
index = lto_input_uleb128 (&ib);
index = streamer_read_uhwi (&ib);
encoder = file_data->cgraph_node_encoder;
node = lto_cgraph_encoder_deref (encoder, index);
info = inline_summary (node);
info->estimated_stack_size
= info->estimated_self_stack_size = lto_input_uleb128 (&ib);
info->size = info->self_size = lto_input_uleb128 (&ib);
info->time = info->self_time = lto_input_uleb128 (&ib);
= info->estimated_self_stack_size = streamer_read_uhwi (&ib);
info->size = info->self_size = streamer_read_uhwi (&ib);
info->time = info->self_time = streamer_read_uhwi (&ib);
bp = lto_input_bitpack (&ib);
bp = streamer_read_bitpack (&ib);
info->inlinable = bp_unpack_value (&bp, 1);
info->versionable = bp_unpack_value (&bp, 1);
count2 = lto_input_uleb128 (&ib);
count2 = streamer_read_uhwi (&ib);
gcc_assert (!info->conds);
for (j = 0; j < count2; j++)
{
struct condition c;
c.operand_num = lto_input_uleb128 (&ib);
c.code = (enum tree_code) lto_input_uleb128 (&ib);
c.operand_num = streamer_read_uhwi (&ib);
c.code = (enum tree_code) streamer_read_uhwi (&ib);
c.val = stream_read_tree (&ib, data_in);
VEC_safe_push (condition, gc, info->conds, &c);
}
count2 = lto_input_uleb128 (&ib);
count2 = streamer_read_uhwi (&ib);
gcc_assert (!info->entry);
for (j = 0; j < count2; j++)
{
struct size_time_entry e;
e.size = lto_input_uleb128 (&ib);
e.time = lto_input_uleb128 (&ib);
e.size = streamer_read_uhwi (&ib);
e.time = streamer_read_uhwi (&ib);
e.predicate = read_predicate (&ib);
VEC_safe_push (size_time_entry, gc, info->entry, &e);
......@@ -2480,10 +2480,9 @@ write_predicate (struct output_block *ob, struct predicate *p)
for (j = 0; p->clause[j]; j++)
{
gcc_assert (j < MAX_CLAUSES);
lto_output_uleb128_stream (ob->main_stream,
p->clause[j]);
streamer_write_uhwi (ob, p->clause[j]);
}
lto_output_uleb128_stream (ob->main_stream, 0);
streamer_write_uhwi (ob, 0);
}
......@@ -2493,9 +2492,9 @@ static void
write_inline_edge_summary (struct output_block *ob, struct cgraph_edge *e)
{
struct inline_edge_summary *es = inline_edge_summary (e);
lto_output_uleb128_stream (ob->main_stream, es->call_stmt_size);
lto_output_uleb128_stream (ob->main_stream, es->call_stmt_time);
lto_output_uleb128_stream (ob->main_stream, es->loop_depth);
streamer_write_uhwi (ob, es->call_stmt_size);
streamer_write_uhwi (ob, es->call_stmt_time);
streamer_write_uhwi (ob, es->loop_depth);
write_predicate (ob, es->predicate);
}
......@@ -2517,7 +2516,7 @@ inline_write_summary (cgraph_node_set set,
for (i = 0; i < lto_cgraph_encoder_size (encoder); i++)
if (lto_cgraph_encoder_deref (encoder, i)->analyzed)
count++;
lto_output_uleb128_stream (ob->main_stream, count);
streamer_write_uhwi (ob, count);
for (i = 0; i < lto_cgraph_encoder_size (encoder); i++)
{
......@@ -2532,38 +2531,28 @@ inline_write_summary (cgraph_node_set set,
struct condition *c;
lto_output_uleb128_stream (ob->main_stream,
lto_cgraph_encoder_encode (encoder, node));
lto_output_sleb128_stream (ob->main_stream,
info->estimated_self_stack_size);
lto_output_sleb128_stream (ob->main_stream,
info->self_size);
lto_output_sleb128_stream (ob->main_stream,
info->self_time);
streamer_write_uhwi (ob, lto_cgraph_encoder_encode (encoder, node));
streamer_write_hwi (ob, info->estimated_self_stack_size);
streamer_write_hwi (ob, info->self_size);
streamer_write_hwi (ob, info->self_time);
bp = bitpack_create (ob->main_stream);
bp_pack_value (&bp, info->inlinable, 1);
bp_pack_value (&bp, info->versionable, 1);
lto_output_bitpack (&bp);
lto_output_uleb128_stream (ob->main_stream,
VEC_length (condition, info->conds));
streamer_write_bitpack (&bp);
streamer_write_uhwi (ob, VEC_length (condition, info->conds));
for (i = 0; VEC_iterate (condition, info->conds, i, c); i++)
{
lto_output_uleb128_stream (ob->main_stream,
c->operand_num);
lto_output_uleb128_stream (ob->main_stream,
c->code);
streamer_write_uhwi (ob, c->operand_num);
streamer_write_uhwi (ob, c->code);
stream_write_tree (ob, c->val, true);
}
lto_output_uleb128_stream (ob->main_stream,
VEC_length (size_time_entry, info->entry));
streamer_write_uhwi (ob, VEC_length (size_time_entry, info->entry));
for (i = 0;
VEC_iterate (size_time_entry, info->entry, i, e);
i++)
{
lto_output_uleb128_stream (ob->main_stream,
e->size);
lto_output_uleb128_stream (ob->main_stream,
e->time);
streamer_write_uhwi (ob, e->size);
streamer_write_uhwi (ob, e->time);
write_predicate (ob, &e->predicate);
}
for (edge = node->callees; edge; edge = edge->next_callee)
......@@ -2572,7 +2561,7 @@ inline_write_summary (cgraph_node_set set,
write_inline_edge_summary (ob, edge);
}
}
lto_output_1_stream (ob->main_stream, 0);
streamer_write_char_stream (ob->main_stream, 0);
produce_asm (ob, NULL);
destroy_output_block (ob);
......
......@@ -2644,8 +2644,7 @@ static void
ipa_write_jump_function (struct output_block *ob,
struct ipa_jump_func *jump_func)
{
lto_output_uleb128_stream (ob->main_stream,
jump_func->type);
streamer_write_uhwi (ob, jump_func->type);
switch (jump_func->type)
{
......@@ -2659,17 +2658,13 @@ ipa_write_jump_function (struct output_block *ob,
break;
case IPA_JF_PASS_THROUGH:
stream_write_tree (ob, jump_func->value.pass_through.operand, true);
lto_output_uleb128_stream (ob->main_stream,
jump_func->value.pass_through.formal_id);
lto_output_uleb128_stream (ob->main_stream,
jump_func->value.pass_through.operation);
streamer_write_uhwi (ob, jump_func->value.pass_through.formal_id);
streamer_write_uhwi (ob, jump_func->value.pass_through.operation);
break;
case IPA_JF_ANCESTOR:
lto_output_uleb128_stream (ob->main_stream,
jump_func->value.ancestor.offset);
streamer_write_uhwi (ob, jump_func->value.ancestor.offset);
stream_write_tree (ob, jump_func->value.ancestor.type, true);
lto_output_uleb128_stream (ob->main_stream,
jump_func->value.ancestor.formal_id);
streamer_write_uhwi (ob, jump_func->value.ancestor.formal_id);
break;
case IPA_JF_CONST_MEMBER_PTR:
stream_write_tree (ob, jump_func->value.member_cst.pfn, true);
......@@ -2685,7 +2680,7 @@ ipa_read_jump_function (struct lto_input_block *ib,
struct ipa_jump_func *jump_func,
struct data_in *data_in)
{
jump_func->type = (enum jump_func_type) lto_input_uleb128 (ib);
jump_func->type = (enum jump_func_type) streamer_read_uhwi (ib);
switch (jump_func->type)
{
......@@ -2699,13 +2694,14 @@ ipa_read_jump_function (struct lto_input_block *ib,
break;
case IPA_JF_PASS_THROUGH:
jump_func->value.pass_through.operand = stream_read_tree (ib, data_in);
jump_func->value.pass_through.formal_id = lto_input_uleb128 (ib);
jump_func->value.pass_through.operation = (enum tree_code) lto_input_uleb128 (ib);
jump_func->value.pass_through.formal_id = streamer_read_uhwi (ib);
jump_func->value.pass_through.operation
= (enum tree_code) streamer_read_uhwi (ib);
break;
case IPA_JF_ANCESTOR:
jump_func->value.ancestor.offset = lto_input_uleb128 (ib);
jump_func->value.ancestor.offset = streamer_read_uhwi (ib);
jump_func->value.ancestor.type = stream_read_tree (ib, data_in);
jump_func->value.ancestor.formal_id = lto_input_uleb128 (ib);
jump_func->value.ancestor.formal_id = streamer_read_uhwi (ib);
break;
case IPA_JF_CONST_MEMBER_PTR:
jump_func->value.member_cst.pfn = stream_read_tree (ib, data_in);
......@@ -2724,15 +2720,15 @@ ipa_write_indirect_edge_info (struct output_block *ob,
struct cgraph_indirect_call_info *ii = cs->indirect_info;
struct bitpack_d bp;
lto_output_sleb128_stream (ob->main_stream, ii->param_index);
lto_output_sleb128_stream (ob->main_stream, ii->anc_offset);
streamer_write_hwi (ob, ii->param_index);
streamer_write_hwi (ob, ii->anc_offset);
bp = bitpack_create (ob->main_stream);
bp_pack_value (&bp, ii->polymorphic, 1);
lto_output_bitpack (&bp);
streamer_write_bitpack (&bp);
if (ii->polymorphic)
{
lto_output_sleb128_stream (ob->main_stream, ii->otr_token);
streamer_write_hwi (ob, ii->otr_token);
stream_write_tree (ob, ii->otr_type, true);
}
}
......@@ -2748,13 +2744,13 @@ ipa_read_indirect_edge_info (struct lto_input_block *ib,
struct cgraph_indirect_call_info *ii = cs->indirect_info;
struct bitpack_d bp;
ii->param_index = (int) lto_input_sleb128 (ib);
ii->anc_offset = (HOST_WIDE_INT) lto_input_sleb128 (ib);
bp = lto_input_bitpack (ib);
ii->param_index = (int) streamer_read_hwi (ib);
ii->anc_offset = (HOST_WIDE_INT) streamer_read_hwi (ib);
bp = streamer_read_bitpack (ib);
ii->polymorphic = bp_unpack_value (&bp, 1);
if (ii->polymorphic)
{
ii->otr_token = (HOST_WIDE_INT) lto_input_sleb128 (ib);
ii->otr_token = (HOST_WIDE_INT) streamer_read_hwi (ib);
ii->otr_type = stream_read_tree (ib, data_in);
}
}
......@@ -2773,7 +2769,7 @@ ipa_write_node_info (struct output_block *ob, struct cgraph_node *node)
encoder = ob->decl_state->cgraph_node_encoder;
node_ref = lto_cgraph_encoder_encode (encoder, node);
lto_output_uleb128_stream (ob->main_stream, node_ref);
streamer_write_uhwi (ob, node_ref);
bp = bitpack_create (ob->main_stream);
gcc_assert (info->uses_analysis_done
......@@ -2782,13 +2778,12 @@ ipa_write_node_info (struct output_block *ob, struct cgraph_node *node)
gcc_assert (!info->ipcp_orig_node);
for (j = 0; j < ipa_get_param_count (info); j++)
bp_pack_value (&bp, ipa_is_param_used (info, j), 1);
lto_output_bitpack (&bp);
streamer_write_bitpack (&bp);
for (e = node->callees; e; e = e->next_callee)
{
struct ipa_edge_args *args = IPA_EDGE_REF (e);
lto_output_uleb128_stream (ob->main_stream,
ipa_get_cs_argument_count (args));
streamer_write_uhwi (ob, ipa_get_cs_argument_count (args));
for (j = 0; j < ipa_get_cs_argument_count (args); j++)
ipa_write_jump_function (ob, ipa_get_ith_jump_func (args, j));
}
......@@ -2796,8 +2791,7 @@ ipa_write_node_info (struct output_block *ob, struct cgraph_node *node)
{
struct ipa_edge_args *args = IPA_EDGE_REF (e);
lto_output_uleb128_stream (ob->main_stream,
ipa_get_cs_argument_count (args));
streamer_write_uhwi (ob, ipa_get_cs_argument_count (args));
for (j = 0; j < ipa_get_cs_argument_count (args); j++)
ipa_write_jump_function (ob, ipa_get_ith_jump_func (args, j));
ipa_write_indirect_edge_info (ob, e);
......@@ -2817,7 +2811,7 @@ ipa_read_node_info (struct lto_input_block *ib, struct cgraph_node *node,
ipa_initialize_node_params (node);
bp = lto_input_bitpack (ib);
bp = streamer_read_bitpack (ib);
if (ipa_get_param_count (info) != 0)
info->uses_analysis_done = true;
info->node_enqueued = false;
......@@ -2826,7 +2820,7 @@ ipa_read_node_info (struct lto_input_block *ib, struct cgraph_node *node,
for (e = node->callees; e; e = e->next_callee)
{
struct ipa_edge_args *args = IPA_EDGE_REF (e);
int count = lto_input_uleb128 (ib);
int count = streamer_read_uhwi (ib);
ipa_set_cs_argument_count (args, count);
if (!count)
......@@ -2840,7 +2834,7 @@ ipa_read_node_info (struct lto_input_block *ib, struct cgraph_node *node,
for (e = node->indirect_calls; e; e = e->next_callee)
{
struct ipa_edge_args *args = IPA_EDGE_REF (e);
int count = lto_input_uleb128 (ib);
int count = streamer_read_uhwi (ib);
ipa_set_cs_argument_count (args, count);
if (count)
......@@ -2877,7 +2871,7 @@ ipa_prop_write_jump_functions (cgraph_node_set set)
count++;
}
lto_output_uleb128_stream (ob->main_stream, count);
streamer_write_uhwi (ob, count);
/* Process all of the functions. */
for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi))
......@@ -2887,7 +2881,7 @@ ipa_prop_write_jump_functions (cgraph_node_set set)
&& IPA_NODE_REF (node) != NULL)
ipa_write_node_info (ob, node);
}
lto_output_1_stream (ob->main_stream, 0);
streamer_write_char_stream (ob->main_stream, 0);
produce_asm (ob, NULL);
destroy_output_block (ob);
}
......@@ -2914,7 +2908,7 @@ ipa_prop_read_section (struct lto_file_decl_data *file_data, const char *data,
data_in =
lto_data_in_create (file_data, (const char *) data + string_offset,
header->string_size, NULL);
count = lto_input_uleb128 (&ib_main);
count = streamer_read_uhwi (&ib_main);
for (i = 0; i < count; i++)
{
......@@ -2922,7 +2916,7 @@ ipa_prop_read_section (struct lto_file_decl_data *file_data, const char *data,
struct cgraph_node *node;
lto_cgraph_encoder_t encoder;
index = lto_input_uleb128 (&ib_main);
index = streamer_read_uhwi (&ib_main);
encoder = file_data->cgraph_node_encoder;
node = lto_cgraph_encoder_deref (encoder, index);
gcc_assert (node->analyzed);
......
......@@ -950,7 +950,7 @@ pure_const_write_summary (cgraph_node_set set,
count++;
}
lto_output_uleb128_stream (ob->main_stream, count);
streamer_write_uhwi_stream (ob->main_stream, count);
/* Process all of the functions. */
for (csi = csi_start (set); !csi_end_p (csi); csi_next (&csi))
......@@ -967,7 +967,7 @@ pure_const_write_summary (cgraph_node_set set,
encoder = ob->decl_state->cgraph_node_encoder;
node_ref = lto_cgraph_encoder_encode (encoder, node);
lto_output_uleb128_stream (ob->main_stream, node_ref);
streamer_write_uhwi_stream (ob->main_stream, node_ref);
/* Note that flags will need to be read in the opposite
order as we are pushing the bitflags into FLAGS. */
......@@ -977,7 +977,7 @@ pure_const_write_summary (cgraph_node_set set,
bp_pack_value (&bp, fs->looping_previously_known, 1);
bp_pack_value (&bp, fs->looping, 1);
bp_pack_value (&bp, fs->can_throw, 1);
lto_output_bitpack (&bp);
streamer_write_bitpack (&bp);
}
}
......@@ -1006,7 +1006,7 @@ pure_const_read_summary (void)
if (ib)
{
unsigned int i;
unsigned int count = lto_input_uleb128 (ib);
unsigned int count = streamer_read_uhwi (ib);
for (i = 0; i < count; i++)
{
......@@ -1017,7 +1017,7 @@ pure_const_read_summary (void)
lto_cgraph_encoder_t encoder;
fs = XCNEW (struct funct_state_d);
index = lto_input_uleb128 (ib);
index = streamer_read_uhwi (ib);
encoder = file_data->cgraph_node_encoder;
node = lto_cgraph_encoder_deref (encoder, index);
set_function_state (node, fs);
......@@ -1025,7 +1025,7 @@ pure_const_read_summary (void)
/* Note that the flags must be read in the opposite
order in which they were written (the bitflags were
pushed into FLAGS). */
bp = lto_input_bitpack (ib);
bp = streamer_read_bitpack (ib);
fs->pure_const_state
= (enum pure_const_state_e) bp_unpack_value (&bp, 2);
fs->state_previously_known
......
......@@ -58,6 +58,7 @@ along with GCC; see the file COPYING3. If not see
#include "timevar.h"
#include "diagnostic.h"
#include "langhooks.h"
#include "data-streamer.h"
#include "lto-streamer.h"
static void remove_node_data (struct cgraph_node *node,
......@@ -992,17 +993,17 @@ stream_out_bitmap (struct lto_simple_output_block *ob,
bitmap_iterator bi;
if (bits == all_module_statics)
{
lto_output_sleb128_stream (ob->main_stream, -1);
streamer_write_hwi_stream (ob->main_stream, -1);
return;
}
EXECUTE_IF_AND_IN_BITMAP (bits, ltrans_statics, 0, index, bi)
count ++;
if (count == ltrans_statics_bitcount)
{
lto_output_sleb128_stream (ob->main_stream, -1);
streamer_write_hwi_stream (ob->main_stream, -1);
return;
}
lto_output_sleb128_stream (ob->main_stream, count);
streamer_write_hwi_stream (ob->main_stream, count);
if (!count)
return;
EXECUTE_IF_AND_IN_BITMAP (bits, ltrans_statics, 0, index, bi)
......@@ -1054,7 +1055,7 @@ ipa_reference_write_optimization_summary (cgraph_node_set set,
set, vset, ltrans_statics))
count++;
lto_output_uleb128_stream (ob->main_stream, count);
streamer_write_uhwi_stream (ob->main_stream, count);
if (count)
stream_out_bitmap (ob, ltrans_statics, ltrans_statics,
-1);
......@@ -1071,7 +1072,7 @@ ipa_reference_write_optimization_summary (cgraph_node_set set,
info = get_reference_optimization_summary (node);
node_ref = lto_cgraph_encoder_encode (encoder, node);
lto_output_uleb128_stream (ob->main_stream, node_ref);
streamer_write_uhwi_stream (ob->main_stream, node_ref);
stream_out_bitmap (ob, info->statics_not_read, ltrans_statics,
ltrans_statics_bitcount);
......@@ -1112,16 +1113,16 @@ ipa_reference_read_optimization_summary (void)
if (ib)
{
unsigned int i;
unsigned int f_count = lto_input_uleb128 (ib);
unsigned int f_count = streamer_read_uhwi (ib);
int b_count;
if (!f_count)
continue;
b_count = lto_input_sleb128 (ib);
b_count = streamer_read_hwi (ib);
if (dump_file)
fprintf (dump_file, "all module statics:");
for (i = 0; i < (unsigned int)b_count; i++)
{
unsigned int var_index = lto_input_uleb128 (ib);
unsigned int var_index = streamer_read_uhwi (ib);
tree v_decl = lto_file_decl_data_get_var_decl (file_data,
var_index);
bitmap_set_bit (all_module_statics, DECL_UID (v_decl));
......@@ -1138,7 +1139,7 @@ ipa_reference_read_optimization_summary (void)
int v_count;
lto_cgraph_encoder_t encoder;
index = lto_input_uleb128 (ib);
index = streamer_read_uhwi (ib);
encoder = file_data->cgraph_node_encoder;
node = lto_cgraph_encoder_deref (encoder, index);
info = XCNEW (struct ipa_reference_optimization_summary_d);
......@@ -1151,7 +1152,7 @@ ipa_reference_read_optimization_summary (void)
cgraph_node_name (node), node->uid);
/* Set the statics not read. */
v_count = lto_input_sleb128 (ib);
v_count = streamer_read_hwi (ib);
if (v_count == -1)
{
info->statics_not_read = all_module_statics;
......@@ -1161,7 +1162,7 @@ ipa_reference_read_optimization_summary (void)
else
for (j = 0; j < (unsigned int)v_count; j++)
{
unsigned int var_index = lto_input_uleb128 (ib);
unsigned int var_index = streamer_read_uhwi (ib);
tree v_decl = lto_file_decl_data_get_var_decl (file_data,
var_index);
bitmap_set_bit (info->statics_not_read, DECL_UID (v_decl));
......@@ -1174,7 +1175,7 @@ ipa_reference_read_optimization_summary (void)
fprintf (dump_file,
"\n static not written:");
/* Set the statics not written. */
v_count = lto_input_sleb128 (ib);
v_count = streamer_read_hwi (ib);
if (v_count == -1)
{
info->statics_not_written = all_module_statics;
......@@ -1184,7 +1185,7 @@ ipa_reference_read_optimization_summary (void)
else
for (j = 0; j < (unsigned int)v_count; j++)
{
unsigned int var_index = lto_input_uleb128 (ib);
unsigned int var_index = streamer_read_uhwi (ib);
tree v_decl = lto_file_decl_data_get_var_decl (file_data,
var_index);
bitmap_set_bit (info->statics_not_written, DECL_UID (v_decl));
......
......@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see
#include "pointer-set.h"
#include "bitmap.h"
#include "langhooks.h"
#include "data-streamer.h"
#include "lto-streamer.h"
#include "lto-compress.h"
......@@ -303,7 +304,7 @@ lto_output_decl_index (struct lto_output_stream *obs,
}
if (obs)
lto_output_uleb128_stream (obs, index);
streamer_write_uhwi_stream (obs, index);
*this_index = index;
return new_entry_p;
}
......
......@@ -291,7 +291,7 @@ lto_streamer_init (void)
match exactly the structures defined in treestruct.def. When a
new TS_* astructure is added, the streamer should be updated to
handle it. */
check_handled_ts_structures ();
streamer_check_handled_ts_structures ();
#ifdef LTO_STREAMER_DEBUG
tree_htab = htab_create (31, hash_tree, eq_tree, NULL);
......
......@@ -652,7 +652,7 @@ struct output_block
bool global;
/* Cache of nodes written in this section. */
struct lto_streamer_cache_d *writer_cache;
struct streamer_tree_cache_d *writer_cache;
/* All data persistent across whole duration of output block
can go here. */
......@@ -690,7 +690,7 @@ struct data_in
VEC(ld_plugin_symbol_resolution_t,heap) *globals_resolution;
/* Cache of pickled nodes. */
struct lto_streamer_cache_d *reader_cache;
struct streamer_tree_cache_d *reader_cache;
};
......@@ -712,10 +712,6 @@ extern const char *lto_get_section_data (struct lto_file_decl_data *,
extern void lto_free_section_data (struct lto_file_decl_data *,
enum lto_section_type,
const char *, const char *, size_t);
extern unsigned HOST_WIDE_INT lto_input_uleb128 (struct lto_input_block *);
extern unsigned HOST_WIDEST_INT lto_input_widest_uint_uleb128 (
struct lto_input_block *);
extern HOST_WIDE_INT lto_input_sleb128 (struct lto_input_block *);
extern htab_t lto_create_renaming_table (void);
extern void lto_record_renamed_decl (struct lto_file_decl_data *,
const char *, const char *);
......@@ -742,12 +738,6 @@ extern void lto_end_section (void);
extern void lto_write_stream (struct lto_output_stream *);
extern void lto_output_data_stream (struct lto_output_stream *, const void *,
size_t);
extern void lto_output_uleb128_stream (struct lto_output_stream *,
unsigned HOST_WIDE_INT);
extern void lto_output_widest_uint_uleb128_stream (struct lto_output_stream *,
unsigned HOST_WIDEST_INT);
extern void lto_output_sleb128_stream (struct lto_output_stream *,
HOST_WIDE_INT);
extern bool lto_output_decl_index (struct lto_output_stream *,
struct lto_tree_ref_encoder *,
tree, unsigned int *);
......
......@@ -204,7 +204,7 @@ lto_read_in_decl_state (struct data_in *data_in, const uint32_t *data,
uint32_t i, j;
ix = *data++;
decl = lto_streamer_cache_get (data_in->reader_cache, ix);
decl = streamer_tree_cache_get (data_in->reader_cache, ix);
if (TREE_CODE (decl) != FUNCTION_DECL)
{
gcc_assert (decl == void_type_node);
......@@ -218,7 +218,7 @@ lto_read_in_decl_state (struct data_in *data_in, const uint32_t *data,
tree *decls = ggc_alloc_vec_tree (size);
for (j = 0; j < size; j++)
decls[j] = lto_streamer_cache_get (data_in->reader_cache, data[j]);
decls[j] = streamer_tree_cache_get (data_in->reader_cache, data[j]);
state->streams[i].size = size;
state->streams[i].trees = decls;
......@@ -563,7 +563,7 @@ lto_register_var_decl_in_symtab (struct data_in *data_in, tree decl)
if (TREE_PUBLIC (decl))
{
unsigned ix;
if (!lto_streamer_cache_lookup (data_in->reader_cache, decl, &ix))
if (!streamer_tree_cache_lookup (data_in->reader_cache, decl, &ix))
gcc_unreachable ();
lto_symtab_register_decl (decl, get_resolution (data_in, ix),
data_in->file_data);
......@@ -629,7 +629,7 @@ lto_register_function_decl_in_symtab (struct data_in *data_in, tree decl)
if (TREE_PUBLIC (decl) && !DECL_ABSTRACT (decl))
{
unsigned ix;
if (!lto_streamer_cache_lookup (data_in->reader_cache, decl, &ix))
if (!streamer_tree_cache_lookup (data_in->reader_cache, decl, &ix))
gcc_unreachable ();
lto_symtab_register_decl (decl, get_resolution (data_in, ix),
data_in->file_data);
......@@ -645,7 +645,7 @@ lto_register_function_decl_in_symtab (struct data_in *data_in, tree decl)
static void
uniquify_nodes (struct data_in *data_in, unsigned from)
{
struct lto_streamer_cache_d *cache = data_in->reader_cache;
struct streamer_tree_cache_d *cache = data_in->reader_cache;
unsigned len = VEC_length (tree, cache->nodes);
unsigned i;
......@@ -756,7 +756,7 @@ uniquify_nodes (struct data_in *data_in, unsigned from)
{
unsigned ix;
gcc_assert (f1 != f2 && DECL_NAME (f1) == DECL_NAME (f2));
if (!lto_streamer_cache_lookup (cache, f2, &ix))
if (!streamer_tree_cache_lookup (cache, f2, &ix))
gcc_unreachable ();
/* If we're going to replace an element which we'd
still visit in the next iterations, we wouldn't
......@@ -772,14 +772,14 @@ uniquify_nodes (struct data_in *data_in, unsigned from)
operand handling. */
if (ix < i)
lto_fixup_types (f2);
lto_streamer_cache_insert_at (cache, f1, ix);
streamer_tree_cache_insert_at (cache, f1, ix);
}
}
/* If we found a tree that is equal to oldt replace it in the
cache, so that further users (in the various LTO sections)
make use of it. */
lto_streamer_cache_insert_at (cache, t, i);
streamer_tree_cache_insert_at (cache, t, i);
}
}
......
......@@ -29,8 +29,6 @@ along with GCC; see the file COPYING3. If not see
struct output_block;
struct lto_input_block;
struct data_in;
struct bitpack_d;
struct lto_streamer_cache_d;
/* Streamer hooks. These functions do additional processing as
needed by the module. There are two types of callbacks, those that
......
......@@ -26,12 +26,12 @@ along with GCC; see the file COPYING3. If not see
#include "streamer-hooks.h"
#include "tree-streamer.h"
/* Check that all the TS_* structures handled by the lto_output_* and
lto_input_* routines are exactly ALL the structures defined in
/* Check that all the TS_* structures handled by the streamer_write_* and
streamer_read_* routines are exactly ALL the structures defined in
treestruct.def. */
void
check_handled_ts_structures (void)
streamer_check_handled_ts_structures (void)
{
bool handled_p[LAST_TS_ENUM];
unsigned i;
......@@ -87,12 +87,12 @@ check_handled_ts_structures (void)
}
/* Helper for lto_streamer_cache_insert_1. Add T to CACHE->NODES at
/* Helper for streamer_tree_cache_insert_1. Add T to CACHE->NODES at
slot IX. */
static void
lto_streamer_cache_add_to_node_array (struct lto_streamer_cache_d *cache,
unsigned ix, tree t)
streamer_tree_cache_add_to_node_array (struct streamer_tree_cache_d *cache,
unsigned ix, tree t)
{
/* Make sure we're either replacing an old element or
appending consecutively. */
......@@ -105,8 +105,8 @@ lto_streamer_cache_add_to_node_array (struct lto_streamer_cache_d *cache,
}
/* Helper for lto_streamer_cache_insert and lto_streamer_cache_insert_at.
CACHE, T, and IX_P are as in lto_streamer_cache_insert.
/* Helper for streamer_tree_cache_insert and streamer_tree_cache_insert_at.
CACHE, T, and IX_P are as in streamer_tree_cache_insert.
If INSERT_AT_NEXT_SLOT_P is true, T is inserted at the next available
slot in the cache. Otherwise, T is inserted at the position indicated
......@@ -116,9 +116,9 @@ lto_streamer_cache_add_to_node_array (struct lto_streamer_cache_d *cache,
return false. */
static bool
lto_streamer_cache_insert_1 (struct lto_streamer_cache_d *cache,
tree t, unsigned *ix_p,
bool insert_at_next_slot_p)
streamer_tree_cache_insert_1 (struct streamer_tree_cache_d *cache,
tree t, unsigned *ix_p,
bool insert_at_next_slot_p)
{
void **slot;
unsigned ix;
......@@ -136,7 +136,7 @@ lto_streamer_cache_insert_1 (struct lto_streamer_cache_d *cache,
ix = *ix_p;
*slot = (void *)(size_t) (ix + 1);
lto_streamer_cache_add_to_node_array (cache, ix, t);
streamer_tree_cache_add_to_node_array (cache, ix, t);
/* Indicate that the item was not present in the cache. */
existed_p = false;
......@@ -151,7 +151,7 @@ lto_streamer_cache_insert_1 (struct lto_streamer_cache_d *cache,
location, and ENTRY->TO does not match *IX_P, add T to
the requested location slot. */
ix = *ix_p;
lto_streamer_cache_add_to_node_array (cache, ix, t);
streamer_tree_cache_add_to_node_array (cache, ix, t);
}
/* Indicate that T was already in the cache. */
......@@ -172,10 +172,10 @@ lto_streamer_cache_insert_1 (struct lto_streamer_cache_d *cache,
T has been stored. */
bool
lto_streamer_cache_insert (struct lto_streamer_cache_d *cache, tree t,
unsigned *ix_p)
streamer_tree_cache_insert (struct streamer_tree_cache_d *cache, tree t,
unsigned *ix_p)
{
return lto_streamer_cache_insert_1 (cache, t, ix_p, true);
return streamer_tree_cache_insert_1 (cache, t, ix_p, true);
}
......@@ -183,20 +183,20 @@ lto_streamer_cache_insert (struct lto_streamer_cache_d *cache, tree t,
existed in the cache return true. Otherwise, return false. */
bool
lto_streamer_cache_insert_at (struct lto_streamer_cache_d *cache,
tree t, unsigned ix)
streamer_tree_cache_insert_at (struct streamer_tree_cache_d *cache,
tree t, unsigned ix)
{
return lto_streamer_cache_insert_1 (cache, t, &ix, false);
return streamer_tree_cache_insert_1 (cache, t, &ix, false);
}
/* Appends tree node T to CACHE, even if T already existed in it. */
void
lto_streamer_cache_append (struct lto_streamer_cache_d *cache, tree t)
streamer_tree_cache_append (struct streamer_tree_cache_d *cache, tree t)
{
unsigned ix = VEC_length (tree, cache->nodes);
lto_streamer_cache_insert_1 (cache, t, &ix, false);
streamer_tree_cache_insert_1 (cache, t, &ix, false);
}
/* Return true if tree node T exists in CACHE, otherwise false. If IX_P is
......@@ -204,8 +204,8 @@ lto_streamer_cache_append (struct lto_streamer_cache_d *cache, tree t)
((unsigned)-1 if T is not found). */
bool
lto_streamer_cache_lookup (struct lto_streamer_cache_d *cache, tree t,
unsigned *ix_p)
streamer_tree_cache_lookup (struct streamer_tree_cache_d *cache, tree t,
unsigned *ix_p)
{
void **slot;
bool retval;
......@@ -235,7 +235,7 @@ lto_streamer_cache_lookup (struct lto_streamer_cache_d *cache, tree t,
/* Return the tree node at slot IX in CACHE. */
tree
lto_streamer_cache_get (struct lto_streamer_cache_d *cache, unsigned ix)
streamer_tree_cache_get (struct streamer_tree_cache_d *cache, unsigned ix)
{
gcc_assert (cache);
......@@ -249,7 +249,7 @@ lto_streamer_cache_get (struct lto_streamer_cache_d *cache, unsigned ix)
/* Record NODE in CACHE. */
static void
lto_record_common_node (struct lto_streamer_cache_d *cache, tree node)
record_common_node (struct streamer_tree_cache_d *cache, tree node)
{
/* We have to make sure to fill exactly the same number of
elements for all frontends. That can include NULL trees.
......@@ -260,12 +260,12 @@ lto_record_common_node (struct lto_streamer_cache_d *cache, tree node)
if (!node)
node = error_mark_node;
lto_streamer_cache_append (cache, node);
streamer_tree_cache_append (cache, node);
if (POINTER_TYPE_P (node)
|| TREE_CODE (node) == COMPLEX_TYPE
|| TREE_CODE (node) == ARRAY_TYPE)
lto_record_common_node (cache, TREE_TYPE (node));
record_common_node (cache, TREE_TYPE (node));
else if (TREE_CODE (node) == RECORD_TYPE)
{
/* The FIELD_DECLs of structures should be shared, so that every
......@@ -275,7 +275,7 @@ lto_record_common_node (struct lto_streamer_cache_d *cache, tree node)
nonoverlapping_component_refs_p). */
tree f;
for (f = TYPE_FIELDS (node); f; f = TREE_CHAIN (f))
lto_record_common_node (cache, f);
record_common_node (cache, f);
}
}
......@@ -284,35 +284,35 @@ lto_record_common_node (struct lto_streamer_cache_d *cache, tree node)
properly according to the gimple type table. */
static void
preload_common_nodes (struct lto_streamer_cache_d *cache)
preload_common_nodes (struct streamer_tree_cache_d *cache)
{
unsigned i;
for (i = 0; i < itk_none; i++)
/* Skip itk_char. char_type_node is dependent on -f[un]signed-char. */
if (i != itk_char)
lto_record_common_node (cache, integer_types[i]);
record_common_node (cache, integer_types[i]);
for (i = 0; i < TYPE_KIND_LAST; i++)
lto_record_common_node (cache, sizetype_tab[i]);
record_common_node (cache, sizetype_tab[i]);
for (i = 0; i < TI_MAX; i++)
/* Skip boolean type and constants, they are frontend dependent. */
if (i != TI_BOOLEAN_TYPE
&& i != TI_BOOLEAN_FALSE
&& i != TI_BOOLEAN_TRUE)
lto_record_common_node (cache, global_trees[i]);
record_common_node (cache, global_trees[i]);
}
/* Create a cache of pickled nodes. */
struct lto_streamer_cache_d *
lto_streamer_cache_create (void)
struct streamer_tree_cache_d *
streamer_tree_cache_create (void)
{
struct lto_streamer_cache_d *cache;
struct streamer_tree_cache_d *cache;
cache = XCNEW (struct lto_streamer_cache_d);
cache = XCNEW (struct streamer_tree_cache_d);
cache->node_map = pointer_map_create ();
......@@ -328,7 +328,7 @@ lto_streamer_cache_create (void)
/* Delete the streamer cache C. */
void
lto_streamer_cache_delete (struct lto_streamer_cache_d *c)
streamer_tree_cache_delete (struct streamer_tree_cache_d *c)
{
if (c == NULL)
return;
......
......@@ -43,7 +43,7 @@ along with GCC; see the file COPYING3. If not see
T. The reconstructed T is inserted in some array so that when
the reference index for T is found in the input stream, it can be
used to look up into the array to get the reconstructed T. */
struct lto_streamer_cache_d
struct streamer_tree_cache_d
{
/* The mapping between tree nodes and slots into the nodes array. */
struct pointer_map_t *node_map;
......@@ -55,7 +55,7 @@ struct lto_streamer_cache_d
/* Return true if tree node EXPR should be streamed as a builtin. For
these nodes, we just emit the class and function code. */
static inline bool
lto_stream_as_builtin_p (tree expr)
streamer_handle_as_builtin_p (tree expr)
{
return (TREE_CODE (expr) == FUNCTION_DECL
&& DECL_IS_BUILTIN (expr)
......@@ -64,35 +64,35 @@ lto_stream_as_builtin_p (tree expr)
}
/* In tree-streamer-in.c. */
tree input_string_cst (struct data_in *, struct lto_input_block *);
void lto_streamer_read_tree (struct lto_input_block *, struct data_in *, tree);
tree lto_materialize_tree (struct lto_input_block *, struct data_in *,
enum LTO_tags);
void lto_input_tree_pointers (struct lto_input_block *, struct data_in *, tree);
tree lto_get_pickled_tree (struct lto_input_block *, struct data_in *);
tree lto_get_builtin_tree (struct lto_input_block *, struct data_in *);
tree lto_input_integer_cst (struct lto_input_block *, struct data_in *);
struct bitpack_d tree_read_bitfields (struct lto_input_block *, tree);
tree streamer_read_string_cst (struct data_in *, struct lto_input_block *);
tree streamer_read_chain (struct lto_input_block *, struct data_in *);
tree streamer_alloc_tree (struct lto_input_block *, struct data_in *,
enum LTO_tags);
void streamer_read_tree_body (struct lto_input_block *, struct data_in *, tree);
tree streamer_get_pickled_tree (struct lto_input_block *, struct data_in *);
tree streamer_get_builtin_tree (struct lto_input_block *, struct data_in *);
tree streamer_read_integer_cst (struct lto_input_block *, struct data_in *);
struct bitpack_d streamer_read_tree_bitfields (struct lto_input_block *, tree);
/* In tree-streamer-out.c. */
void lto_output_chain (struct output_block *, tree, bool);
void lto_output_tree_header (struct output_block *, tree);
void pack_value_fields (struct bitpack_d *, tree);
void lto_output_tree_pointers (struct output_block *, tree, bool);
void lto_output_integer_cst (struct output_block *, tree, bool);
void lto_output_builtin_tree (struct output_block *, tree);
void streamer_write_chain (struct output_block *, tree, bool);
void streamer_write_tree_header (struct output_block *, tree);
void streamer_pack_tree_bitfields (struct bitpack_d *, tree);
void streamer_write_tree_body (struct output_block *, tree, bool);
void streamer_write_integer_cst (struct output_block *, tree, bool);
void streamer_write_builtin (struct output_block *, tree);
/* In tree-streamer.c. */
void check_handled_ts_structures (void);
bool lto_streamer_cache_insert (struct lto_streamer_cache_d *, tree,
unsigned *);
bool lto_streamer_cache_insert_at (struct lto_streamer_cache_d *, tree,
unsigned);
void lto_streamer_cache_append (struct lto_streamer_cache_d *, tree);
bool lto_streamer_cache_lookup (struct lto_streamer_cache_d *, tree,
unsigned *);
tree lto_streamer_cache_get (struct lto_streamer_cache_d *, unsigned);
struct lto_streamer_cache_d *lto_streamer_cache_create (void);
void lto_streamer_cache_delete (struct lto_streamer_cache_d *);
void streamer_check_handled_ts_structures (void);
bool streamer_tree_cache_insert (struct streamer_tree_cache_d *, tree,
unsigned *);
bool streamer_tree_cache_insert_at (struct streamer_tree_cache_d *, tree,
unsigned);
void streamer_tree_cache_append (struct streamer_tree_cache_d *, tree);
bool streamer_tree_cache_lookup (struct streamer_tree_cache_d *, tree,
unsigned *);
tree streamer_tree_cache_get (struct streamer_tree_cache_d *, unsigned);
struct streamer_tree_cache_d *streamer_tree_cache_create (void);
void streamer_tree_cache_delete (struct streamer_tree_cache_d *);
#endif /* GCC_TREE_STREAMER_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment