aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2011-06-01 08:52:33 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2011-06-01 08:52:33 +0000
commit6807da97b7a1d22a82a48844ccacfbdfcb983ada (patch)
tree076077eb59e88f362654a8c0a17e201cef22c8d7 /gcc/lto
parent3dca2ab7a79ef2e96d06b61f7f5189b46910691b (diff)
downloadgcc-6807da97b7a1d22a82a48844ccacfbdfcb983ada.zip
gcc-6807da97b7a1d22a82a48844ccacfbdfcb983ada.tar.gz
gcc-6807da97b7a1d22a82a48844ccacfbdfcb983ada.tar.bz2
tree.c (free_lang_data): Do not reset boolean_type_node nor char_type_node.
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. From-SVN: r174519
Diffstat (limited to 'gcc/lto')
-rw-r--r--gcc/lto/ChangeLog6
-rw-r--r--gcc/lto/lto-lang.c55
2 files changed, 40 insertions, 21 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 9412f76..b96371e 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 5fe89b8..296a719 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;