diff options
author | Michael Matz <matz@suse.de> | 2011-04-03 11:21:06 +0000 |
---|---|---|
committer | Michael Matz <matz@gcc.gnu.org> | 2011-04-03 11:21:06 +0000 |
commit | e89964e31c5f26caefe5fffb0ccc1fb4932f44bc (patch) | |
tree | 1e63a8bdd37fbff2c65aec3206ef1005c2481cd1 /gcc/lto-streamer-in.c | |
parent | b9a5b5b2a2771889f315d778629dc7e6245a69cf (diff) | |
download | gcc-e89964e31c5f26caefe5fffb0ccc1fb4932f44bc.zip gcc-e89964e31c5f26caefe5fffb0ccc1fb4932f44bc.tar.gz gcc-e89964e31c5f26caefe5fffb0ccc1fb4932f44bc.tar.bz2 |
lto-streamer.h (struct lto_streamer_cache_d): Remove offsets and next_slot members.
* lto-streamer.h (struct lto_streamer_cache_d): Remove offsets
and next_slot members.
(lto_streamer_cache_insert, lto_streamer_cache_insert_at,
lto_streamer_cache_lookup, lto_streamer_cache_get): Adjust prototypes.
(lto_streamer_cache_append): Declare.
* lto-streamer.c (lto_streamer_cache_add_to_node_array): Use
unsigned index, remove offset parameter, ensure that we append
or update existing entries.
(lto_streamer_cache_insert_1): Use unsigned index, remove offset_p
parameter, update next_slot for append.
(lto_streamer_cache_insert): Use unsigned index, remove offset_p
parameter.
(lto_streamer_cache_insert_at): Likewise.
(lto_streamer_cache_append): New function.
(lto_streamer_cache_lookup): Use unsigned index.
(lto_streamer_cache_get): Likewise.
(lto_record_common_node): Don't test tree_node_can_be_shared.
(preload_common_node): Adjust call to lto_streamer_cache_insert.
(lto_streamer_cache_delete): Don't free offsets member.
* lto-streamer-out.c (eq_string_slot_node): Use memcmp.
(lto_output_string_with_length): Use lto_output_data_stream.
(lto_output_tree_header): Remove ix parameter, don't write it.
(lto_output_builtin_tree): Likewise.
(lto_write_tree): Adjust callers to above, don't track and write
offset, write unsigned index.
(output_unreferenced_globals): Don't emit all global vars.
(write_global_references): Use unsigned indices.
(lto_output_decl_state_refs): Likewise.
(write_symbol): Likewise.
* lto-streamer-in.c (lto_input_chain): Move earlier.
(input_function): Use unsigned index.
(input_alias_pairs): Don't read and then ignore all global vars.
(lto_materialize_tree): Remove ix_p parameter, don't read index,
don't pass it back, use lto_streamer_cache_append.
(lto_register_var_decl_in_symtab): Use unsigned index.
(lto_register_function_decl_in_symtab): Likewise.
(lto_get_pickled_tree): Don't read in or handle offset, read unsigned
index.
(lto_get_builtin_tree): Don't read index, use
lto_streamer_cache_append.
(lto_read_tree): Adjust call to lto_materialize_tree.
* ipa-inline.c (cgraph_edge_badness): Move growth calculaton,
don't use function calls in arguments to MIN.
* varasm.c (decl_binds_to_current_def_p): Don't check TREE_PUBLIC
twice.
* gimple.c (gimple_type_leader_entry): Mark deletable.
lto/
* lto.c (lto_materialize_function): Don't read and then discard
sections in WPA mode.
(lto_read_in_decl_state): Adjust call to lto_streamer_cache_get.
* lto-lang.c (registered_builtin_fndecls): Remove.
(lto_getdecls): Return NULL_TREE.
(lto_builtin_function): Don't remember in registered_builtin_fndecls.
From-SVN: r171906
Diffstat (limited to 'gcc/lto-streamer-in.c')
-rw-r--r-- | gcc/lto-streamer-in.c | 112 |
1 files changed, 37 insertions, 75 deletions
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 70f0b0a..fc5bc63 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -387,6 +387,33 @@ lto_input_tree_ref (struct lto_input_block *ib, struct data_in *data_in, } +/* Read a chain of tree nodes from input block IB. DATA_IN contains + tables and descriptors for the file being read. */ + +static tree +lto_input_chain (struct lto_input_block *ib, struct data_in *data_in) +{ + int i, count; + tree first, prev, curr; + + first = prev = NULL_TREE; + count = lto_input_sleb128 (ib); + for (i = 0; i < count; i++) + { + curr = lto_input_tree (ib, data_in); + if (prev) + TREE_CHAIN (prev) = curr; + else + first = curr; + + TREE_CHAIN (curr) = NULL_TREE; + prev = curr; + } + + return first; +} + + /* Read and return a double-linked list of catch handlers from input block IB, using descriptors in DATA_IN. */ @@ -1255,7 +1282,7 @@ input_function (tree fn_decl, struct data_in *data_in, oarg && narg; oarg = TREE_CHAIN (oarg), narg = TREE_CHAIN (narg)) { - int ix; + unsigned ix; bool res; res = lto_streamer_cache_lookup (data_in->reader_cache, oarg, &ix); gcc_assert (res); @@ -1352,11 +1379,6 @@ input_alias_pairs (struct lto_input_block *ib, struct data_in *data_in) clear_line_info (data_in); - /* Skip over all the unreferenced globals. */ - do - var = lto_input_tree (ib, data_in); - while (var); - var = lto_input_tree (ib, data_in); while (var) { @@ -1828,7 +1850,7 @@ unpack_value_fields (struct bitpack_d *bp, tree expr) static tree lto_materialize_tree (struct lto_input_block *ib, struct data_in *data_in, - enum LTO_tags tag, int *ix_p) + enum LTO_tags tag) { struct bitpack_d bp; enum tree_code code; @@ -1836,15 +1858,9 @@ lto_materialize_tree (struct lto_input_block *ib, struct data_in *data_in, #ifdef LTO_STREAMER_DEBUG HOST_WIDEST_INT orig_address_in_writer; #endif - HOST_WIDE_INT ix; result = NULL_TREE; - /* Read the header of the node we are about to create. */ - ix = lto_input_sleb128 (ib); - gcc_assert ((int) ix == ix); - *ix_p = (int) ix; - #ifdef LTO_STREAMER_DEBUG /* Read the word representing the memory address for the tree as it was written by the writer. This is useful when @@ -1876,8 +1892,7 @@ lto_materialize_tree (struct lto_input_block *ib, struct data_in *data_in, } else { - /* All other nodes can be materialized with a raw make_node - call. */ + /* All other nodes can be materialized with a raw make_node call. */ result = make_node (code); } @@ -1904,39 +1919,12 @@ lto_materialize_tree (struct lto_input_block *ib, struct data_in *data_in, /* Enter RESULT in the reader cache. This will make RESULT available so that circular references in the rest of the tree structure can be resolved in subsequent calls to lto_input_tree. */ - lto_streamer_cache_insert_at (data_in->reader_cache, result, ix); + lto_streamer_cache_append (data_in->reader_cache, result); return result; } -/* Read a chain of tree nodes from input block IB. DATA_IN contains - tables and descriptors for the file being read. */ - -static tree -lto_input_chain (struct lto_input_block *ib, struct data_in *data_in) -{ - int i, count; - tree first, prev, curr; - - first = prev = NULL_TREE; - count = lto_input_sleb128 (ib); - for (i = 0; i < count; i++) - { - curr = lto_input_tree (ib, data_in); - if (prev) - TREE_CHAIN (prev) = curr; - else - first = curr; - - TREE_CHAIN (curr) = NULL_TREE; - prev = curr; - } - - return first; -} - - /* Read all pointer fields in the TS_COMMON structure of EXPR from input block IB. DATA_IN contains tables and descriptors for the file being read. */ @@ -2463,7 +2451,7 @@ lto_register_var_decl_in_symtab (struct data_in *data_in, tree decl) declaration for merging. */ if (TREE_PUBLIC (decl)) { - int ix; + unsigned ix; if (!lto_streamer_cache_lookup (data_in->reader_cache, decl, &ix)) gcc_unreachable (); lto_symtab_register_decl (decl, get_resolution (data_in, ix), @@ -2530,7 +2518,7 @@ lto_register_function_decl_in_symtab (struct data_in *data_in, tree decl) declaration for merging. */ if (TREE_PUBLIC (decl) && !DECL_ABSTRACT (decl)) { - int ix; + unsigned ix; if (!lto_streamer_cache_lookup (data_in->reader_cache, decl, &ix)) gcc_unreachable (); lto_symtab_register_decl (decl, get_resolution (data_in, ix), @@ -2545,35 +2533,14 @@ lto_register_function_decl_in_symtab (struct data_in *data_in, tree decl) static tree lto_get_pickled_tree (struct lto_input_block *ib, struct data_in *data_in) { - HOST_WIDE_INT ix; + unsigned HOST_WIDE_INT ix; tree result; enum LTO_tags expected_tag; - unsigned HOST_WIDE_INT orig_offset; - ix = lto_input_sleb128 (ib); + ix = lto_input_uleb128 (ib); expected_tag = (enum LTO_tags) lto_input_uleb128 (ib); - orig_offset = lto_input_uleb128 (ib); - gcc_assert (orig_offset == (unsigned) orig_offset); - result = lto_streamer_cache_get (data_in->reader_cache, ix); - if (result == NULL_TREE) - { - /* We have not yet read the cache slot IX. Go to the offset - in the stream where the physical tree node is, and materialize - it from there. */ - struct lto_input_block fwd_ib; - - /* If we are trying to go back in the stream, something is wrong. - We should've read the node at the earlier position already. */ - if (ib->p >= orig_offset) - internal_error ("bytecode stream: tried to jump backwards in the " - "stream"); - - LTO_INIT_INPUT_BLOCK (fwd_ib, ib->data, orig_offset, ib->len); - result = lto_input_tree (&fwd_ib, data_in); - } - gcc_assert (result && TREE_CODE (result) == lto_tag_to_tree_code (expected_tag)); @@ -2591,16 +2558,12 @@ lto_get_builtin_tree (struct lto_input_block *ib, struct data_in *data_in) enum built_in_function fcode; const char *asmname; tree result; - int ix; fclass = (enum built_in_class) lto_input_uleb128 (ib); gcc_assert (fclass == BUILT_IN_NORMAL || fclass == BUILT_IN_MD); fcode = (enum built_in_function) lto_input_uleb128 (ib); - ix = lto_input_sleb128 (ib); - gcc_assert (ix == (int) ix); - if (fclass == BUILT_IN_NORMAL) { gcc_assert (fcode < END_BUILTINS); @@ -2620,7 +2583,7 @@ lto_get_builtin_tree (struct lto_input_block *ib, struct data_in *data_in) if (asmname) set_builtin_user_assembler_name (result, asmname); - lto_streamer_cache_insert_at (data_in->reader_cache, result, ix); + lto_streamer_cache_append (data_in->reader_cache, result); return result; } @@ -2634,9 +2597,8 @@ lto_read_tree (struct lto_input_block *ib, struct data_in *data_in, enum LTO_tags tag) { tree result; - int ix; - result = lto_materialize_tree (ib, data_in, tag, &ix); + result = lto_materialize_tree (ib, data_in, tag); /* Read all the pointer fields in RESULT. */ lto_input_tree_pointers (ib, data_in, result); |