OSDN Git Service

* toplev.c (finalize): Add no_backend parameter. Don't finish
[pf3gnuchains/gcc-fork.git] / gcc / integrate.c
index 7eb29f2..dd75758 100644 (file)
@@ -1,6 +1,7 @@
 /* Procedure integration for GCC.
    Copyright (C) 1988, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+   Free Software Foundation, Inc.
    Contributed by Michael Tiemann (tiemann@cygnus.com)
 
 This file is part of GCC.
@@ -35,9 +36,9 @@ along with GCC; see the file COPYING3.  If not see
 #include "output.h"
 #include "recog.h"
 #include "integrate.h"
-#include "real.h"
 #include "except.h"
 #include "function.h"
+#include "diagnostic-core.h"
 #include "toplev.h"
 #include "intl.h"
 #include "params.h"
@@ -52,11 +53,11 @@ along with GCC; see the file COPYING3.  If not see
 \f
 
 /* Private type used by {get/has}_hard_reg_initial_val.  */
-typedef struct initial_value_pair GTY(()) {
+typedef struct GTY(()) initial_value_pair {
   rtx hard_reg;
   rtx pseudo;
 } initial_value_pair;
-typedef struct initial_value_struct GTY(()) {
+typedef struct GTY(()) initial_value_struct {
   int num_entries;
   int max_entries;
   initial_value_pair * GTY ((length ("%h.num_entries"))) entries;
@@ -111,7 +112,7 @@ set_block_origin_self (tree stmt)
 
        for (local_decl = BLOCK_VARS (stmt);
             local_decl != NULL_TREE;
-            local_decl = TREE_CHAIN (local_decl))
+            local_decl = DECL_CHAIN (local_decl))
          set_decl_origin_self (local_decl);    /* Potential recursion.  */
       }
 
@@ -147,7 +148,7 @@ set_decl_origin_self (tree decl)
        {
          tree arg;
 
-         for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg))
+         for (arg = DECL_ARGUMENTS (decl); arg; arg = DECL_CHAIN (arg))
            DECL_ABSTRACT_ORIGIN (arg) = arg;
          if (DECL_INITIAL (decl) != NULL_TREE
              && DECL_INITIAL (decl) != error_mark_node)
@@ -166,14 +167,23 @@ set_block_abstract_flags (tree stmt, int setting)
 {
   tree local_decl;
   tree subblock;
+  unsigned int i;
 
   BLOCK_ABSTRACT (stmt) = setting;
 
   for (local_decl = BLOCK_VARS (stmt);
        local_decl != NULL_TREE;
-       local_decl = TREE_CHAIN (local_decl))
+       local_decl = DECL_CHAIN (local_decl))
     set_decl_abstract_flags (local_decl, setting);
 
+  for (i = 0; i < BLOCK_NUM_NONLOCALIZED_VARS (stmt); i++)
+    {
+      local_decl = BLOCK_NONLOCALIZED_VAR (stmt, i);
+      if ((TREE_CODE (local_decl) == VAR_DECL && !TREE_STATIC (local_decl))
+         || TREE_CODE (local_decl) == PARM_DECL)
+       set_decl_abstract_flags (local_decl, setting);
+    }
+
   for (subblock = BLOCK_SUBBLOCKS (stmt);
        subblock != NULL_TREE;
        subblock = BLOCK_CHAIN (subblock))
@@ -194,7 +204,7 @@ set_decl_abstract_flags (tree decl, int setting)
     {
       tree arg;
 
-      for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg))
+      for (arg = DECL_ARGUMENTS (decl); arg; arg = DECL_CHAIN (arg))
        DECL_ABSTRACT (arg) = setting;
       if (DECL_INITIAL (decl) != NULL_TREE
          && DECL_INITIAL (decl) != error_mark_node)
@@ -206,9 +216,9 @@ set_decl_abstract_flags (tree decl, int setting)
    the function.  */
 
 rtx
-get_hard_reg_initial_reg (struct function *fun, rtx reg)
+get_hard_reg_initial_reg (rtx reg)
 {
-  struct initial_value_struct *ivs = fun->hard_reg_initial_vals;
+  struct initial_value_struct *ivs = crtl->hard_reg_initial_vals;
   int i;
 
   if (ivs == 0)
@@ -234,22 +244,21 @@ get_hard_reg_initial_val (enum machine_mode mode, unsigned int regno)
   if (rv)
     return rv;
 
-  ivs = cfun->hard_reg_initial_vals;
+  ivs = crtl->hard_reg_initial_vals;
   if (ivs == 0)
     {
-      ivs = ggc_alloc (sizeof (initial_value_struct));
+      ivs = ggc_alloc_initial_value_struct ();
       ivs->num_entries = 0;
       ivs->max_entries = 5;
-      ivs->entries = ggc_alloc (5 * sizeof (initial_value_pair));
-      cfun->hard_reg_initial_vals = ivs;
+      ivs->entries = ggc_alloc_vec_initial_value_pair (5);
+      crtl->hard_reg_initial_vals = ivs;
     }
 
   if (ivs->num_entries >= ivs->max_entries)
     {
       ivs->max_entries += 5;
-      ivs->entries = ggc_realloc (ivs->entries,
-                                 ivs->max_entries
-                                 * sizeof (initial_value_pair));
+      ivs->entries = GGC_RESIZEVEC (initial_value_pair, ivs->entries,
+                                   ivs->max_entries);
     }
 
   ivs->entries[ivs->num_entries].hard_reg = gen_rtx_REG (mode, regno);
@@ -268,7 +277,7 @@ has_hard_reg_initial_val (enum machine_mode mode, unsigned int regno)
   struct initial_value_struct *ivs;
   int i;
 
-  ivs = cfun->hard_reg_initial_vals;
+  ivs = crtl->hard_reg_initial_vals;
   if (ivs != 0)
     for (i = 0; i < ivs->num_entries; i++)
       if (GET_MODE (ivs->entries[i].hard_reg) == mode
@@ -281,7 +290,7 @@ has_hard_reg_initial_val (enum machine_mode mode, unsigned int regno)
 unsigned int
 emit_initial_value_sets (void)
 {
-  struct initial_value_struct *ivs = cfun->hard_reg_initial_vals;
+  struct initial_value_struct *ivs = crtl->hard_reg_initial_vals;
   int i;
   rtx seq;
 
@@ -298,21 +307,23 @@ emit_initial_value_sets (void)
   return 0;
 }
 
-struct tree_opt_pass pass_initial_value_sets =
+struct rtl_opt_pass pass_initial_value_sets =
 {
+ {
+  RTL_PASS,
   "initvals",                           /* name */
   NULL,                                 /* gate */
   emit_initial_value_sets,              /* execute */
   NULL,                                 /* sub */
   NULL,                                 /* next */
   0,                                    /* static_pass_number */
-  0,                                    /* tv_id */
+  TV_NONE,                              /* tv_id */
   0,                                    /* properties_required */
   0,                                    /* properties_provided */
   0,                                    /* properties_destroyed */
   0,                                    /* todo_flags_start */
-  TODO_dump_func,                       /* todo_flags_finish */
-  0                                     /* letter */
+  TODO_dump_func                        /* todo_flags_finish */
+ }
 };
 
 /* If the backend knows where to allocate pseudos for hard
@@ -322,7 +333,7 @@ allocate_initial_values (rtx *reg_equiv_memory_loc)
 {
   if (targetm.allocate_initial_value)
     {
-      struct initial_value_struct *ivs = cfun->hard_reg_initial_vals;
+      struct initial_value_struct *ivs = crtl->hard_reg_initial_vals;
       int i;
 
       if (ivs == 0)
@@ -332,7 +343,7 @@ allocate_initial_values (rtx *reg_equiv_memory_loc)
        {
          int regno = REGNO (ivs->entries[i].pseudo);
          rtx x = targetm.allocate_initial_value (ivs->entries[i].hard_reg);
-  
+
          if (x && REG_N_SETS (REGNO (ivs->entries[i].pseudo)) <= 1)
            {
              if (MEM_P (x))