OSDN Git Service

* config/s390/s390.c (s390_emit_epilogue): Always restore registers
[pf3gnuchains/gcc-fork.git] / gcc / toplev.c
index 86d4d60..07dc649 100644 (file)
@@ -126,6 +126,9 @@ static int print_single_switch PARAMS ((FILE *, int, int, const char *,
 static void print_switch_values PARAMS ((FILE *, int, int, const char *,
                                       const char *, const char *));
 
+/* Nonzero to dump debug info whilst parsing (-dy option).  */
+static int set_yydebug;
+
 /* Length of line when printing switch values.  */
 #define MAX_LINE 75
 
@@ -349,11 +352,6 @@ tree current_function_decl;
    if none.  */
 tree current_function_func_begin_label;
 
-/* Pointer to function to finish handling an incomplete decl at the
-   end of compilation.  */
-
-void (*incomplete_decl_finalize_hook) PARAMS ((tree)) = 0;
-
 /* Nonzero if doing dwarf2 duplicate elimination.  */
 
 int flag_eliminate_dwarf2_dups = 0;
@@ -641,12 +639,12 @@ int flag_keep_inline_functions;
 
 /* Nonzero means that functions will not be inlined.  */
 
-int flag_no_inline;
+int flag_no_inline = 2;
 
 /* Nonzero means that we don't want inlining by virtue of -fno-inline,
    not just because the tree inliner turned us off.  */
 
-int flag_really_no_inline;
+int flag_really_no_inline = 2;
 
 /* Nonzero means that we should emit static const variables
    regardless of whether or not optimization is turned on.  */
@@ -1822,9 +1820,8 @@ wrapup_global_declarations (vec, len)
       /* We're not deferring this any longer.  */
       DECL_DEFER_OUTPUT (decl) = 0;
 
-      if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
-         && incomplete_decl_finalize_hook != 0)
-       (*incomplete_decl_finalize_hook) (decl);
+      if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0)
+       (*lang_hooks.finish_incomplete_decl) (decl);
     }
 
   /* Now emit any global variables or functions that we have been
@@ -1951,22 +1948,19 @@ check_global_declarations (vec, len)
          assemble_external (decl);
        }
 
-      /* Warn about static fns or vars defined but not used,
-        but not about inline functions or static consts
-        since defining those in header files is normal practice.  */
-      if (((warn_unused_function
-           && TREE_CODE (decl) == FUNCTION_DECL && ! DECL_INLINE (decl))
-          || (warn_unused_variable
-              && TREE_CODE (decl) == VAR_DECL && ! TREE_READONLY (decl)))
-         && ! DECL_IN_SYSTEM_HEADER (decl)
+      /* Warn about static fns or vars defined but not used.  */
+      if (((warn_unused_function && TREE_CODE (decl) == FUNCTION_DECL)
+          || (warn_unused_variable && TREE_CODE (decl) == VAR_DECL))
+         && ! TREE_USED (decl)
+         /* The TREE_USED bit for file-scope decls is kept in the identifier,
+            to handle multiple external decls in different scopes.  */
+         && ! TREE_USED (DECL_NAME (decl))
          && ! DECL_EXTERNAL (decl)
          && ! TREE_PUBLIC (decl)
-         && ! TREE_USED (decl)
-         && (TREE_CODE (decl) == FUNCTION_DECL || ! DECL_REGISTER (decl))
-         /* The TREE_USED bit for file-scope decls
-            is kept in the identifier, to handle multiple
-            external decls in different scopes.  */
-         && ! TREE_USED (DECL_NAME (decl)))
+         /* Global register variables must be declared to reserve them.  */
+         && ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
+         /* Otherwise, ask the language.  */
+         && (*lang_hooks.decls.warn_unused_global) (decl))
        warning_with_decl (decl, "`%s' defined but not used");
 
       timevar_push (TV_SYMOUT);
@@ -2038,7 +2032,7 @@ compile_file ()
 
   /* Call the parser, which parses the entire file (calling
      rest_of_compilation for each function).  */
-  (*lang_hooks.parse_file) ();
+  (*lang_hooks.parse_file) (set_yydebug);
 
   /* In case there were missing block closers,
      get us back to the global binding level.  */
@@ -2383,6 +2377,7 @@ rest_of_compilation (decl)
       if (inlinable
          || (DECL_INLINE (decl)
              && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
+                  && ! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
                   && ! flag_keep_inline_functions)
                  || DECL_EXTERNAL (decl))))
        DECL_DEFER_OUTPUT (decl) = 1;
@@ -2811,8 +2806,7 @@ rest_of_compilation (decl)
          cleanup_barriers ();
 
          /* We only want to perform unrolling once.  */
-
-         loop_optimize (insns, rtl_dump_file, 0);
+         loop_optimize (insns, rtl_dump_file, LOOP_FIRST_PASS);
 
          /* The first call to loop_optimize makes some instructions
             trivially dead.  We delete those instructions now in the
@@ -2856,7 +2850,8 @@ rest_of_compilation (decl)
 
      life_analyzis rarely eliminates modification of external memory.
    */
-  mark_constant_function ();
+  if (optimize)
+    mark_constant_function ();
 
   close_dump_file (DFI_cfg, print_rtl_with_bb, insns);
 
@@ -3729,7 +3724,7 @@ decode_d_option (arg)
        rtl_dump_and_exit = 1;
        break;
       case 'y':
-       (*lang_hooks.set_yydebug) (1);
+       set_yydebug = 1;
        break;
       case 'D':        /* These are handled by the preprocessor.  */
       case 'I':
@@ -3981,7 +3976,7 @@ ignoring option `%s' due to invalid debug level specification",
 
              if (da_len > 1 && strncmp (arg, "gdb", da_len) == 0)
                {
-#if defined (DWARF2_DEBUGGING_INFO) && !defined (LINKER_DOES_NOT_WORK_WITH_DWARF2)
+#ifdef DWARF2_DEBUGGING_INFO
                  type = DWARF2_DEBUG;
 #else
 #ifdef DBX_DEBUGGING_INFO
@@ -4725,6 +4720,11 @@ parse_options_and_default_flags (argc, argv)
        }
     }
 
+  if (flag_no_inline == 2)
+    flag_no_inline = 0;
+  else
+    flag_really_no_inline = flag_no_inline;
+
   /* Set flag_no_inline before the post_options () hook.  The C front
      ends use it to determine tree inlining defaults.  FIXME: such
      code should be lang-independent when all front ends use tree
@@ -4744,6 +4744,9 @@ parse_options_and_default_flags (argc, argv)
        warning ("-Wuninitialized is not supported without -O");
     }
 
+  if (flag_really_no_inline == 2)
+    flag_really_no_inline = flag_no_inline;
+
   /* All command line options have been parsed; allow the front end to
      perform consistency checks, etc.  */
   (*lang_hooks.post_options) ();