OSDN Git Service

* aclocal.m4: Fixed typo.
[pf3gnuchains/gcc-fork.git] / gcc / toplev.c
index 14a9fd0..74b43de 100644 (file)
@@ -64,6 +64,7 @@ Boston, MA 02111-1307, USA.  */
 #include "ssa.h"
 #include "params.h"
 #include "reload.h"
+#include "dwarf2asm.h"
 
 #ifdef DWARF_DEBUGGING_INFO
 #include "dwarfout.h"
@@ -1420,7 +1421,7 @@ int warn_cast_align;
    characters.  The value N is in `id_clash_len'.  */
 
 int warn_id_clash;
-int id_clash_len;
+unsigned int id_clash_len;
 
 /* Nonzero means warn about any objects definitions whose size is larger
    than N bytes.  Also want about function definitions whose returned
@@ -1611,29 +1612,6 @@ floor_log2_wide (x)
   return log;
 }
 
-/* Return the approximate positive square root of a number N.  This is for
-   statistical reports, not code generation.  */
-double
-approx_sqrt (x)
-     double x;
-{
-  double s, d;
-
-  if (x < 0)
-    abort ();
-  if (x == 0)
-    return 0;
-
-  s = x;
-  do
-    {
-      d = (s * s - x) / (2 * s);
-      s -= d;
-    }
-  while (d > .0001);
-  return s;
-}
-
 static int float_handler_set;
 int float_handled;
 jmp_buf float_handler;
@@ -1948,7 +1926,7 @@ wrapup_global_declarations (vec, len)
                  || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))))
            {
              reconsider = 1;
-             rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
+             rest_of_decl_compilation (decl, NULL, 1, 1);
            }
 
          if (TREE_CODE (decl) == FUNCTION_DECL
@@ -2149,6 +2127,31 @@ compile_file (name)
   init_timevar ();
   timevar_start (TV_TOTAL);
 
+  /* Open assembler code output file.  Do this even if -fsyntax-only is on,
+     because then the driver will have provided the name of a temporary
+     file or bit bucket for us.  */
+
+  if (! name_specified && asm_file_name == 0)
+    asm_out_file = stdout;
+  else
+    {
+      if (asm_file_name == 0)
+        {
+          int len = strlen (dump_base_name);
+          char *dumpname = (char *) xmalloc (len + 6);
+          memcpy (dumpname, dump_base_name, len + 1);
+          strip_off_ending (dumpname, len);
+          strcat (dumpname, ".s");
+          asm_file_name = dumpname;
+        }
+      if (!strcmp (asm_file_name, "-"))
+        asm_out_file = stdout;
+      else
+        asm_out_file = fopen (asm_file_name, "w");
+      if (asm_out_file == 0)
+       fatal_io_error ("can't open %s for writing", asm_file_name);
+    }
+
   /* Initialize data in various passes.  */
 
   init_obstacks ();
@@ -2189,31 +2192,6 @@ compile_file (name)
        fatal_io_error ("can't open %s", aux_info_file_name);
     }
 
-  /* Open assembler code output file.  Do this even if -fsyntax-only is on,
-     because then the driver will have provided the name of a temporary
-     file or bit bucket for us.  */
-
-  if (! name_specified && asm_file_name == 0)
-    asm_out_file = stdout;
-  else
-    {
-      if (asm_file_name == 0)
-        {
-          int len = strlen (dump_base_name);
-          char *dumpname = (char *) xmalloc (len + 6);
-          memcpy (dumpname, dump_base_name, len + 1);
-          strip_off_ending (dumpname, len);
-          strcat (dumpname, ".s");
-          asm_file_name = dumpname;
-        }
-      if (!strcmp (asm_file_name, "-"))
-        asm_out_file = stdout;
-      else
-        asm_out_file = fopen (asm_file_name, "w");
-      if (asm_out_file == 0)
-       fatal_io_error ("can't open %s for writing", asm_file_name);
-    }
-
 #ifdef IO_BUFFER_SIZE
   setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
            _IOFBF, IO_BUFFER_SIZE);
@@ -2404,6 +2382,8 @@ compile_file (name)
 
   /* Output some stuff at end of file if nec.  */
 
+  dw2_output_indirect_constants ();
+
   end_final (dump_base_name);
 
   if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
@@ -2734,7 +2714,7 @@ rest_of_compilation (decl)
          }
 
       /* If requested, consider whether to make this function inline.  */
-      if ((DECL_INLINE (decl) && !flag_no_inline) 
+      if ((DECL_INLINE (decl) && !flag_no_inline)
          || flag_inline_functions)
        {
          timevar_push (TV_INTEGRATION);
@@ -3108,7 +3088,7 @@ rest_of_compilation (decl)
          timevar_pop (TV_CSE);
          cse_not_expected = !flag_rerun_cse_after_loop;
        }
-      
+
       /* If gcse or cse altered any jumps, rerun jump optimizations to clean
         things up.  Then possibly re-run CSE again.  */
       while (tem || tem2)
@@ -3374,7 +3354,7 @@ rest_of_compilation (decl)
 #ifdef OPTIMIZE_MODE_SWITCHING
   timevar_push (TV_GCSE);
 
-  if (optimize_mode_switching (NULL_PTR))
+  if (optimize_mode_switching (NULL))
     {
       /* We did work, and so had to regenerate global life information.
         Take advantage of this and don't re-recompute register life
@@ -3721,9 +3701,19 @@ rest_of_compilation (decl)
     final_start_function (insns, asm_out_file, optimize);
     final (insns, asm_out_file, optimize, 0);
     final_end_function (insns, asm_out_file, optimize);
+
+#ifdef IA64_UNWIND_INFO
+    /* ??? The IA-64 ".handlerdata" directive must be issued before
+       the ".endp" directive that closes the procedure descriptor.  */
+    output_function_exception_table ();
+#endif
+
     assemble_end_function (decl, fnname);
 
+#ifndef IA64_UNWIND_INFO
+    /* Otherwise, it feels unclean to switch sections in the middle.  */
     output_function_exception_table ();
+#endif
 
     if (! quiet_flag)
       fflush (asm_out_file);
@@ -4105,7 +4095,7 @@ decode_f_option (arg)
   else if ((option_value = skip_leading_substring (arg, "inline-limit-"))
           || (option_value = skip_leading_substring (arg, "inline-limit=")))
     {
-      int val = 
+      int val =
        read_integral_parameter (option_value, arg - 2,
                                 MAX_INLINE_INSNS);
       set_param_value ("max-inline-insns", val);
@@ -4410,9 +4400,9 @@ independent_decode_option (argc, argv)
       arg = argv[1];
       /* Look for the `='.  */
       equal = strchr (arg, '=');
-      if (!equal) 
+      if (!equal)
        error ("invalid --param option: %s", arg);
-      else 
+      else
        {
          int val;
 
@@ -4428,7 +4418,7 @@ independent_decode_option (argc, argv)
 
       return 2;
     }
-      
+
   if (*arg == 'Y')
     arg++;
 
@@ -4595,7 +4585,7 @@ independent_decode_option (argc, argv)
    Decode command args, then call compile_file.
    Exit code is FATAL_EXIT_CODE if can't open files or if there were
    any errors, or SUCCESS_EXIT_CODE if compilation succeeded.
-   
+
    It is not safe to call this function more than once.  */
 
 int
@@ -4919,6 +4909,16 @@ toplev_main (argc, argv)
     warning ("this target machine does not have delayed branches");
 #endif
 
+  /* Some operating systems do not allow profiling without a frame
+     pointer.  */
+  if (!TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER
+      && profile_flag
+      && flag_omit_frame_pointer)
+    {
+      error ("profiling does not work without a frame pointer");
+      flag_omit_frame_pointer = 0;
+    }
+    
   user_label_prefix = USER_LABEL_PREFIX;
   if (flag_leading_underscore != -1)
     {