OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / opts.c
index e058369..a2df41a 100644 (file)
@@ -1,5 +1,5 @@
 /* Command line option handling.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
    Contributed by Neil Booth.
 
 This file is part of GCC.
@@ -37,6 +37,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "diagnostic.h"
 #include "tm_p.h"              /* For OPTIMIZATION_OPTIONS.  */
 #include "insn-attr.h"         /* For INSN_SCHEDULING.  */
+#include "target.h"
 
 /* Value of the -G xx switch, and whether it was passed or not.  */
 unsigned HOST_WIDE_INT g_switch_value;
@@ -99,7 +100,7 @@ bool warn_shadow;
 
 /* Nonzero means warn about constructs which might not be
    strict-aliasing safe.  */
-bool warn_strict_aliasing;
+int warn_strict_aliasing;
 
 /* True to warn if a switch on an enum, that does not have a default
    case, fails to have a case for every enum value.  */
@@ -402,7 +403,7 @@ handle_option (const char **argv, unsigned int lang_mask)
 
   if (arg == NULL && (option->flags & (CL_JOINED | CL_SEPARATE)))
     {
-      if (!(*lang_hooks.missing_argument) (opt, opt_index))
+      if (!lang_hooks.missing_argument (opt, opt_index))
        error ("missing argument to \"%s\"", opt);
       goto done;
     }
@@ -420,7 +421,7 @@ handle_option (const char **argv, unsigned int lang_mask)
     }
 
   if (option->flags & lang_mask)
-    if ((*lang_hooks.handle_option) (opt_index, arg, value) == 0)
+    if (lang_hooks.handle_option (opt_index, arg, value) == 0)
       result = 0;
 
   if (result && (option->flags & CL_COMMON))
@@ -448,7 +449,8 @@ handle_options (unsigned int argc, const char **argv, unsigned int lang_mask)
       /* Interpret "-" or a non-switch as a file name.  */
       if (opt[0] != '-' || opt[1] == '\0')
        {
-         main_input_filename = opt;
+         if (main_input_filename == NULL)
+           main_input_filename = opt;
          add_input_filename (opt);
          n = 1;
          continue;
@@ -481,7 +483,7 @@ decode_options (unsigned int argc, const char **argv)
   unsigned int i, lang_mask;
 
   /* Perform language-specific options initialization.  */
-  lang_mask = (*lang_hooks.init_options) (argc, argv);
+  lang_mask = lang_hooks.init_options (argc, argv);
 
   lang_hooks.initialize_diagnostics (global_dc);
 
@@ -536,13 +538,13 @@ decode_options (unsigned int argc, const char **argv)
       flag_guess_branch_prob = 1;
       flag_cprop_registers = 1;
       flag_loop_optimize = 1;
-      flag_crossjumping = 1;
       flag_if_conversion = 1;
       flag_if_conversion2 = 1;
     }
 
   if (optimize >= 2)
     {
+      flag_crossjumping = 1;
       flag_optimize_sibling_calls = 1;
       flag_cse_follow_jumps = 1;
       flag_cse_skip_blocks = 1;
@@ -572,6 +574,7 @@ decode_options (unsigned int argc, const char **argv)
       flag_rename_registers = 1;
       flag_unswitch_loops = 1;
       flag_web = 1;
+      flag_gcse_after_reload = 1;
     }
 
   if (optimize < 2 || optimize_size)
@@ -589,14 +592,22 @@ decode_options (unsigned int argc, const char **argv)
         or less automatically remove extra jumps, but would also try to
         use more short jumps instead of long jumps.  */
       flag_reorder_blocks = 0;
+      flag_reorder_blocks_and_partition = 0;
+    }
+
+  if (optimize_size)
+    {
+      /* Inlining of very small functions usually reduces total size.  */
+      set_param_value ("max-inline-insns-single", 5);
+      set_param_value ("max-inline-insns-auto", 5);
+      set_param_value ("max-inline-insns-rtl", 10);
+      flag_inline_functions = 1;
     }
 
   /* Initialize whether `char' is signed.  */
   flag_signed_char = DEFAULT_SIGNED_CHAR;
-#ifdef DEFAULT_SHORT_ENUMS
   /* Initialize how much space enums occupy, by default.  */
-  flag_short_enums = DEFAULT_SHORT_ENUMS;
-#endif
+  flag_short_enums = targetm.default_short_enums ();
 
   /* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
      modify it.  */
@@ -647,6 +658,19 @@ decode_options (unsigned int argc, const char **argv)
 
   if (flag_really_no_inline == 2)
     flag_really_no_inline = flag_no_inline;
+
+  /* The optimization to partition hot and cold basic blocks into separate
+     sections of the .o and executable files does not work (currently)
+     with exception handling.  If flag_exceptions is turned on we need to
+     turn off the partitioning optimization.  */
+
+  if (flag_exceptions && flag_reorder_blocks_and_partition)
+    {
+      warning 
+           ("-freorder-blocks-and-partition does not work with exceptions");
+      flag_reorder_blocks_and_partition = 0;
+      flag_reorder_blocks = 1;
+    }
 }
 
 /* Handle target- and language-independent options.  Return zero to
@@ -746,6 +770,7 @@ common_handle_option (size_t scode, const char *arg,
       break;
 
     case OPT_Wstrict_aliasing:
+    case OPT_Wstrict_aliasing_:
       warn_strict_aliasing = value;
       break;
 
@@ -832,6 +857,10 @@ common_handle_option (size_t scode, const char *arg,
       flag_pie = value + value;
       break;
 
+    case OPT_fabi_version_:
+      flag_abi_version = value;
+      break;
+
     case OPT_falign_functions:
       align_functions = !value;
       break;
@@ -901,6 +930,10 @@ common_handle_option (size_t scode, const char *arg,
       flag_branch_target_load_optimize2 = value;
       break;
 
+    case OPT_fbtr_bb_exclusive:
+      flag_btr_bb_exclusive = value;
+      break;
+
     case OPT_fcall_used_:
       fix_register (arg, 0, 1);
       break;
@@ -1027,6 +1060,10 @@ common_handle_option (size_t scode, const char *arg,
       flag_gcse_sm = value;
       break;
 
+    case OPT_fgcse_after_reload:
+      flag_gcse_after_reload = value;
+      break;
+
     case OPT_fgcse_las:
       flag_gcse_las = value;
       break;
@@ -1245,6 +1282,10 @@ common_handle_option (size_t scode, const char *arg,
       flag_reorder_blocks = value;
       break;
 
+    case OPT_freorder_blocks_and_partition:
+      flag_reorder_blocks_and_partition = value;
+      break;
+  
     case OPT_freorder_functions:
       flag_reorder_functions = value;
       break;
@@ -1431,6 +1472,10 @@ common_handle_option (size_t scode, const char *arg,
       flag_unwind_tables = value;
       break;
 
+    case OPT_fvar_tracking:
+      flag_var_tracking = value;
+      break;
+
     case OPT_fverbose_asm:
       flag_verbose_asm = value;
       break;
@@ -1443,10 +1488,6 @@ common_handle_option (size_t scode, const char *arg,
       flag_wrapv = value;
       break;
 
-    case OPT_fwritable_strings:
-      flag_writable_strings = value;
-      break;
-
     case OPT_fzero_initialized_in_bss:
       flag_zero_initialized_in_bss = value;
       break;