OSDN Git Service

2008-05-16 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / ipa-reference.c
index 62b1c1d..75aed2f 100644 (file)
@@ -1,12 +1,12 @@
 /* Callgraph based analysis of static variables.
-   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
    Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
 
 This file is part of GCC.
 
 GCC is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
+Software Foundation; either version 3, or (at your option) any later
 version.
 
 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
@@ -15,10 +15,8 @@ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 for more details.
 
 You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.  
-*/
+along with GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
 
 /* This file gathers information about how variables whose scope is
    confined to the compilation unit are used.  
@@ -269,6 +267,10 @@ has_proper_scope_for_analysis (tree t)
   if (DECL_EXTERNAL (t) || TREE_PUBLIC (t))
     return false;
 
+  /* We cannot touch decls where the type needs constructing.  */
+  if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (t)))
+    return false;
+
   /* This is a variable we care about.  Check if we have seen it
      before, and if not add it the set of variables we care about.  */
   if (!bitmap_bit_p (all_module_statics, DECL_UID (t)))
@@ -834,7 +836,7 @@ analyze_function (struct cgraph_node *fn)
   if (DECL_STRUCT_FUNCTION (decl))
     {
       tree step;
-      for (step = DECL_STRUCT_FUNCTION (decl)->unexpanded_var_list;
+      for (step = DECL_STRUCT_FUNCTION (decl)->local_decls;
           step;
           step = TREE_CHAIN (step))
        {
@@ -947,7 +949,6 @@ static_execute (void)
     unsigned int index;
     bitmap_iterator bi;
     bitmap module_statics_readonly = BITMAP_ALLOC (&ipa_obstack);
-    bitmap module_statics_const = BITMAP_ALLOC (&ipa_obstack);
     bitmap bm_temp = BITMAP_ALLOC (&ipa_obstack);
 
     EXECUTE_IF_SET_IN_BITMAP (module_statics_escape, 0, index, bi)
@@ -997,14 +998,6 @@ static_execute (void)
              fprintf (dump_file, "read-only var %s\n", 
                       get_static_name (index));
          }
-       if (DECL_INITIAL (var)
-           && is_gimple_min_invariant (DECL_INITIAL (var)))
-         {
-           bitmap_set_bit (module_statics_const, index);
-           if (dump_file)
-             fprintf (dump_file, "read-only constant %s\n",
-                      get_static_name (index));
-         }
       }
 
     BITMAP_FREE(module_statics_escape);
@@ -1034,7 +1027,6 @@ static_execute (void)
       }
 
     BITMAP_FREE(module_statics_readonly);
-    BITMAP_FREE(module_statics_const);
     BITMAP_FREE(bm_temp);
   }
 
@@ -1327,8 +1319,10 @@ gate_reference (void)
          && !(errorcount || sorrycount));
 }
 
-struct tree_opt_pass pass_ipa_reference =
+struct simple_ipa_opt_pass pass_ipa_reference =
 {
+ {
+  SIMPLE_IPA_PASS,
   "static-var",                                /* name */
   gate_reference,                      /* gate */
   static_execute,                      /* execute */
@@ -1340,8 +1334,8 @@ struct tree_opt_pass pass_ipa_reference =
   0,                                   /* properties_provided */
   0,                                   /* properties_destroyed */
   0,                                   /* todo_flags_start */
-  0,                                    /* todo_flags_finish */
-  0                                    /* letter */
+  0                                     /* todo_flags_finish */
+ }
 };
 
 #include "gt-ipa-reference.h"