OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / toplev.c
index edfc552..094a2e2 100644 (file)
@@ -1,6 +1,6 @@
 /* Top level of GCC compilers (cc1, cc1plus, etc.)
    Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -16,8 +16,8 @@ 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, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.  */
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
 
 /* This is the top level of cc1/c++.
    It parses command args, opens files, invokes the various passes
@@ -145,7 +145,7 @@ location_t unknown_location = { NULL, 0 };
 
 /* Used to enable -fvar-tracking, -fweb and -frename-registers according
    to optimize and default_debug_hooks in process_options ().  */
-#define AUTODETECT_FLAG_VAR_TRACKING 2
+#define AUTODETECT_VALUE 2
 
 /* Current position in real source file.  */
 
@@ -267,9 +267,9 @@ int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
 
 /* 0 means straightforward implementation of complex divide acceptable.
    1 means wide ranges of inputs must work for complex divide.
-   2 means C99-like requirements for complex divide (not yet implemented).  */
+   2 means C99-like requirements for complex multiply and divide.  */
 
-int flag_complex_divide_method = 0;
+int flag_complex_method = 1;
 
 /* Nonzero means that we don't want inlining by virtue of -fno-inline,
    not just because the tree inliner turned us off.  */
@@ -289,6 +289,14 @@ const char *aux_info_file_name;
 
 int flag_shlib;
 
+/* Generate code for GNU or NeXT Objective-C runtime environment.  */
+
+#ifdef NEXT_OBJC_RUNTIME
+int flag_next_runtime = 1;
+#else
+int flag_next_runtime = 0;
+#endif
+
 /* Set to the default thread-local storage (tls) model to use.  */
 
 enum tls_model flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
@@ -326,9 +334,9 @@ rtx stack_limit_rtx;
 int flag_renumber_insns = 1;
 
 /* Nonzero if we should track variables.  When
-   flag_var_tracking == AUTODETECT_FLAG_VAR_TRACKING it will be set according
+   flag_var_tracking == AUTODETECT_VALUE it will be set according
    to optimize, debug_info_level and debug_hooks in process_options ().  */
-int flag_var_tracking = AUTODETECT_FLAG_VAR_TRACKING;
+int flag_var_tracking = AUTODETECT_VALUE;
 
 /* True if the user has tagged the function with the 'section'
    attribute.  */
@@ -374,38 +382,6 @@ static const param_info lang_independent_params[] = {
   { NULL, 0, 0, 0, NULL }
 };
 
-/* Here is a table, controlled by the tm.h file, listing each -m switch
-   and which bits in `target_switches' it should set or clear.
-   If VALUE is positive, it is bits to set.
-   If VALUE is negative, -VALUE is bits to clear.
-   (The sign bit is not used so there is no confusion.)  */
-
-static const struct
-{
-  const char *const name;
-  const int value;
-  const char *const description;
-}
-target_switches[] = TARGET_SWITCHES;
-
-/* This table is similar, but allows the switch to have a value.  */
-
-#ifdef TARGET_OPTIONS
-static const struct
-{
-  const char *const prefix;
-  const char **const variable;
-  const char *const description;
-  const char *const value;
-}
-target_options[] = TARGET_OPTIONS;
-#endif
-
-/* Nonzero means warn about function definitions that default the return type
-   or that use a null return and have a return-type other than void.  */
-
-int warn_return_type;
-
 /* Output files for assembler code (real compiler output)
    and debugging dumps.  */
 
@@ -449,7 +425,11 @@ const char *
 get_src_pwd (void)
 {
   if (! src_pwd)
-    src_pwd = getpwd ();
+    {
+      src_pwd = getpwd ();
+      if (!src_pwd)
+       src_pwd = ".";
+    }
 
    return src_pwd;
 }
@@ -462,9 +442,9 @@ announce_function (tree decl)
   if (!quiet_flag)
     {
       if (rtl_dump_and_exit)
-       verbatim ("%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
+       fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
       else
-       verbatim (" %s", lang_hooks.decl_printable_name (decl, 2));
+       fprintf (stderr, " %s", lang_hooks.decl_printable_name (decl, 2));
       fflush (stderr);
       pp_needs_newline (global_dc->printer) = true;
       diagnostic_set_last_function (global_dc);
@@ -724,7 +704,8 @@ wrapup_global_declarations (tree *vec, int len)
 
       /* We're not deferring this any longer.  Assignment is
         conditional to avoid needlessly dirtying PCH pages.  */
-      if (DECL_DEFER_OUTPUT (decl) != 0)
+      if (CODE_CONTAINS_STRUCT (TREE_CODE (decl), TS_DECL_WITH_VIS)
+         && DECL_DEFER_OUTPUT (decl) != 0)
        DECL_DEFER_OUTPUT (decl) = 0;
 
       if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0)
@@ -775,9 +756,11 @@ wrapup_global_declarations (tree *vec, int len)
              bool needed = 1;
              node = cgraph_varpool_node (decl);
 
-             if (flag_unit_at_a_time && node->finalized)
+             if (node->finalized)
+               needed = 0;
+             else if (node->alias)
                needed = 0;
-             else if ((flag_unit_at_a_time && !cgraph_global_info_ready)
+             else if (!cgraph_global_info_ready
                       && (TREE_USED (decl)
                           || TREE_USED (DECL_ASSEMBLER_NAME (decl))))
                /* needed */;
@@ -819,13 +802,6 @@ check_global_declarations (tree *vec, int len)
     {
       decl = vec[i];
 
-      /* Do not emit debug information about variables that are in
-        static storage, but not defined.  */
-      if (TREE_CODE (decl) == VAR_DECL
-         && TREE_STATIC (decl)
-         && !TREE_ASM_WRITTEN (decl))
-       DECL_IGNORED_P (decl) = 1;
       /* Warn about any function
         declared static but not defined.
         We don't warn about variables,
@@ -841,10 +817,10 @@ check_global_declarations (tree *vec, int len)
              || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
        {
          if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
-           pedwarn ("%J%qF used but never defined", decl, decl);
+           pedwarn ("%q+F used but never defined", decl);
          else
-           warning ("%J%qF declared %<static%> but never defined",
-                    decl, decl);
+           warning (0, "%q+F declared %<static%> but never defined",
+                    decl);
          /* This symbol is effectively an "extern" declaration now.  */
          TREE_PUBLIC (decl) = 1;
          assemble_external (decl);
@@ -869,7 +845,7 @@ check_global_declarations (tree *vec, int len)
          && ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
          /* Otherwise, ask the language.  */
          && lang_hooks.decls.warn_unused_global (decl))
-       warning ("%J%qD defined but not used", decl, decl);
+       warning (0, "%q+D defined but not used", decl);
 
       /* Avoid confusing the debug information machinery when there are
         errors.  */
@@ -892,7 +868,8 @@ warn_deprecated_use (tree node)
   if (DECL_P (node))
     {
       expanded_location xloc = expand_location (DECL_SOURCE_LOCATION (node));
-      warning ("%qs is deprecated (declared at %s:%d)",
+      warning (OPT_Wdeprecated_declarations,
+              "%qs is deprecated (declared at %s:%d)",
               IDENTIFIER_POINTER (DECL_NAME (node)),
               xloc.file, xloc.line);
     }
@@ -915,18 +892,20 @@ warn_deprecated_use (tree node)
          expanded_location xloc
            = expand_location (DECL_SOURCE_LOCATION (decl));
          if (what)
-           warning ("%qs is deprecated (declared at %s:%d)", what,
-                      xloc.file, xloc.line);
+           warning (OPT_Wdeprecated_declarations,
+                    "%qs is deprecated (declared at %s:%d)", what,
+                    xloc.file, xloc.line);
          else
-           warning ("type is deprecated (declared at %s:%d)",
+           warning (OPT_Wdeprecated_declarations,
+                    "type is deprecated (declared at %s:%d)",
                     xloc.file, xloc.line);
        }
       else
        {
          if (what)
-           warning ("%qs is deprecated", what);
+           warning (OPT_Wdeprecated_declarations, "%qs is deprecated", what);
          else
-           warning ("type is deprecated");
+           warning (OPT_Wdeprecated_declarations, "type is deprecated");
        }
     }
 }
@@ -1003,8 +982,8 @@ compile_file (void)
     return;
 
   lang_hooks.decls.final_write_globals ();
-
   cgraph_varpool_assemble_pending_decls ();
+  finish_aliases_2 ();
 
   /* This must occur after the loop to output deferred functions.
      Else the coverage initializer would not be emitted if all the
@@ -1034,6 +1013,11 @@ compile_file (void)
 
   dw2_output_indirect_constants ();
 
+  /* Flush any pending external directives.  cgraph did this for
+     assemble_external calls from the front end, but the RTL
+     expander can also generate them.  */
+  process_pending_assemble_externals ();
+
   /* Attach a special .ident directive to the end of the file to identify
      the version of GCC which compiled this code.  The format of the .ident
      string is patterned after the ones produced by native SVR4 compilers.  */
@@ -1049,78 +1033,6 @@ compile_file (void)
   targetm.asm_out.file_end ();
 }
 
-/* Display help for target options.  */
-void
-display_target_options (void)
-{
-  int undoc, i;
-  static bool displayed = false;
-
-  /* Avoid double printing for --help --target-help.  */
-  if (displayed)
-    return;
-
-  displayed = true;
-
-  if (ARRAY_SIZE (target_switches) > 1
-#ifdef TARGET_OPTIONS
-      || ARRAY_SIZE (target_options) > 1
-#endif
-      )
-    {
-      int doc = 0;
-
-      undoc = 0;
-
-      printf (_("\nTarget specific options:\n"));
-
-      for (i = ARRAY_SIZE (target_switches); i--;)
-       {
-         const char *option      = target_switches[i].name;
-         const char *description = target_switches[i].description;
-
-         if (option == NULL || *option == 0)
-           continue;
-         else if (description == NULL)
-           {
-             undoc = 1;
-
-             if (extra_warnings)
-               printf (_("  -m%-23s [undocumented]\n"), option);
-           }
-         else if (*description != 0)
-           doc += printf ("  -m%-23s %s\n", option, _(description));
-       }
-
-#ifdef TARGET_OPTIONS
-      for (i = ARRAY_SIZE (target_options); i--;)
-       {
-         const char *option      = target_options[i].prefix;
-         const char *description = target_options[i].description;
-
-         if (option == NULL || *option == 0)
-           continue;
-         else if (description == NULL)
-           {
-             undoc = 1;
-
-             if (extra_warnings)
-               printf (_("  -m%-23s [undocumented]\n"), option);
-           }
-         else if (*description != 0)
-           doc += printf ("  -m%-23s %s\n", option, _(description));
-       }
-#endif
-      if (undoc)
-       {
-         if (doc)
-           printf (_("\nThere are undocumented target specific options as well.\n"));
-         else
-           printf (_("  They exist, but they are not documented.\n"));
-       }
-    }
-}
-
 /* Parse a -d... command line switch.  */
 
 void
@@ -1160,7 +1072,7 @@ decode_d_option (const char *arg)
       case 'a':
       default:
        if (!enable_rtl_dump_file (c))
-         warning ("unrecognized gcc debugging option: %c", c);
+         warning (0, "unrecognized gcc debugging option: %c", c);
        break;
       }
 }
@@ -1171,60 +1083,6 @@ const char *const debug_type_names[] =
   "none", "stabs", "coff", "dwarf-2", "xcoff", "vms"
 };
 
-/* Decode -m switches.  */
-/* Decode the switch -mNAME.  */
-
-void
-set_target_switch (const char *name)
-{
-  size_t j;
-  int valid_target_option = 0;
-
-  for (j = 0; j < ARRAY_SIZE (target_switches); j++)
-    if (!strcmp (target_switches[j].name, name))
-      {
-       if (target_switches[j].value < 0)
-         target_flags &= ~-target_switches[j].value;
-       else
-         target_flags |= target_switches[j].value;
-       if (name[0] != 0)
-         {
-           if (target_switches[j].value < 0)
-             target_flags_explicit |= -target_switches[j].value;
-           else
-             target_flags_explicit |= target_switches[j].value;
-         }
-       valid_target_option = 1;
-      }
-
-#ifdef TARGET_OPTIONS
-  if (!valid_target_option)
-    for (j = 0; j < ARRAY_SIZE (target_options); j++)
-      {
-       int len = strlen (target_options[j].prefix);
-       if (target_options[j].value)
-         {
-           if (!strcmp (target_options[j].prefix, name))
-             {
-               *target_options[j].variable = target_options[j].value;
-               valid_target_option = 1;
-             }
-         }
-       else
-         {
-           if (!strncmp (target_options[j].prefix, name, len))
-             {
-               *target_options[j].variable = name + len;
-               valid_target_option = 1;
-             }
-         }
-      }
-#endif
-
-  if (!valid_target_option)
-    error ("invalid option %qs", name);
-}
-
 /* Print version information to FILE.
    Each line begins with INDENT (for the case where FILE is the
    assembler output file).  */
@@ -1232,19 +1090,25 @@ set_target_switch (const char *name)
 void
 print_version (FILE *file, const char *indent)
 {
-#ifndef __VERSION__
-#define __VERSION__ "[?]"
-#endif
-  fnotice (file,
+  static const char fmt1[] =
 #ifdef __GNUC__
-          "%s%s%s version %s (%s)\n%s\tcompiled by GNU C version %s.\n"
+    N_("%s%s%s version %s (%s)\n%s\tcompiled by GNU C version %s.\n")
 #else
-          "%s%s%s version %s (%s) compiled by CC.\n"
+    N_("%s%s%s version %s (%s) compiled by CC.\n")
+#endif
+    ;
+  static const char fmt2[] =
+    N_("%s%sGGC heuristics: --param ggc-min-expand=%d --param ggc-min-heapsize=%d\n");
+#ifndef __VERSION__
+#define __VERSION__ "[?]"
 #endif
-          , indent, *indent != 0 ? " " : "",
+  fprintf (file,
+          file == stderr ? _(fmt1) : fmt1,
+          indent, *indent != 0 ? " " : "",
           lang_hooks.name, version_string, TARGET_NAME,
           indent, __VERSION__);
-  fnotice (file, "%s%sGGC heuristics: --param ggc-min-expand=%d --param ggc-min-heapsize=%d\n",
+  fprintf (file,
+          file == stderr ? _(fmt2) : fmt2,
           indent, *indent != 0 ? " " : "",
           PARAM_VALUE (GGC_MIN_EXPAND), PARAM_VALUE (GGC_MIN_HEAPSIZE));
 }
@@ -1328,48 +1192,10 @@ print_switch_values (FILE *file, int pos, int max,
                             _("options enabled: "), "");
 
   for (j = 0; j < cl_options_count; j++)
-    {
-      if (!cl_options[j].flag_var
-         || !(cl_options[j].flags & CL_REPORT))
-       continue;
-
-      if (cl_options[j].has_set_value)
-       {
-         if (*cl_options[j].flag_var != cl_options[j].set_value)
-           continue;
-       }
-      else
-       {
-         if (!*cl_options[j].flag_var)
-           continue;
-       }
-      
+    if ((cl_options[j].flags & CL_REPORT)
+       && option_enabled (j) > 0)
       pos = print_single_switch (file, pos, max, indent, sep, term,
                                 "", cl_options[j].opt_text);
-    }
-
-  /* Print target specific options.  */
-
-  for (j = 0; j < ARRAY_SIZE (target_switches); j++)
-    if (target_switches[j].name[0] != '\0'
-       && target_switches[j].value > 0
-       && ((target_switches[j].value & target_flags)
-           == target_switches[j].value))
-      {
-       pos = print_single_switch (file, pos, max, indent, sep, term,
-                                  "-m", target_switches[j].name);
-      }
-
-#ifdef TARGET_OPTIONS
-  for (j = 0; j < ARRAY_SIZE (target_options); j++)
-    if (*target_options[j].variable != NULL)
-      {
-       char prefix[256];
-       sprintf (prefix, "-m%s", target_options[j].prefix);
-       pos = print_single_switch (file, pos, max, indent, sep, term,
-                                  prefix, *target_options[j].variable);
-      }
-#endif
 
   fprintf (file, "%s", term);
 }
@@ -1402,11 +1228,6 @@ init_asm_output (const char *name)
        fatal_error ("can%'t open %s for writing: %m", asm_file_name);
     }
 
-#ifdef IO_BUFFER_SIZE
-  setvbuf (asm_out_file, xmalloc (IO_BUFFER_SIZE),
-          _IOFBF, IO_BUFFER_SIZE);
-#endif
-
   if (!flag_syntax_only)
     {
       targetm.asm_out.file_start ();
@@ -1426,6 +1247,21 @@ init_asm_output (const char *name)
     }
 }
 
+/* Return true if the state of option OPTION should be stored in PCH files
+   and checked by default_pch_valid_p.  Store the option's current state
+   in STATE if so.  */
+
+static inline bool
+option_affects_pch_p (int option, struct cl_option_state *state)
+{
+  if ((cl_options[option].flags & CL_TARGET) == 0)
+    return false;
+  if (cl_options[option].flag_var == &target_flags)
+    if (targetm.check_pch_target_flags)
+      return false;
+  return get_option_state (option, state);
+}
+
 /* Default version of get_pch_validity.
    By default, every flag difference is fatal; that will be mostly right for
    most targets, but completely right for very few.  */
@@ -1433,51 +1269,58 @@ init_asm_output (const char *name)
 void *
 default_get_pch_validity (size_t *len)
 {
-#ifdef TARGET_OPTIONS
+  struct cl_option_state state;
   size_t i;
-#endif
   char *result, *r;
 
-  *len = sizeof (target_flags) + 2;
-#ifdef TARGET_OPTIONS
-  for (i = 0; i < ARRAY_SIZE (target_options); i++)
-    {
-      *len += 1;
-      if (*target_options[i].variable)
-       *len += strlen (*target_options[i].variable);
-    }
-#endif
+  *len = 2;
+  if (targetm.check_pch_target_flags)
+    *len += sizeof (target_flags);
+  for (i = 0; i < cl_options_count; i++)
+    if (option_affects_pch_p (i, &state))
+      *len += state.size;
 
   result = r = xmalloc (*len);
   r[0] = flag_pic;
   r[1] = flag_pie;
   r += 2;
-  memcpy (r, &target_flags, sizeof (target_flags));
-  r += sizeof (target_flags);
-
-#ifdef TARGET_OPTIONS
-  for (i = 0; i < ARRAY_SIZE (target_options); i++)
+  if (targetm.check_pch_target_flags)
     {
-      const char *str = *target_options[i].variable;
-      size_t l;
-      if (! str)
-       str = "";
-      l = strlen (str) + 1;
-      memcpy (r, str, l);
-      r += l;
+      memcpy (r, &target_flags, sizeof (target_flags));
+      r += sizeof (target_flags);
     }
-#endif
+
+  for (i = 0; i < cl_options_count; i++)
+    if (option_affects_pch_p (i, &state))
+      {
+       memcpy (r, state.data, state.size);
+       r += state.size;
+      }
 
   return result;
 }
 
+/* Return a message which says that a PCH file was created with a different
+   setting of OPTION.  */
+
+static const char *
+pch_option_mismatch (const char *option)
+{
+  char *r;
+
+  asprintf (&r, _("created and used with differing settings of '%s'"), option);
+  if (r == NULL)
+    return _("out of memory");
+  return r;
+}
+
 /* Default version of pch_valid_p.  */
 
 const char *
 default_pch_valid_p (const void *data_p, size_t len)
 {
+  struct cl_option_state state;
   const char *data = (const char *)data_p;
-  const char *flag_that_differs = NULL;
   size_t i;
 
   /* -fpic and -fpie also usually make a PCH invalid.  */
@@ -1488,82 +1331,73 @@ default_pch_valid_p (const void *data_p, size_t len)
   data += 2;
 
   /* Check target_flags.  */
-  if (memcmp (data, &target_flags, sizeof (target_flags)) != 0)
+  if (targetm.check_pch_target_flags)
     {
-      for (i = 0; i < ARRAY_SIZE (target_switches); i++)
-       {
-         int bits;
-         int tf;
-
-         memcpy (&tf, data, sizeof (target_flags));
-
-         bits = target_switches[i].value;
-         if (bits < 0)
-           bits = -bits;
-         if ((target_flags & bits) != (tf & bits))
-           {
-             flag_that_differs = target_switches[i].name;
-             goto make_message;
-           }
-       }
-      gcc_unreachable ();
+      int tf;
+      const char *r;
+
+      memcpy (&tf, data, sizeof (target_flags));
+      data += sizeof (target_flags);
+      len -= sizeof (target_flags);
+      r = targetm.check_pch_target_flags (tf);
+      if (r != NULL)
+       return r;
     }
-  data += sizeof (target_flags);
-  len -= sizeof (target_flags);
 
-  /* Check string options.  */
-#ifdef TARGET_OPTIONS
-  for (i = 0; i < ARRAY_SIZE (target_options); i++)
-    {
-      const char *str = *target_options[i].variable;
-      size_t l;
-      if (! str)
-       str = "";
-      l = strlen (str) + 1;
-      if (len < l || memcmp (data, str, l) != 0)
-       {
-         flag_that_differs = target_options[i].prefix;
-         goto make_message;
-       }
-      data += l;
-      len -= l;
-    }
-#endif
+  for (i = 0; i < cl_options_count; i++)
+    if (option_affects_pch_p (i, &state))
+      {
+       if (memcmp (data, state.data, state.size) != 0)
+         return pch_option_mismatch (cl_options[i].opt_text);
+       data += state.size;
+       len -= state.size;
+      }
 
   return NULL;
-
- make_message:
-  {
-    char *r;
-    asprintf (&r, _("created and used with differing settings of '-m%s'"),
-                 flag_that_differs);
-    if (r == NULL)
-      return _("out of memory");
-    return r;
-  }
 }
 
 /* Default tree printer.   Handles declarations only.  */
 static bool
-default_tree_printer (pretty_printer * pp, text_info *text)
+default_tree_printer (pretty_printer * pp, text_info *text, const char *spec,
+                     int precision, bool wide, bool set_locus, bool hash)
 {
-  switch (*text->format_spec)
+  tree t;
+
+  /* FUTURE: %+x should set the locus.  */
+  if (precision != 0 || wide || hash)
+    return false;
+
+  switch (*spec)
     {
     case 'D':
+      t = va_arg (*text->args_ptr, tree);
+      if (DECL_DEBUG_EXPR_IS_FROM (t) && DECL_DEBUG_EXPR (t))
+       t = DECL_DEBUG_EXPR (t);
+      break;
+
     case 'F':
     case 'T':
-      {
-        tree t = va_arg (*text->args_ptr, tree);
-        const char *n = DECL_NAME (t)
-          ? lang_hooks.decl_printable_name (t, 2)
-          : "<anonymous>";
-        pp_string (pp, n);
-      }
-      return true;
+      t = va_arg (*text->args_ptr, tree);
+      break;
 
     default:
       return false;
     }
+
+  if (set_locus && text->locus)
+    *text->locus = DECL_SOURCE_LOCATION (t);
+
+  if (DECL_P (t))
+    {
+      const char *n = DECL_NAME (t)
+        ? lang_hooks.decl_printable_name (t, 2)
+        : "<anonymous>";
+      pp_string (pp, n);
+    }
+  else
+    dump_generic_node (pp, t, 0, 0, 0);
+
+  return true;
 }
 
 /* Initialization of the front end environment, before command line
@@ -1583,6 +1417,9 @@ general_init (const char *argv0)
 
   hex_init ();
 
+  /* Unlock the stdio streams.  */
+  unlock_std_streams ();
+
   gcc_init_libintl ();
 
   /* Initialize the diagnostics reporting machinery, so option parsing
@@ -1630,7 +1467,7 @@ general_init (const char *argv0)
 
   /* This must be done after add_params but before argument processing.  */
   init_ggc_heuristics();
-  init_tree_optimization_passes ();
+  init_optimization_passes ();
 }
 
 /* Process the options that have been parsed.  */
@@ -1689,9 +1526,15 @@ process_options (void)
   if (flag_unroll_all_loops)
     flag_unroll_loops = 1;
 
-  /* The loop unrolling code assumes that cse will be run after loop.  */
-  if (flag_unroll_loops || flag_peel_loops)
-    flag_rerun_cse_after_loop = 1;
+  /* The loop unrolling code assumes that cse will be run after loop.
+     web and rename-registers also help when run after loop unrolling.  */
+
+  if (flag_rerun_cse_after_loop == AUTODETECT_VALUE)
+    flag_rerun_cse_after_loop = flag_unroll_loops || flag_peel_loops;
+  if (flag_web == AUTODETECT_VALUE)
+    flag_web = flag_unroll_loops || flag_peel_loops;
+  if (flag_rename_registers == AUTODETECT_VALUE)
+    flag_rename_registers = flag_unroll_loops || flag_peel_loops;
 
   /* If explicitly asked to run new loop optimizer, switch off the old
      one.  */
@@ -1719,30 +1562,16 @@ process_options (void)
   if (flag_value_profile_transformations)
     flag_profile_values = 1;
 
-  /* Speculative prefetching implies the value profiling.  We also switch off
-     the prefetching in the loop optimizer, so that we do not emit double
-     prefetches.  TODO -- we should teach these two to cooperate; the loop
-     based prefetching may sometimes do a better job, especially in connection
-     with reuse analysis.  */
-  if (flag_speculative_prefetching)
-    {
-      flag_profile_values = 1;
-      flag_prefetch_loop_arrays = 0;
-    }
-
   /* Warn about options that are not supported on this machine.  */
 #ifndef INSN_SCHEDULING
   if (flag_schedule_insns || flag_schedule_insns_after_reload)
-    warning ("instruction scheduling not supported on this target machine");
+    warning (0, "instruction scheduling not supported on this target machine");
 #endif
 #ifndef DELAY_SLOTS
   if (flag_delayed_branch)
-    warning ("this target machine does not have delayed branches");
+    warning (0, "this target machine does not have delayed branches");
 #endif
 
-  if (flag_tree_based_profiling && flag_profile_values)
-    sorry ("value-based profiling not yet implemented in trees.");
-
   user_label_prefix = USER_LABEL_PREFIX;
   if (flag_leading_underscore != -1)
     {
@@ -1754,7 +1583,7 @@ process_options (void)
          user_label_prefix = flag_leading_underscore ? "_" : "";
        }
       else
-       warning ("-f%sleading-underscore not supported on this target machine",
+       warning (0, "-f%sleading-underscore not supported on this target machine",
                 flag_leading_underscore ? "" : "no-");
     }
 
@@ -1840,20 +1669,20 @@ process_options (void)
       if (flag_var_tracking == 1)
         {
          if (debug_info_level < DINFO_LEVEL_NORMAL)
-           warning ("variable tracking requested, but useless unless "
+           warning (0, "variable tracking requested, but useless unless "
                     "producing debug info");
          else
-           warning ("variable tracking requested, but not supported "
+           warning (0, "variable tracking requested, but not supported "
                     "by this debug format");
        }
       flag_var_tracking = 0;
     }
 
-  if (flag_rename_registers == AUTODETECT_FLAG_VAR_TRACKING)
+  if (flag_rename_registers == AUTODETECT_VALUE)
     flag_rename_registers = default_debug_hooks->var_location
                            != do_nothing_debug_hooks.var_location;
 
-  if (flag_var_tracking == AUTODETECT_FLAG_VAR_TRACKING)
+  if (flag_var_tracking == AUTODETECT_VALUE)
     flag_var_tracking = optimize >= 1;
 
   /* If auxiliary info generation is desired, open the output file.
@@ -1870,72 +1699,72 @@ process_options (void)
     {
       if (flag_function_sections)
        {
-         warning ("-ffunction-sections not supported for this target");
+         warning (0, "-ffunction-sections not supported for this target");
          flag_function_sections = 0;
        }
       if (flag_data_sections)
        {
-         warning ("-fdata-sections not supported for this target");
+         warning (0, "-fdata-sections not supported for this target");
          flag_data_sections = 0;
        }
     }
 
   if (flag_function_sections && profile_flag)
     {
-      warning ("-ffunction-sections disabled; it makes profiling impossible");
+      warning (0, "-ffunction-sections disabled; it makes profiling impossible");
       flag_function_sections = 0;
     }
 
 #ifndef HAVE_prefetch
   if (flag_prefetch_loop_arrays)
     {
-      warning ("-fprefetch-loop-arrays not supported for this target");
+      warning (0, "-fprefetch-loop-arrays not supported for this target");
       flag_prefetch_loop_arrays = 0;
     }
-  if (flag_speculative_prefetching)
-    {
-      if (flag_speculative_prefetching_set)
-       warning ("-fspeculative-prefetching not supported for this target");
-      flag_speculative_prefetching = 0;
-    }
 #else
   if (flag_prefetch_loop_arrays && !HAVE_prefetch)
     {
-      warning ("-fprefetch-loop-arrays not supported for this target (try -march switches)");
+      warning (0, "-fprefetch-loop-arrays not supported for this target (try -march switches)");
       flag_prefetch_loop_arrays = 0;
     }
-  if (flag_speculative_prefetching && !HAVE_prefetch)
-    {
-      if (flag_speculative_prefetching_set)
-       warning ("-fspeculative-prefetching not supported for this target (try -march switches)");
-      flag_speculative_prefetching = 0;
-    }
 #endif
 
   /* This combination of options isn't handled for i386 targets and doesn't
      make much sense anyway, so don't allow it.  */
   if (flag_prefetch_loop_arrays && optimize_size)
     {
-      warning ("-fprefetch-loop-arrays is not supported with -Os");
+      warning (0, "-fprefetch-loop-arrays is not supported with -Os");
       flag_prefetch_loop_arrays = 0;
     }
 
 #ifndef OBJECT_FORMAT_ELF
   if (flag_function_sections && write_symbols != NO_DEBUG)
-    warning ("-ffunction-sections may affect debugging on some targets");
+    warning (0, "-ffunction-sections may affect debugging on some targets");
 #endif
 
   /* The presence of IEEE signaling NaNs, implies all math can trap.  */
   if (flag_signaling_nans)
     flag_trapping_math = 1;
+
+  /* With -fcx-limited-range, we do cheap and quick complex arithmetic.  */
+  if (flag_cx_limited_range)
+    flag_complex_method = 0;
+
+  /* Targets must be able to place spill slots at lower addresses.  If the
+     target already uses a soft frame pointer, the transition is trivial.  */
+  if (!FRAME_GROWS_DOWNWARD && flag_stack_protect)
+    {
+      warning (0, "-fstack-protector not supported for this target");
+      flag_stack_protect = 0;
+    }
+  if (!flag_stack_protect)
+    warn_stack_protect = 0;
 }
 
 /* Initialize the compiler back end.  */
 static void
 backend_init (void)
 {
-  init_adjust_machine_modes ();
-
   init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
                  || debug_info_level == DINFO_LEVEL_VERBOSE
 #ifdef VMS_DEBUGGING_INFO
@@ -1944,12 +1773,12 @@ backend_init (void)
 #endif
                    || flag_test_coverage);
 
+  init_rtlanal ();
   init_regs ();
   init_fake_stack_mems ();
   init_alias_once ();
   init_loop ();
   init_reload ();
-  init_function_once ();
   init_varasm_once ();
 
   /* The following initialization functions need to generate rtl, so
@@ -2071,6 +1900,11 @@ do_compile (void)
   /* Don't do any more if an error has already occurred.  */
   if (!errorcount)
     {
+      /* This must be run always, because it is needed to compute the FP
+        predefined macros, such as __LDBL_MAX__, for targets using non
+        default FP formats.  */
+      init_adjust_machine_modes ();
+
       /* Set up the back-end if requested.  */
       if (!no_backend)
        backend_init ();