This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Last option moved to opts.c


With this patch all options are handled in opts.c.  It contains a
short-term kludge for -finline-limit-, which I'll address properly
when I get round to doing target options, because the same issue
occurs in a few places there.

There is still some stuff happening in toplev.c, albeit under the
direction of opts.c now, such as handling -g options.  I think I'll
break those up into common.opt switches eventually.

Bootstrapping x86 NetBSD.

Neil.

	* common.opt: Add -finline-limit.
	* opts.c (common_handle_options): Handle it.
	* opts.sh: Temporary kludge for -finline-limit.
	* toplev.c (decode_f_option, independent_decode_option): Die.
	(parse_options_and_default_flags): No independent_decode_option.

Index: common.opt
===================================================================
RCS file: /cvs/gcc/gcc/gcc/common.opt,v
retrieving revision 1.8
diff -u -p -r1.8 common.opt
--- common.opt	22 Jun 2003 13:44:38 -0000	1.8
+++ common.opt	22 Jun 2003 16:02:57 -0000
@@ -307,6 +307,12 @@ Common
 finline-functions
 Common
 
+finline-limit-
+Common RejectNegative Joined UInteger
+
+finline-limit=
+Common RejectNegative Joined UInteger
+
 finstrument-functions
 Common
 
Index: opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/opts.c,v
retrieving revision 1.13
diff -u -p -r1.13 opts.c
--- opts.c	22 Jun 2003 13:44:38 -0000	1.13
+++ opts.c	22 Jun 2003 16:02:57 -0000
@@ -734,6 +734,21 @@ common_handle_option (size_t scode, cons
       flag_inline_functions = value;
       break;
 
+    case OPT_finline_limit_:
+    case OPT_finline_limit_eq:
+      set_param_value ("max-inline-insns", value);
+      set_param_value ("max-inline-insns-single", value / 2);
+      set_param_value ("max-inline-insns-auto", value / 2);
+      set_param_value ("max-inline-insns-rtl", value);
+      if (value / 4 < MIN_INLINE_INSNS)
+	{
+	  if (value / 4 > 10)
+	    set_param_value ("min-inline-insns", value / 4);
+	  else
+	    set_param_value ("min-inline-insns", 10);
+	}
+      break;
+
     case OPT_finstrument_functions:
       flag_instrument_function_entry_exit = value;
       break;
Index: opts.sh
===================================================================
RCS file: /cvs/gcc/gcc/gcc/opts.sh,v
retrieving revision 1.17
diff -u -p -r1.17 opts.sh
--- opts.sh	22 Jun 2003 09:04:57 -0000	1.17
+++ opts.sh	22 Jun 2003 16:02:57 -0000
@@ -114,6 +114,8 @@ ${AWK} '
 
 	    len = length (opts[i]);
 	    enum = "OPT_" opts[i]
+	    if (opts[i] == "finline-limit=")
+		enum = enum "eq"
 	    gsub ("[^A-Za-z0-9]", "_", enum)
 
 	    # If this switch takes joined arguments, back-chain all
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.783
diff -u -p -r1.783 toplev.c
--- toplev.c	22 Jun 2003 13:44:38 -0000	1.783
+++ toplev.c	22 Jun 2003 16:02:59 -0000
@@ -117,9 +117,6 @@ static void crash_signal (int) ATTRIBUTE
 static void setup_core_dumping (void);
 static void compile_file (void);
 
-static int decode_f_option (const char *);
-static unsigned int independent_decode_option (char **);
-
 static int print_single_switch (FILE *, int, int, const char *,
 				const char *, const char *,
 				const char *, const char *);
@@ -4149,39 +4146,6 @@ decode_d_option (const char *arg)
       }
 }
 
-/* Parse a -f... command line switch.  ARG is the value after the -f.
-   It is safe to access 'ARG - 2' to generate the full switch name.
-   Return the number of strings consumed.  */
-
-static int
-decode_f_option (const char *arg)
-{
-  const char *option_value;
-
-  if ((option_value = skip_leading_substring (arg, "inline-limit-"))
-	   || (option_value = skip_leading_substring (arg, "inline-limit=")))
-    {
-      int val =
-	read_integral_parameter (option_value, arg - 2,
-				 MAX_INLINE_INSNS);
-      set_param_value ("max-inline-insns", val);
-      set_param_value ("max-inline-insns-single", val/2);
-      set_param_value ("max-inline-insns-auto", val/2);
-      set_param_value ("max-inline-insns-rtl", val);
-      if (val/4 < MIN_INLINE_INSNS)
-	{
-	  if (val/4 > 10)
-	    set_param_value ("min-inline-insns", val/4);
-	  else
-	    set_param_value ("min-inline-insns", 10);
-	}
-    }
-  else
-    return 0;
-
-  return 1;
-}
-
 /* Indexed by enum debug_info_type.  */
 const char *const debug_type_names[] =
 {
@@ -4306,25 +4270,6 @@ ignoring option `%s' due to invalid debu
     warning ("`-g%s': unknown or unsupported -g option", arg);
 }
 
-/* Decode the first argument in the argv as a language-independent option.
-   Return the number of strings consumed.  */
-
-static unsigned int
-independent_decode_option (char **argv)
-{
-  char *arg = argv[0];
-
-  if (arg[0] != '-' || arg[1] == 0)
-    return 1;
-
-  arg++;
-
-  if (*arg == 'f')
-    return decode_f_option (arg + 1);
-
-  return 0;
-}
-
 /* Decode -m switches.  */
 /* Decode the switch -mNAME.  */
 
@@ -4782,9 +4727,6 @@ parse_options_and_default_flags (int arg
 
       /* Give the language a chance to decode the option for itself.  */
       processed = handle_option (argc - i, argv + i, lang_mask);
-
-      if (!processed)
-	processed = independent_decode_option (argv + i);
 
       if (processed)
 	i += processed;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]