From b42186f16474032ac2fa82027d3b7bf31e94daef Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Fri, 19 Feb 2010 19:06:38 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 13 +++++++++++++ gcc/cgraphunit.c | 4 ++-- gcc/config/sol2-c.c | 14 ++++++++------ gcc/config/sol2.c | 8 ++++---- gcc/ipa-pure-const.c | 2 +- gcc/ipa-reference.c | 2 +- gcc/ipa-type-escape.c | 2 +- gcc/objc/objc-act.c | 5 ----- 8 files changed, 30 insertions(+), 20 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce842ff64bc..e724239e8fe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2010-02-19 Mike Stump + + 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 * ipa-struct-reorg.c (make_field_acc_node, gen_cluster, peel_field): diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index ec7f9d8fc33..37eee71231f 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -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; diff --git a/gcc/config/sol2-c.c b/gcc/config/sol2-c.c index da00377a432..601db9735ee 100644 --- a/gcc/config/sol2-c.c +++ b/gcc/config/sol2-c.c @@ -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 diff --git a/gcc/config/sol2.c b/gcc/config/sol2.c index bf7da834129..493816c188d 100644 --- a/gcc/config/sol2.c +++ b/gcc/config/sol2.c @@ -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; diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index 31883a22afd..806faf654af 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -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) diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c index 98a4ce7d714..f00377fb9db 100644 --- a/gcc/ipa-reference.c +++ b/gcc/ipa-reference.c @@ -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 diff --git a/gcc/ipa-type-escape.c b/gcc/ipa-type-escape.c index 8d9f26114d3..8d773f12320 100644 --- a/gcc/ipa-type-escape.c +++ b/gcc/ipa-type-escape.c @@ -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; diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index fae535cf29d..10cc9bce306 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -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