+Sat Oct 11 12:24:23 CEST 2003 Jan Hubicka <jh@suse.cz>
+
+ * varasm.c (notice_global_symbol): Fix handling of variables; avoid
+ re-computing of variable.
+
2003-10-11 Richard Henderson <rth@redhat.com>
* config/alpha/alpha.c (alpha_return_in_memory): Rename from
void
notice_global_symbol (tree decl)
{
- if ((!first_global_object_name || !weak_global_object_name)
- && TREE_PUBLIC (decl) && !DECL_COMMON (decl)
- && !DECL_EXTERNAL (decl)
- && (TREE_CODE (decl) == FUNCTION_DECL
- || (TREE_CODE (decl) == VAR_DECL
- && (DECL_INITIAL (decl) != 0
- && DECL_INITIAL (decl) != error_mark_node))))
+ const char **type = &first_global_object_name;
+
+ if (first_global_object_name
+ || !TREE_PUBLIC (decl) || DECL_EXTERNAL (decl)
+ || !DECL_NAME (decl)
+ || (TREE_CODE (decl) != FUNCTION_DECL
+ && (TREE_CODE (decl) != VAR_DECL
+ || (DECL_COMMON (decl)
+ && (DECL_INITIAL (decl) == 0
+ || DECL_INITIAL (decl) == error_mark_node)))))
+ return;
+
+ /* We win when global object is found, but it is usefull to know about weak
+ symbol as well so we can produce nicer unique names. */
+ if (DECL_WEAK (decl) || DECL_ONE_ONLY (decl))
+ type = &weak_global_object_name;
+
+ if (!*type)
{
const char *p;
char *name;
p = (* targetm.strip_name_encoding) (XSTR (XEXP (decl_rtl, 0), 0));
name = xstrdup (p);
- if (! DECL_WEAK (decl) && ! DECL_ONE_ONLY (decl))
- first_global_object_name = name;
- else
- weak_global_object_name = name;
+ *type = name;
}
}