OSDN Git Service

* config/cpu/s390/atomicity.h (__exchange_and_add): Add "memory"
[pf3gnuchains/gcc-fork.git] / gcc / toplev.c
index edfc552..8cfd740 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.
 
@@ -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.  */
@@ -374,6 +374,7 @@ static const param_info lang_independent_params[] = {
   { NULL, 0, 0, 0, NULL }
 };
 
+#ifdef TARGET_SWITCHES
 /* 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.
@@ -387,6 +388,7 @@ static const struct
   const char *const description;
 }
 target_switches[] = TARGET_SWITCHES;
+#endif
 
 /* This table is similar, but allows the switch to have a value.  */
 
@@ -449,7 +451,11 @@ const char *
 get_src_pwd (void)
 {
   if (! src_pwd)
-    src_pwd = getpwd ();
+    {
+      src_pwd = getpwd ();
+      if (!src_pwd)
+       src_pwd = ".";
+    }
 
    return src_pwd;
 }
@@ -775,9 +781,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 ((flag_unit_at_a_time && !cgraph_global_info_ready)
+             else if (node->alias)
+               needed = 0;
+             else if (!cgraph_global_info_ready
                       && (TREE_USED (decl)
                           || TREE_USED (DECL_ASSEMBLER_NAME (decl))))
                /* needed */;
@@ -1003,8 +1011,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 +1042,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.  */
@@ -1053,7 +1066,11 @@ compile_file (void)
 void
 display_target_options (void)
 {
-  int undoc, i;
+  int undoc;
+#if defined (TARGET_SWITCHES) || defined (TARGET_OPTIONS)
+  int i;
+#endif
+  unsigned int cli;
   static bool displayed = false;
 
   /* Avoid double printing for --help --target-help.  */
@@ -1062,18 +1079,26 @@ display_target_options (void)
 
   displayed = true;
 
-  if (ARRAY_SIZE (target_switches) > 1
+  for (cli = 0; cli < cl_options_count; cli++)
+    if ((cl_options[cli].flags & (CL_TARGET | CL_UNDOCUMENTED)) == CL_TARGET)
+      break;
+
+  if (cli < cl_options_count
+#ifdef TARGET_SWITCHES
+      || ARRAY_SIZE (target_switches) > 1
+#endif
 #ifdef TARGET_OPTIONS
       || ARRAY_SIZE (target_options) > 1
 #endif
       )
     {
-      int doc = 0;
+      int doc = cli < cl_options_count;
 
       undoc = 0;
 
       printf (_("\nTarget specific options:\n"));
 
+#ifdef TARGET_SWITCHES
       for (i = ARRAY_SIZE (target_switches); i--;)
        {
          const char *option      = target_switches[i].name;
@@ -1091,6 +1116,7 @@ display_target_options (void)
          else if (*description != 0)
            doc += printf ("  -m%-23s %s\n", option, _(description));
        }
+#endif
 
 #ifdef TARGET_OPTIONS
       for (i = ARRAY_SIZE (target_options); i--;)
@@ -1111,6 +1137,7 @@ display_target_options (void)
            doc += printf ("  -m%-23s %s\n", option, _(description));
        }
 #endif
+      print_filtered_help (CL_TARGET);
       if (undoc)
        {
          if (doc)
@@ -1177,9 +1204,12 @@ const char *const debug_type_names[] =
 void
 set_target_switch (const char *name)
 {
+#if defined (TARGET_SWITCHES) || defined (TARGET_OPTIONS)
   size_t j;
+#endif
   int valid_target_option = 0;
 
+#ifdef TARGET_SWITCHES
   for (j = 0; j < ARRAY_SIZE (target_switches); j++)
     if (!strcmp (target_switches[j].name, name))
       {
@@ -1196,6 +1226,7 @@ set_target_switch (const char *name)
          }
        valid_target_option = 1;
       }
+#endif
 
 #ifdef TARGET_OPTIONS
   if (!valid_target_option)
@@ -1221,7 +1252,7 @@ set_target_switch (const char *name)
       }
 #endif
 
-  if (!valid_target_option)
+  if (name[0] != 0 && !valid_target_option)
     error ("invalid option %qs", name);
 }
 
@@ -1328,28 +1359,14 @@ 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 (&cl_options[j]) > 0)
       pos = print_single_switch (file, pos, max, indent, sep, term,
                                 "", cl_options[j].opt_text);
-    }
 
   /* Print target specific options.  */
 
+#ifdef TARGET_SWITCHES
   for (j = 0; j < ARRAY_SIZE (target_switches); j++)
     if (target_switches[j].name[0] != '\0'
        && target_switches[j].value > 0
@@ -1359,6 +1376,7 @@ print_switch_values (FILE *file, int pos, int max,
        pos = print_single_switch (file, pos, max, indent, sep, term,
                                   "-m", target_switches[j].name);
       }
+#endif
 
 #ifdef TARGET_OPTIONS
   for (j = 0; j < ARRAY_SIZE (target_options); j++)
@@ -1402,11 +1420,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 ();
@@ -1490,12 +1503,13 @@ default_pch_valid_p (const void *data_p, size_t len)
   /* Check target_flags.  */
   if (memcmp (data, &target_flags, sizeof (target_flags)) != 0)
     {
+      int tf;
+
+      memcpy (&tf, data, sizeof (target_flags));
+#ifdef TARGET_SWITCHES
       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)
@@ -1506,6 +1520,14 @@ default_pch_valid_p (const void *data_p, size_t len)
              goto make_message;
            }
        }
+#endif
+      for (i = 0; i < cl_options_count; i++)
+       if (cl_options[i].flag_var == &target_flags
+           && (cl_options[i].var_value & (target_flags ^ tf)) != 0)
+         {
+           flag_that_differs = cl_options[i].opt_text + 2;
+           goto make_message;
+         }
       gcc_unreachable ();
     }
   data += sizeof (target_flags);
@@ -1547,23 +1569,36 @@ default_pch_valid_p (const void *data_p, size_t len)
 static bool
 default_tree_printer (pretty_printer * pp, text_info *text)
 {
+  tree t;
+
   switch (*text->format_spec)
     {
     case 'D':
+      t = va_arg (*text->args_ptr, tree);
+      if (DECL_DEBUG_EXPR (t) && DECL_DEBUG_EXPR_IS_FROM (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 (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
@@ -1740,9 +1775,6 @@ process_options (void)
     warning ("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)
     {
@@ -1928,14 +1960,16 @@ process_options (void)
   /* 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;
 }
 
 /* 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,6 +1978,7 @@ backend_init (void)
 #endif
                    || flag_test_coverage);
 
+  init_rtlanal ();
   init_regs ();
   init_fake_stack_mems ();
   init_alias_once ();
@@ -2071,6 +2106,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 ();