diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-11-13 02:07:57 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-11-13 02:07:57 +0000 |
commit | 681a883fd583ee9ddaff6ebeac1bd59bf75b9b25 (patch) | |
tree | 1dfb694a6a20bcea1203ad2a8b503169f1bb675b | |
parent | 006dfee4126ccdb6b0340948f6a04c3089ae6634 (diff) | |
download | gcc-681a883fd583ee9ddaff6ebeac1bd59bf75b9b25.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73532 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/c-decl.c | 4 | ||||
-rw-r--r-- | gcc/c-pragma.c | 2 | ||||
-rw-r--r-- | gcc/cgraph.c | 80 | ||||
-rw-r--r-- | gcc/cp/decl.c | 2 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/20031112-1.c | 2 | ||||
-rw-r--r-- | gcc/tree.h | 2 | ||||
-rw-r--r-- | gcc/varasm.c | 2 |
10 files changed, 104 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a20beba93d7..c5bfc1f1209 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2003-11-13 Jan Hubicka <jh@suse.cz> + + 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. + 2003-11-12 Kazu Hirata <kazu@cs.umass.edu> * config/h8300/lib1funcs.asm (___mulsi3): Don't save/restore diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 96fb4bb2af8..61fcae0111a 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2870,7 +2870,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree) #endif } SET_DECL_RTL (decl, NULL_RTX); - SET_DECL_ASSEMBLER_NAME (decl, get_identifier (starred)); + change_decl_assembler_name (decl, get_identifier (starred)); } /* If #pragma weak was used, mark the decl weak now. */ @@ -2920,7 +2920,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree) warning ("%Jignoring asm-specifier for non-static local " "variable '%D'", decl, decl); else - SET_DECL_ASSEMBLER_NAME (decl, get_identifier (asmspec)); + change_decl_assembler_name (decl, get_identifier (asmspec)); } if (TREE_CODE (decl) != FUNCTION_DECL) diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c index 141b9061cef..e233a5e35fd 100644 --- a/gcc/c-pragma.c +++ b/gcc/c-pragma.c @@ -382,7 +382,7 @@ handle_pragma_redefine_extname (cpp_reader *dummy ATTRIBUTE_UNUSED) if (DECL_ASSEMBLER_NAME_SET_P (decl) && DECL_ASSEMBLER_NAME (decl) != newname) warning ("#pragma redefine_extname conflicts with declaration"); - SET_DECL_ASSEMBLER_NAME (decl, newname); + change_decl_assembler_name (decl, newname); } else add_to_renaming_pragma_list(oldname, newname); diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 51ea93a0f33..fa6ec7de63b 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) diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 61bea50b353..93368c567e4 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4526,7 +4526,7 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec) /* Set the DECL_ASSEMBLER_NAME for the variable. */ if (asmspec) { - SET_DECL_ASSEMBLER_NAME (decl, get_identifier (asmspec)); + change_decl_assembler_name (decl, get_identifier (asmspec)); /* The `register' keyword, when used together with an asm-specification, indicates that the variable should be placed in a particular register. */ diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 7be1c1402c9..5f1076a9b15 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1000,7 +1000,7 @@ grokfield (tree declarator, tree declspecs, tree init, tree asmspec_tree, /* This must override the asm specifier which was placed by grokclassfn. Lay this out fresh. */ SET_DECL_RTL (value, NULL_RTX); - SET_DECL_ASSEMBLER_NAME (value, get_identifier (asmspec)); + change_decl_assembler_name (value, get_identifier (asmspec)); } if (!DECL_FRIEND_P (value)) grok_special_member_properties (value); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0c8673ae16f..51095cbf7ff 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2003-11-13 Jan Hubicka <jh@suse.cz> + + * gcc.c-torture/compile/20031112-1.c: New test. + 2003-11-12 Mark Mitchell <mark@codesourcery.com> * g++.dg/parse/crash10.C: Remove bogus error marker. diff --git a/gcc/testsuite/gcc.c-torture/compile/20031112-1.c b/gcc/testsuite/gcc.c-torture/compile/20031112-1.c new file mode 100644 index 00000000000..466b29edf69 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20031112-1.c @@ -0,0 +1,2 @@ +extern __inline int __finite (double __value) { return 0; } +extern __typeof (__finite) __finite __asm__ ("" "__GI___finite"); diff --git a/gcc/tree.h b/gcc/tree.h index 03b85dfc501..f94214ee57d 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2712,7 +2712,7 @@ extern tree get_file_function_name_long (const char *); extern tree get_set_constructor_bits (tree, char *, int); extern tree get_set_constructor_bytes (tree, unsigned char *, int); extern tree get_callee_fndecl (tree); -extern void set_decl_assembler_name (tree); +extern void change_decl_assembler_name (tree, tree); extern int type_num_arguments (tree); extern tree lhd_unsave_expr_now (tree); diff --git a/gcc/varasm.c b/gcc/varasm.c index 9ee145db387..7f5ee565f51 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -791,7 +791,7 @@ make_decl_rtl (tree decl, const char *asmspec) char *starred = alloca (strlen (asmspec) + 2); starred[0] = '*'; strcpy (starred + 1, asmspec); - SET_DECL_ASSEMBLER_NAME (decl, get_identifier (starred)); + change_decl_assembler_name (decl, get_identifier (starred)); } name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); |