This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Remove some useless uses of mark_decl_referenced
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 12 May 2010 23:54:51 +0200
- Subject: Remove some useless uses of mark_decl_referenced
Hi,
mark_decl_referenced is used at several places in compiler to avoid undefined symbol
type error. The function makes variable/function used in very strict way (as sticking
__attribute__ ((used)) to it) and this is not something very desirable.
I would like to remove most of the uses of this function from compiler, since
most of them come from time when compiler was not fully converted to
cgraph/varpool infrastructure yet.
This is first step, call in output_addr_const should be useless ever since we
got rid of C++ FE thunks and cgraphunit is using it twice ineffectivly when node
to mark needed is readilly available.
Bootstrapped/regtested x86_64-linux, will commit it shortly.
Honza
* final.c (output_addr_const): Do not call mark_decl_referenced.
* cgraphunit.c (process_function_and_variable_attributes): Use
cgraph_mark_needed_node.
(process_function_and_variable_attributes): Do not call
mark_decl_referenced.
Index: final.c
===================================================================
--- final.c (revision 159343)
+++ final.c (working copy)
@@ -3529,10 +3529,7 @@ output_addr_const (FILE *file, rtx x)
case SYMBOL_REF:
if (SYMBOL_REF_DECL (x))
- {
- mark_decl_referenced (SYMBOL_REF_DECL (x));
- assemble_external (SYMBOL_REF_DECL (x));
- }
+ assemble_external (SYMBOL_REF_DECL (x));
#ifdef ASM_OUTPUT_SYMBOL_REF
ASM_OUTPUT_SYMBOL_REF (file, x);
#else
Index: cgraphunit.c
===================================================================
--- cgraphunit.c (revision 159343)
+++ cgraphunit.c (working copy)
@@ -959,11 +959,7 @@ process_function_and_variable_attributes
{
tree decl = node->decl;
if (DECL_PRESERVE_P (decl))
- {
- mark_decl_referenced (decl);
- if (node->local.finalized)
- cgraph_mark_needed_node (node);
- }
+ cgraph_mark_needed_node (node);
if (lookup_attribute ("externally_visible", DECL_ATTRIBUTES (decl)))
{
if (! TREE_PUBLIC (node->decl))
@@ -979,7 +975,6 @@ process_function_and_variable_attributes
tree decl = vnode->decl;
if (DECL_PRESERVE_P (decl))
{
- mark_decl_referenced (decl);
vnode->force_output = true;
if (vnode->finalized)
varpool_mark_needed_node (vnode);