summaryrefslogtreecommitdiff
path: root/gcc/lto-streamer.c
diff options
context:
space:
mode:
authordnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-11 12:02:34 +0000
committerdnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-11 12:02:34 +0000
commit515cf651fab16237fd7e4432dd090af8dee7c4cd (patch)
treec67c6c54079ea71a807b5373467385939adc98f6 /gcc/lto-streamer.c
parente664a33430e3762854e0a2d6db1e5155aa86233f (diff)
downloadgcc-515cf651fab16237fd7e4432dd090af8dee7c4cd.tar.gz
* tree-streamer-out.c (lto_output_ts_decl_with_vis_tree_pointers):
Call stream_write_tree instead of output_record_start. (lto_output_ts_binfo_tree_pointers): Likewise. * streamer-hooks.h (stream_write_tree): Move from tree-streamer.h. Convert it to a macro. (stream_read_tree): Likewise. * lto-streamer.h (lto_stream_as_builtin_p): Move ... * tree-streamer.h (lto_stream_as_builtin_p): ... here. * lto-streamer-in.c (lto_read_tree): Call lto_streamer_cache_append and tree_read_bitfields. * lto-streamer-out.c (lto_is_streamable): Move from lto-streamer.c (lto_write_tree): Call it. * lto-streamer.c (lto_is_streamable): Move to lto-streamer-out.c * streamer-hooks.h (struct streamer_hooks): Remove fields name, is_streamable and alloc_tree. Update all users. * tree-streamer-in.c (tree_read_bitfields): Factor out of ... (lto_materialize_tree): ... here. Handle CALL_EXPR codes. Remove call to lto_streamer_cache_append. * tree-streamer-out.c (lto_output_tree_header): Handle CALL_EXPR nodes. * tree-streamer.h (tree_read_bitfields): Declare. * Makefile.in (TREE_STREAMER_H): Add STREAMER_HOOKS_H. (gimple-streamer-in.o): Add dependency on TREE_STREAMER_H. * tree-streamer.h (stream_read_tree): New. Replace all calls to lto_input_tree with it. (stream_write_tree): New. Replace all calls to lto_output_tree, lto_output_tree_ref and lto_output_tree_or_ref with it. * lto-streamer-in.c (lto_read_tree): Inline code from lto_streamer_read_tree. (lto_input_tree): Move from tree-streamer-in.c. * lto-streamer-out.c (lto_output_tree_ref): Make static. Remove handling of NULL values for EXPR. Do not handle EXPRs that are not indexable. (lto_write_tree): Move from tree-streamer-out.c. Inline lto_streamer_write_tree. (lto_output_tree): Move from tree-streamer-out.c. If REF_P is true and EXPR is indexable, call lto_output_tree_ref. * lto-streamer.c (lto_record_common_node): Move to tree-streamer.c. (lto_preload_common_nodes): Likewise. Remove assertions and adjustments for nodes main_identifier_node, ptrdiff_type_node and fileptr_type_node. (lto_streamer_hooks_init): Set streamer_hooks.write_tree to lto_output_tree and streamer_hooks.read_tree to lto_input_tree. * lto-streamer.h (lto_input_tree): Declare. (lto_output_tree_ref): Remove. * streamer-hooks.h (struct streamer_hooks): Remove fields preload_common_nodes, indexable_with_decls_p, pack_value_fields, unpack_value_fields, output_tree_header and has_unique_integer_csts_p. Update all users. * tree-streamer-in.c (lto_materialize_tree): Make extern. (lto_input_tree_pointers): Likewise. (lto_read_tree): Move to lto-streamer-in.c. (lto_input_integer_cst): Make extern. (lto_get_pickled_tree): Likewise. (lto_get_builtin_tree): Likewise. (lto_input_tree): Move to lto-streamer-in.c. * tree-streamer-out.c (pack_value_fields): Make extern. (lto_output_tree_or_ref): Remove. Replace all callers with calls to stream_write_tree. (lto_output_builtin_tree): Make extern. (lto_streamer_write_tree): Inline into lto_write_tree. (lto_output_tree_pointers): Make extern. (lto_output_tree_header): Likewise. (lto_output_integer_cst): Likewise. (lto_write_tree): Move to lto-streamer-out.c. (lto_output_tree): Likewise. * tree-streamer.c (lto_record_common_node): Move from lto-streamer.c (preload_common_nodes): Likewise. (lto_streamer_cache_create): Call it. * tree-streamer.h: Include streamer-hooks.h. (stream_write_tree): New. (stream_read_tree): New. (lto_input_tree): Remove. (lto_materialize_tree): Declare. (lto_input_tree_pointers): Declare. (lto_get_pickled_tree): Declare. (lto_get_builtin_tree): Declare. (lto_input_integer_cst): Declare. (lto_output_tree_header): Declare. (pack_value_fields): Declare. (lto_output_tree_pointers): Declare. (lto_output_integer_cst): Declare. (lto_output_builtin_tree): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177661 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-streamer.c')
-rw-r--r--gcc/lto-streamer.c113
1 files changed, 2 insertions, 111 deletions
diff --git a/gcc/lto-streamer.c b/gcc/lto-streamer.c
index 328e6540047..01a681fbd18 100644
--- a/gcc/lto-streamer.c
+++ b/gcc/lto-streamer.c
@@ -257,86 +257,6 @@ print_lto_report (void)
}
-/* Record NODE in CACHE. */
-
-static void
-lto_record_common_node (struct lto_streamer_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.
- As our hash table can't deal with zero entries we'll simply stream
- a random other tree. A NULL tree never will be looked up so it
- doesn't matter which tree we replace it with, just to be sure
- use error_mark_node. */
- if (!node)
- node = error_mark_node;
-
- lto_streamer_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));
- else if (TREE_CODE (node) == RECORD_TYPE)
- {
- /* The FIELD_DECLs of structures should be shared, so that every
- COMPONENT_REF uses the same tree node when referencing a field.
- Pointer equality between FIELD_DECLs is used by the alias
- machinery to compute overlapping memory references (See
- nonoverlapping_component_refs_p). */
- tree f;
- for (f = TYPE_FIELDS (node); f; f = TREE_CHAIN (f))
- lto_record_common_node (cache, f);
- }
-}
-
-/* Preload common nodes into CACHE and make sure they are merged
- properly according to the gimple type table. */
-
-static void
-lto_preload_common_nodes (struct lto_streamer_cache_d *cache)
-{
- unsigned i;
-
- /* The MAIN_IDENTIFIER_NODE is normally set up by the front-end, but the
- LTO back-end must agree. Currently, the only languages that set this
- use the name "main". */
- if (main_identifier_node)
- {
- const char *main_name = IDENTIFIER_POINTER (main_identifier_node);
- gcc_assert (strcmp (main_name, "main") == 0);
- }
- else
- main_identifier_node = get_identifier ("main");
-
- gcc_assert (ptrdiff_type_node == integer_type_node);
-
- /* FIXME lto. In the C++ front-end, fileptr_type_node is defined as a
- variant copy of of ptr_type_node, rather than ptr_node itself. The
- distinction should only be relevant to the front-end, so we always
- use the C definition here in lto1.
-
- These should be assured in pass_ipa_free_lang_data. */
- gcc_assert (fileptr_type_node == ptr_type_node);
- gcc_assert (TYPE_MAIN_VARIANT (fileptr_type_node) == ptr_type_node);
-
- 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]);
-
- for (i = 0; i < TYPE_KIND_LAST; i++)
- lto_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]);
-}
-
-
#ifdef LTO_STREAMER_DEBUG
static htab_t tree_htab;
@@ -464,41 +384,12 @@ lto_check_version (int major, int minor)
}
-/* Return true if EXPR is a tree node that can be written to disk. */
-static inline bool
-lto_is_streamable (tree expr)
-{
- enum tree_code code = TREE_CODE (expr);
-
- /* Notice that we reject SSA_NAMEs as well. We only emit the SSA
- name version in lto_output_tree_ref (see output_ssa_names). */
- return !is_lang_specific (expr)
- && code != SSA_NAME
- && code != CALL_EXPR
- && code != LANG_TYPE
- && code != MODIFY_EXPR
- && code != INIT_EXPR
- && code != TARGET_EXPR
- && code != BIND_EXPR
- && code != WITH_CLEANUP_EXPR
- && code != STATEMENT_LIST
- && code != OMP_CLAUSE
- && code != OPTIMIZATION_NODE
- && (code == CASE_LABEL_EXPR
- || code == DECL_EXPR
- || TREE_CODE_CLASS (code) != tcc_statement);
-}
-
-
/* Initialize all the streamer hooks used for streaming GIMPLE. */
void
lto_streamer_hooks_init (void)
{
streamer_hooks_init ();
- streamer_hooks.name = "gimple";
- streamer_hooks.preload_common_nodes = lto_preload_common_nodes;
- streamer_hooks.is_streamable = lto_is_streamable;
- streamer_hooks.write_tree = lto_streamer_write_tree;
- streamer_hooks.read_tree = lto_streamer_read_tree;
+ streamer_hooks.write_tree = lto_output_tree;
+ streamer_hooks.read_tree = lto_input_tree;
}