From: Richard Guenther Date: Mon, 9 May 2011 16:00:48 +0000 (+0000) Subject: lto-symtab.c (lto_cgraph_replace_node): Use types_compatible_p for diagnostics. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0ca8de87c419963448108ba0fde0d818bd18df79;p=gcc.git lto-symtab.c (lto_cgraph_replace_node): Use types_compatible_p for diagnostics. 2011-05-09 Richard Guenther * lto-symtab.c (lto_cgraph_replace_node): Use types_compatible_p for diagnostics. (lto_symtab_merge): Likewise. Do not register types here. (lto_symtab_merge_decls_2): Likewise. (lto_symtab_merge_decls_1): Likewise. * gimple.h (enum gtc_mode, gimple_types_compatible_p): Do not declare. * gimple.c (enum gtc_mode): Declare. (gimple_types_compatible_p): Make static. From-SVN: r173575 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eac0d65377f..1f63e237cee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2011-05-09 Richard Guenther + + * lto-symtab.c (lto_cgraph_replace_node): Use types_compatible_p + for diagnostics. + (lto_symtab_merge): Likewise. Do not register types here. + (lto_symtab_merge_decls_2): Likewise. + (lto_symtab_merge_decls_1): Likewise. + * gimple.h (enum gtc_mode, gimple_types_compatible_p): Do not declare. + * gimple.c (enum gtc_mode): Declare. + (gimple_types_compatible_p): Make static. + 2011-05-09 Andreas Krebbel * config/s390/s390.md (TD/TF mem to reg move splitter): Make the diff --git a/gcc/gimple.c b/gcc/gimple.c index 385c098f455..af866171b4f 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -3208,6 +3208,8 @@ gimple_call_copy_skip_args (gimple stmt, bitmap args_to_skip) } +enum gtc_mode { GTC_MERGE = 0, GTC_DIAG = 1 }; + static hashval_t gimple_type_hash_1 (const void *, enum gtc_mode); /* Structure used to maintain a cache of some type pairs compared by @@ -3908,7 +3910,7 @@ pop: FOR_MERGING_P is true the an incomplete type and a complete type are considered different, otherwise they are considered compatible. */ -bool +static bool gimple_types_compatible_p (tree t1, tree t2, enum gtc_mode mode) { VEC(type_pair_t, heap) *sccstack = NULL; diff --git a/gcc/gimple.h b/gcc/gimple.h index a5374a9620c..06488881239 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -965,8 +965,6 @@ extern void recalculate_side_effects (tree); extern bool gimple_compare_field_offset (tree, tree); extern tree gimple_register_type (tree); extern tree gimple_register_canonical_type (tree); -enum gtc_mode { GTC_MERGE = 0, GTC_DIAG = 1 }; -extern bool gimple_types_compatible_p (tree, tree, enum gtc_mode); extern void print_gimple_types_stats (void); extern void free_gimple_type_tables (void); extern tree gimple_unsigned_type (tree); diff --git a/gcc/lto-symtab.c b/gcc/lto-symtab.c index 28a3d8b7bb8..8dc10e8e6c5 100644 --- a/gcc/lto-symtab.c +++ b/gcc/lto-symtab.c @@ -243,8 +243,8 @@ lto_cgraph_replace_node (struct cgraph_node *node, /* Redirect all incoming edges. */ compatible_p - = gimple_types_compatible_p (TREE_TYPE (TREE_TYPE (prevailing_node->decl)), - TREE_TYPE (TREE_TYPE (node->decl)), GTC_DIAG); + = types_compatible_p (TREE_TYPE (TREE_TYPE (prevailing_node->decl)), + TREE_TYPE (TREE_TYPE (node->decl))); for (e = node->callers; e; e = next) { next = e->next_caller; @@ -360,8 +360,8 @@ lto_symtab_merge (lto_symtab_entry_t prevailing, lto_symtab_entry_t entry) if (TREE_CODE (decl) == FUNCTION_DECL) { - if (!gimple_types_compatible_p (TREE_TYPE (prevailing_decl), - TREE_TYPE (decl), GTC_DIAG)) + if (!types_compatible_p (TREE_TYPE (prevailing_decl), + TREE_TYPE (decl))) /* If we don't have a merged type yet...sigh. The linker wouldn't complain if the types were mismatched, so we probably shouldn't either. Just use the type from @@ -390,11 +390,7 @@ lto_symtab_merge (lto_symtab_entry_t prevailing, lto_symtab_entry_t entry) prevailing_type = TYPE_MAIN_VARIANT (TREE_TYPE (prevailing_decl)); type = TYPE_MAIN_VARIANT (TREE_TYPE (decl)); - /* We have to register and fetch canonical types here as the global - fixup process didn't yet run. */ - prevailing_type = gimple_register_type (prevailing_type); - type = gimple_register_type (type); - if (!gimple_types_compatible_p (prevailing_type, type, GTC_DIAG)) + if (!types_compatible_p (prevailing_type, type)) { if (COMPLETE_TYPE_P (type)) return false; @@ -419,9 +415,7 @@ lto_symtab_merge (lto_symtab_entry_t prevailing, lto_symtab_entry_t entry) if (TREE_CODE (tem1) != TREE_CODE (tem2)) return false; - if (!gimple_types_compatible_p (gimple_register_type (tem1), - gimple_register_type (tem2), - GTC_DIAG)) + if (!types_compatible_p (tem1, tem2)) return false; } @@ -620,8 +614,7 @@ lto_symtab_merge_decls_2 (void **slot, bool diagnosed_p) /* Diagnose all mismatched re-declarations. */ FOR_EACH_VEC_ELT (tree, mismatches, i, decl) { - if (!gimple_types_compatible_p (TREE_TYPE (prevailing->decl), - TREE_TYPE (decl), GTC_DIAG)) + if (!types_compatible_p (TREE_TYPE (prevailing->decl), TREE_TYPE (decl))) diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl), 0, "type of %qD does not match original " "declaration", decl); @@ -744,10 +737,6 @@ lto_symtab_merge_decls_1 (void **slot, void *data ATTRIBUTE_UNUSED) inform (DECL_SOURCE_LOCATION (prevailing->decl), "previously declared here"); - /* Register and adjust types of the entries. */ - for (e = (lto_symtab_entry_t) *slot; e; e = e->next) - TREE_TYPE (e->decl) = gimple_register_type (TREE_TYPE (e->decl)); - /* Merge the chain to the single prevailing decl and diagnose mismatches. */ lto_symtab_merge_decls_2 (slot, diagnosed_p);