diff options
author | Jan Hubicka <jh@suse.cz> | 2003-11-13 03:07:57 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2003-11-13 02:07:57 +0000 |
commit | fccc4eb2409acbe8eb9150a6bfe97dd7fe441c7f (patch) | |
tree | 1dfb694a6a20bcea1203ad2a8b503169f1bb675b /gcc/cgraph.c | |
parent | 1b2b8ee7a9e27b78b76687b6b94f956765039c1a (diff) | |
download | gcc-fccc4eb2409acbe8eb9150a6bfe97dd7fe441c7f.zip gcc-fccc4eb2409acbe8eb9150a6bfe97dd7fe441c7f.tar.gz gcc-fccc4eb2409acbe8eb9150a6bfe97dd7fe441c7f.tar.bz2 |
re PR rtl-optimization/12275 ([unit-at-a-time] ICE in htab_clear_slot)
PR opt/12275
* c-decl.c (finish_decl): Use change_decl_assembler_name.
* c-pragma.c (handle_pragma_redefine_extname): Likewise.
* varasm.c (make_decl_rtl): Likewise.
* cgraph.c (change_decl_assembler_name): New function.
* tree.h (set_decl_assembler_name): Kill dead declaration.
(change_decl_assembler_name): Declare.
* decl.c (make_rtl_for_nonlocal_decl): Use change_decl_assembler_name.
* decl2.c (make_rtl_for_nonlocal_decl): Use change_decl_assembler_name.
From-SVN: r73532
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 80 |
1 files changed, 78 insertions, 2 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 51ea93a..fa6ec7d 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -428,8 +428,6 @@ cgraph_varpool_node (tree decl) if (!cgraph_varpool_hash) cgraph_varpool_hash = htab_create_ggc (10, cgraph_varpool_hash_node, eq_cgraph_varpool_node, NULL); - - slot = (struct cgraph_varpool_node **) htab_find_slot_with_hash (cgraph_varpool_hash, DECL_ASSEMBLER_NAME (decl), IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME (decl)), @@ -444,6 +442,84 @@ cgraph_varpool_node (tree decl) return node; } +/* Set the DECL_ASSEMBLER_NAME and update cgraph hashtables. */ +void +change_decl_assembler_name (tree decl, tree name) +{ + struct cgraph_node *node = NULL; + struct cgraph_varpool_node *vnode = NULL; + void **slot; + + if (!DECL_ASSEMBLER_NAME_SET_P (decl)) + { + SET_DECL_ASSEMBLER_NAME (decl, name); + return; + } + if (name == DECL_ASSEMBLER_NAME (decl)) + return; + + if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))) + warning ("%D renamed after being referenced in assembly", decl); + + if (TREE_CODE (decl) == FUNCTION_DECL && cgraph_hash) + { + /* Take a look whether declaration is in the cgraph structure. */ + slot = + htab_find_slot_with_hash (cgraph_hash, DECL_ASSEMBLER_NAME (decl), + IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME + (decl)), NO_INSERT); + if (slot) + node = *slot; + + /* It is, verify that we are the canonical node for this decl. */ + if (node && node->decl == decl) + { + node = *slot; + htab_clear_slot (cgraph_hash, slot); + } + else + node = NULL; + } + if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl) && cgraph_varpool_hash) + { + /* Take a look whether declaration is in the cgraph structure. */ + slot = + htab_find_slot_with_hash (cgraph_varpool_hash, DECL_ASSEMBLER_NAME (decl), + IDENTIFIER_HASH_VALUE (DECL_ASSEMBLER_NAME + (decl)), NO_INSERT); + if (slot) + vnode = *slot; + + /* It is, verify that we are the canonical vnode for this decl. */ + if (vnode && vnode->decl == decl) + { + vnode = *slot; + htab_clear_slot (cgraph_varpool_hash, slot); + } + else + vnode = NULL; + } + SET_DECL_ASSEMBLER_NAME (decl, name); + if (node) + { + slot = + htab_find_slot_with_hash (cgraph_hash, name, + IDENTIFIER_HASH_VALUE (name), INSERT); + if (*slot) + abort (); + *slot = node; + } + if (vnode) + { + slot = + htab_find_slot_with_hash (cgraph_varpool_hash, name, + IDENTIFIER_HASH_VALUE (name), INSERT); + if (*slot) + abort (); + *slot = vnode; + } +} + /* Try to find existing function for identifier ID. */ struct cgraph_varpool_node * cgraph_varpool_node_for_identifier (tree id) |