diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-06-01 08:52:33 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-06-01 08:52:33 +0000 |
commit | ed61b9099c0eda00fc19eaf1b3da3bd008a4c158 (patch) | |
tree | 076077eb59e88f362654a8c0a17e201cef22c8d7 /gcc/lto | |
parent | ff3c83b573655db50a75d59696ab4a8e7d3819ec (diff) | |
download | gcc-ed61b9099c0eda00fc19eaf1b3da3bd008a4c158.tar.gz |
2011-06-01 Richard Guenther <rguenther@suse.de>
* tree.c (free_lang_data): Do not reset boolean_type_node nor
char_type_node.
* lto-streamer.c (lto_record_common_node): Take node pointer,
do not register types.
(lto_preload_common_nodes): Explicitly skip preloading nodes
that differ between frontends.
lto/
* lto-lang.c (lto_register_canonical_types): New function.
(lto_init): Register common nodes with the canonical type machinery.
Do not play tricks with char_type_node.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174519 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto')
-rw-r--r-- | gcc/lto/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/lto/lto-lang.c | 55 |
2 files changed, 40 insertions, 21 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 9412f76ae1d..b96371e7ed2 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,9 @@ +2011-06-01 Richard Guenther <rguenther@suse.de> + + * lto-lang.c (lto_register_canonical_types): New function. + (lto_init): Register common nodes with the canonical type machinery. + Do not play tricks with char_type_node. + 2011-05-26 Richard Guenther <rguenther@suse.de> * lto.c (uniquify_nodes): Fix bug in one of the previous changes. diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c index 5fe89b87d1e..296a71976d1 100644 --- a/gcc/lto/lto-lang.c +++ b/gcc/lto/lto-lang.c @@ -1052,12 +1052,31 @@ lto_build_c_type_nodes (void) pid_type_node = integer_type_node; } +/* Re-compute TYPE_CANONICAL for NODE and related types. */ + +static void +lto_register_canonical_types (tree node) +{ + if (!node + || !TYPE_P (node)) + return; + + TYPE_CANONICAL (node) = NULL_TREE; + TYPE_CANONICAL (node) = gimple_register_canonical_type (node); + + if (POINTER_TYPE_P (node) + || TREE_CODE (node) == COMPLEX_TYPE + || TREE_CODE (node) == ARRAY_TYPE) + lto_register_canonical_types (TREE_TYPE (node)); +} /* Perform LTO-specific initialization. */ static bool lto_init (void) { + unsigned i; + /* We need to generate LTO if running in WPA mode. */ flag_generate_lto = flag_wpa; @@ -1068,33 +1087,16 @@ lto_init (void) /* Create the basic integer types. */ build_common_tree_nodes (flag_signed_char); - /* Share char_type_node with whatever would be the default for the target. - char_type_node will be used for internal types such as - va_list_type_node but will not be present in the lto stream. */ - /* ??? This breaks the more common case of consistent but non-standard - setting of flag_signed_char, so share according to flag_signed_char. - See PR42528. */ - char_type_node - = flag_signed_char ? signed_char_type_node : unsigned_char_type_node; - /* Tell the middle end what type to use for the size of objects. */ if (strcmp (SIZE_TYPE, "unsigned int") == 0) - { - set_sizetype (unsigned_type_node); - size_type_node = unsigned_type_node; - } + size_type_node = unsigned_type_node; else if (strcmp (SIZE_TYPE, "long unsigned int") == 0) - { - set_sizetype (long_unsigned_type_node); - size_type_node = long_unsigned_type_node; - } + size_type_node = long_unsigned_type_node; else if (strcmp (SIZE_TYPE, "long long unsigned int") == 0) - { - set_sizetype (long_long_unsigned_type_node); - size_type_node = long_long_unsigned_type_node; - } + size_type_node = long_long_unsigned_type_node; else gcc_unreachable (); + set_sizetype (size_type_node); /* The global tree for the main identifier is filled in by language-specific front-end initialization that is not run in the @@ -1158,6 +1160,17 @@ lto_init (void) NAME_TYPE (boolean_type_node, "bool"); #undef NAME_TYPE + /* Register the common node types with the canonical type machinery so + we properly share alias-sets across languages and TUs. Do not + expose the common nodes as type merge target - those that should be + are already exposed so by pre-loading the LTO streamer caches. */ + for (i = 0; i < itk_none; ++i) + lto_register_canonical_types (integer_types[i]); + /* The sizetypes are not used to access data so we do not need to + do anything about them. */ + for (i = 0; i < TI_MAX; ++i) + lto_register_canonical_types (global_trees[i]); + /* Initialize LTO-specific data structures. */ lto_global_var_decls = VEC_alloc (tree, gc, 256); in_lto_p = true; |