OSDN Git Service

2009-03-26 Andrew Haley <aph@redhat.com>
[pf3gnuchains/gcc-fork.git] / gcc / init-regs.c
index adde3fa..791b926 100644 (file)
@@ -1,12 +1,11 @@
 /* Initialization of uninitialized regs. 
-   Copyright (C) 2007 Free Software Foundation,
-   Inc.
+   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
 
 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,9 +14,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/>.  */
 
 #include "config.h"
 #include "system.h"
@@ -53,6 +51,12 @@ initialize_uninitialized_regs (void)
   basic_block bb;
   bitmap already_genned = BITMAP_ALLOC (NULL);
 
+  if (optimize == 1)
+    {
+      df_live_add_problem ();
+      df_live_set_all_dirty ();
+    }
+
   df_analyze ();
 
   FOR_EACH_BB (bb)
@@ -65,13 +69,13 @@ initialize_uninitialized_regs (void)
       FOR_BB_INSNS (bb, insn)
        {
          unsigned int uid = INSN_UID (insn);
-         struct df_ref **use_rec;
+         df_ref *use_rec;
          if (!INSN_P (insn))
            continue;
 
          for (use_rec = DF_INSN_UID_USES (uid); *use_rec; use_rec++)
            {
-             struct df_ref *use = *use_rec;
+             df_ref use = *use_rec;
              unsigned int regno = DF_REF_REGNO (use);
 
              /* Only do this for the pseudos.  */
@@ -101,7 +105,7 @@ initialize_uninitialized_regs (void)
                  emit_move_insn (reg, CONST0_RTX (GET_MODE (reg)));
                  move_insn = get_insns ();
                  end_sequence ();
-                 add_insn_before (move_insn, insn, bb);
+                 emit_insn_before (move_insn, insn);
                  if (dump_file)
                    fprintf (dump_file, 
                             "adding initialization in %s of reg %d at in block %d for insn %d.\n", 
@@ -111,6 +115,13 @@ initialize_uninitialized_regs (void)
        }
     }
 
+  if (optimize == 1)
+    {
+      if (dump_file) 
+       df_dump (dump_file);
+      df_remove_problem (df_live);
+    }
+
   BITMAP_FREE (already_genned);
 }
 
@@ -123,14 +134,14 @@ gate_initialize_regs (void)
 static unsigned int
 rest_of_handle_initialize_regs (void)
 {
-  no_new_pseudos = 0;
   initialize_uninitialized_regs ();
-  no_new_pseudos = 1;
   return 0;
 }
 
-struct tree_opt_pass pass_initialize_regs =
+struct rtl_opt_pass pass_initialize_regs =
 {
+ {
+  RTL_PASS,
   "init-regs",                          /* name */
   gate_initialize_regs,                 /* gate */
   rest_of_handle_initialize_regs,       /* execute */
@@ -143,6 +154,6 @@ struct tree_opt_pass pass_initialize_regs =
   0,                                    /* properties_destroyed */
   0,                                    /* todo_flags_start */
   TODO_dump_func |
-  TODO_df_finish,                       /* todo_flags_finish */
-  0                                     /* letter */
+  TODO_df_finish                        /* todo_flags_finish */
+ }
 };