re PR objc/43061 (47 new GCC HEAD@156527 regressions)
authorMike Stump <mikestump@comcast.net>
Fri, 19 Feb 2010 19:06:38 +0000 (19:06 +0000)
committerMike Stump <mrs@gcc.gnu.org>
Fri, 19 Feb 2010 19:06:38 +0000 (19:06 +0000)
        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
gcc/cgraphunit.c
gcc/config/sol2-c.c
gcc/config/sol2.c
gcc/ipa-pure-const.c
gcc/ipa-reference.c
gcc/ipa-type-escape.c
gcc/objc/objc-act.c

index ce842ff..e724239 100644 (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):
index ec7f9d8..37eee71 100644 (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;
index da00377..601db97 100644 (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
index bf7da83..493816c 100644 (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;
index 31883a2..806faf6 100644 (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)
index 98a4ce7..f00377f 100644 (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
index 8d9f261..8d773f1 100644 (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;
index fae535c..10cc9bc 100644 (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