re PR objc/43061 (47 new GCC HEAD@156527 regressions)

PR objc/43061
        * cgraphunit.c (process_function_and_variable_attributes): Check
	DECL_PRESERVE_P instead of looking up attribute "used".
        * ipa-pure-const.c (check_decl): Likewise.
        * ipa-reference.c (has_proper_scope_for_analysis): Likewise.
        * ipa-type-escape.c (has_proper_scope_for_analysis): Likewise.
        * config/sol2.c (solaris_insert_attributes): Set DECL_PRESERVE_P
        instead of attribute "used".
        * config/sol2-c.c (solaris_pragma_init): Likewise.
        (solaris_pragma_fini): Likewise.

From-SVN: r156907
This commit is contained in:
Mike Stump 2010-02-19 19:06:38 +00:00 committed by Mike Stump
parent cf9280bf7e
commit b42186f164
8 changed files with 30 additions and 20 deletions

View File

@ -1,3 +1,16 @@
2010-02-19 Mike Stump <mikestump@comcast.net>
PR objc/43061
* cgraphunit.c (process_function_and_variable_attributes): Check
DECL_PRESERVE_P instead of looking up attribute "used".
* ipa-pure-const.c (check_decl): Likewise.
* ipa-reference.c (has_proper_scope_for_analysis): Likewise.
* ipa-type-escape.c (has_proper_scope_for_analysis): Likewise.
* config/sol2.c (solaris_insert_attributes): Set DECL_PRESERVE_P
instead of attribute "used".
* config/sol2-c.c (solaris_pragma_init): Likewise.
(solaris_pragma_fini): Likewise.
2010-02-19 Jakub Jelinek <jakub@redhat.com>
* ipa-struct-reorg.c (make_field_acc_node, gen_cluster, peel_field):

View File

@ -885,7 +885,7 @@ process_function_and_variable_attributes (struct cgraph_node *first,
for (node = cgraph_nodes; node != first; node = node->next)
{
tree decl = node->decl;
if (lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
if (DECL_PRESERVE_P (decl))
{
mark_decl_referenced (decl);
if (node->local.finalized)
@ -904,7 +904,7 @@ process_function_and_variable_attributes (struct cgraph_node *first,
for (vnode = varpool_nodes; vnode != first_var; vnode = vnode->next)
{
tree decl = vnode->decl;
if (lookup_attribute ("used", DECL_ATTRIBUTES (decl)))
if (DECL_PRESERVE_P (decl))
{
mark_decl_referenced (decl);
vnode->force_output = true;

View File

@ -170,9 +170,10 @@ solaris_pragma_init (cpp_reader *pfile ATTRIBUTE_UNUSED)
tree decl = identifier_global_value (t);
if (decl && DECL_P (decl))
{
tree init_list = build_tree_list (get_identifier ("init"),
NULL);
tree attrs = tree_cons (get_identifier ("used"), NULL, init_list);
tree attrs = build_tree_list (get_identifier ("init"),
NULL);
TREE_USED (decl) = 1;
DECL_PRESERVE_P (decl) = 1;
decl_attributes (&decl, attrs, 0);
}
else
@ -228,9 +229,10 @@ solaris_pragma_fini (cpp_reader *pfile ATTRIBUTE_UNUSED)
tree decl = identifier_global_value (t);
if (decl && DECL_P (decl))
{
tree fini_list = build_tree_list (get_identifier ("fini"),
NULL);
tree attrs = tree_cons (get_identifier ("used"), NULL, fini_list);
tree attrs = build_tree_list (get_identifier ("fini"),
NULL);
TREE_USED (decl) = 1;
DECL_PRESERVE_P (decl) = 1;
decl_attributes (&decl, attrs, 0);
}
else

View File

@ -70,8 +70,8 @@ solaris_insert_attributes (tree decl, tree *attributes)
{
*attributes = tree_cons (get_identifier ("init"), NULL,
*attributes);
*attributes = tree_cons (get_identifier ("used"), NULL,
*attributes);
TREE_USED (decl) = 1;
DECL_PRESERVE_P (decl) = 1;
next = TREE_CHAIN (*x);
ggc_free (*x);
*x = next;
@ -87,8 +87,8 @@ solaris_insert_attributes (tree decl, tree *attributes)
{
*attributes = tree_cons (get_identifier ("fini"), NULL,
*attributes);
*attributes = tree_cons (get_identifier ("used"), NULL,
*attributes);
TREE_USED (decl) = 1;
DECL_PRESERVE_P (decl) = 1;
next = TREE_CHAIN (*x);
ggc_free (*x);
*x = next;

View File

@ -159,7 +159,7 @@ check_decl (funct_state local,
/* If the variable has the "used" attribute, treat it as if it had a
been touched by the devil. */
if (lookup_attribute ("used", DECL_ATTRIBUTES (t)))
if (DECL_PRESERVE_P (t))
{
local->pure_const_state = IPA_NEITHER;
if (dump_file)

View File

@ -306,7 +306,7 @@ has_proper_scope_for_analysis (tree t)
{
/* If the variable has the "used" attribute, treat it as if it had a
been touched by the devil. */
if (lookup_attribute ("used", DECL_ATTRIBUTES (t)))
if (DECL_PRESERVE_P (t))
return false;
/* Do not want to do anything with volatile except mark any

View File

@ -1072,7 +1072,7 @@ has_proper_scope_for_analysis (tree t)
tree type = get_canon_type (TREE_TYPE (t), false, false);
if (!type) return;
if (lookup_attribute ("used", DECL_ATTRIBUTES (t)))
if (DECL_PRESERVE_P (t))
{
mark_interesting_type (type, FULL_ESCAPE);
return;

View File

@ -1527,11 +1527,6 @@ finish_var_decl (tree var, tree initializer)
/* We reserve the right for the runtime to use/modify these variables
in ways that are opaque to us. */
DECL_PRESERVE_P (var) = 1;
/* ipa*.c/cgraphunit.c use lookup attribute rather than testing
DECL_PRESERVE_P. Once they switch to testing DECL_PRESERVE_P,
this can be removed. */
DECL_ATTRIBUTES (var) = tree_cons (get_identifier ("used"), NULL,
DECL_ATTRIBUTES (var)) ;
}
/* Find the decl for the constant string class reference. This is only