Remove last leftover usage of params* files.
authorMartin Liska <mliska@suse.cz>
Tue, 12 Nov 2019 10:09:57 +0000 (11:09 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Tue, 12 Nov 2019 10:09:57 +0000 (10:09 +0000)
2019-11-12  Martin Liska  <mliska@suse.cz>

* common.opt: Remove param_values.
* config/i386/i386-options.c (ix86_valid_target_attribute_p):
Remove finalize_options_struct.
* gcc.c (driver::decode_argv): Do not call global_init_params
and finish_params.
(driver::finalize): Do not call params_c_finalize
and finalize_options_struct.
* opt-suggestions.c (option_proposer::get_completions): Remove
special casing of params.
(option_proposer::find_param_completions): Remove.
(test_completion_partial_match): Update expected output.
* opt-suggestions.h: Remove find_param_completions.
* opts-common.c (add_misspelling_candidates): Add
--param with a space.
* opts.c (handle_param): Remove.
(init_options_struct):. Remove init_options_struct and
similar calls.
(finalize_options_struct): Remove.
(common_handle_option): Use SET_OPTION_IF_UNSET.
* opts.h (finalize_options_struct): Remove.
* toplev.c (general_init): Do not call global_init_params.
(toplev::finalize): Do not call params_c_finalize and
finalize_options_struct.

From-SVN: r278087

gcc/ChangeLog
gcc/common.opt
gcc/config/i386/i386-options.c
gcc/gcc.c
gcc/opt-suggestions.c
gcc/opt-suggestions.h
gcc/opts-common.c
gcc/opts.c
gcc/opts.h
gcc/toplev.c

index ef51776..1be218c 100644 (file)
@@ -1,5 +1,31 @@
 2019-11-12  Martin Liska  <mliska@suse.cz>
 
+       * common.opt: Remove param_values.
+       * config/i386/i386-options.c (ix86_valid_target_attribute_p):
+       Remove finalize_options_struct.
+       * gcc.c (driver::decode_argv): Do not call global_init_params
+       and finish_params.
+       (driver::finalize): Do not call params_c_finalize
+       and finalize_options_struct.
+       * opt-suggestions.c (option_proposer::get_completions): Remove
+       special casing of params.
+       (option_proposer::find_param_completions): Remove.
+       (test_completion_partial_match): Update expected output.
+       * opt-suggestions.h: Remove find_param_completions.
+       * opts-common.c (add_misspelling_candidates): Add
+       --param with a space.
+       * opts.c (handle_param): Remove.
+       (init_options_struct):. Remove init_options_struct and
+       similar calls.
+       (finalize_options_struct): Remove.
+       (common_handle_option): Use SET_OPTION_IF_UNSET.
+       * opts.h (finalize_options_struct): Remove.
+       * toplev.c (general_init): Do not call global_init_params.
+       (toplev::finalize): Do not call params_c_finalize and
+       finalize_options_struct.
+
+2019-11-12  Martin Liska  <mliska@suse.cz>
+
        * Makefile.in: Remove PARAMS_H and params.list
        and params.options.
        * params-enum.h: Remove.
index 8c6acab..26b6c2c 100644 (file)
@@ -63,9 +63,6 @@ int flag_complex_method = 1
 Variable
 bool flag_warn_unused_result = false
 
-Variable
-int *param_values
-
 ; Nonzero if we should write GIMPLE bytecode for link-time optimization.
 Variable
 int flag_generate_lto
index 1e3280d..c909f8e 100644 (file)
@@ -1340,8 +1340,6 @@ ix86_valid_target_attribute_p (tree fndecl,
        DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl) = new_optimize;
     }
 
-  finalize_options_struct (&func_options);
-
   return ret;
 }
 
index 159ffe7..539ded0 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -7422,10 +7422,6 @@ driver::expand_at_files (int *argc, char ***argv) const
 void
 driver::decode_argv (int argc, const char **argv)
 {
-  /* Register the language-independent parameters.  */
-  global_init_params ();
-  finish_params ();
-
   init_opts_obstack ();
   init_options_struct (&global_options, &global_options_set);
 
@@ -10113,7 +10109,6 @@ void
 driver::finalize ()
 {
   env.restore ();
-  params_c_finalize ();
   diagnostic_finish (global_dc);
 
   is_cpp_driver = 0;
@@ -10134,9 +10129,6 @@ driver::finalize ()
   spec_machine = DEFAULT_TARGET_MACHINE;
   greatest_status = 1;
 
-  finalize_options_struct (&global_options);
-  finalize_options_struct (&global_options_set);
-
   obstack_free (&obstack, NULL);
   obstack_free (&opts_obstack, NULL); /* in opts.c */
   obstack_free (&collect_obstack, NULL);
index 609e60b..01ce331 100644 (file)
@@ -64,32 +64,17 @@ option_proposer::get_completions (const char *option_prefix,
 
   size_t length = strlen (option_prefix);
 
-  /* Handle OPTION_PREFIX starting with "-param".  */
-  const char *prefix = "-param";
-  if (length >= strlen (prefix)
-      && strstr (option_prefix, prefix) == option_prefix)
-    {
-      /* We support both '-param-xyz=123' and '-param xyz=123' */
-      option_prefix += strlen (prefix);
-      char separator = option_prefix[0];
-      option_prefix++;
-      if (separator == ' ' || separator == '=')
-       find_param_completions (separator, option_prefix, results);
-    }
-  else
-    {
-      /* Lazily populate m_option_suggestions.  */
-      if (!m_option_suggestions)
-       build_option_suggestions (option_prefix);
-      gcc_assert (m_option_suggestions);
+  /* Lazily populate m_option_suggestions.  */
+  if (!m_option_suggestions)
+    build_option_suggestions (option_prefix);
+  gcc_assert (m_option_suggestions);
 
-      for (unsigned i = 0; i < m_option_suggestions->length (); i++)
-       {
-         char *candidate = (*m_option_suggestions)[i];
-         if (strlen (candidate) >= length
-             && strstr (candidate, option_prefix) == candidate)
-           results.safe_push (concat ("-", candidate, NULL));
-       }
+  for (unsigned i = 0; i < m_option_suggestions->length (); i++)
+    {
+      char *candidate = (*m_option_suggestions)[i];
+      if (strlen (candidate) >= length
+         && strstr (candidate, option_prefix) == candidate)
+       results.safe_push (concat ("-", candidate, NULL));
     }
 }
 
@@ -212,25 +197,6 @@ option_proposer::build_option_suggestions (const char *prefix)
     }
 }
 
-/* Find parameter completions for --param format with SEPARATOR.
-   Again, save the completions into results.  */
-
-void
-option_proposer::find_param_completions (const char separator,
-                                        const char *param_prefix,
-                                        auto_string_vec &results)
-{
-  char separator_str[] = {separator, '\0'};
-  size_t length = strlen (param_prefix);
-  for (unsigned i = 0; i < get_num_compiler_params (); ++i)
-    {
-      const char *candidate = compiler_params[i].option;
-      if (strlen (candidate) >= length
-         && strstr (candidate, param_prefix) == candidate)
-       results.safe_push (concat ("--param", separator_str, candidate, NULL));
-    }
-}
-
 #if CHECKING_P
 
 namespace selftest {
@@ -400,9 +366,9 @@ test_completion_partial_match (option_proposer &proposer)
   ASSERT_TRUE (in_completion_p (proposer, "-fipa-icf", "-fipa-icf-functions"));
   ASSERT_TRUE (in_completion_p (proposer, "-fipa-icf", "-fipa-icf"));
   ASSERT_TRUE (in_completion_p (proposer, "--param=",
-                               "--param=max-vartrack-reverse-op-size"));
+                               "--param=max-vartrack-reverse-op-size="));
   ASSERT_TRUE (in_completion_p (proposer, "--param ",
-                               "--param max-vartrack-reverse-op-size"));
+                               "--param max-vartrack-reverse-op-size="));
 
   ASSERT_FALSE (in_completion_p (proposer, "-fipa-icf", "-fipa"));
   ASSERT_FALSE (in_completion_p (proposer, "-fipa-icf-functions", "-fipa-icf"));
index 8d24833..93f65be 100644 (file)
@@ -63,11 +63,6 @@ private:
      it's set to NULL.  */
   void build_option_suggestions (const char *prefix);
 
-  /* Find parameter completions for --param format with SEPARATOR.
-     Again, save the completions into results.  */
-  void find_param_completions (const char separator, const char *param_prefix,
-                              auto_string_vec &results);
-
 private:
   /* Cache with all suggestions.  */
   auto_string_vec *m_option_suggestions;
index d55dc93..51e08d4 100644 (file)
@@ -510,6 +510,17 @@ add_misspelling_candidates (auto_vec<char *> *candidates,
          candidates->safe_push (alternative);
        }
     }
+
+  /* For all params (e.g. --param=key=value),
+     include also '--param key=value'.  */
+  const char *prefix = "--param=";
+  if (strstr (opt_text, prefix) == opt_text)
+    {
+      char *param = xstrdup (opt_text + 1);
+      gcc_assert (param[6] == '=');
+      param[6] = ' ';
+      candidates->safe_push (param);
+    }
 }
 
 /* Decode the switch beginning at ARGV for the language indicated by
index f9c6f20..879b210 100644 (file)
@@ -188,9 +188,6 @@ static const char use_diagnosed_msg[] = N_("Uses of this option are diagnosed.")
 
 typedef char *char_p; /* For DEF_VEC_P.  */
 
-static void handle_param (struct gcc_options *opts,
-                         struct gcc_options *opts_set, location_t loc,
-                         const char *carg);
 static void set_debug_level (enum debug_info_type type, int extended,
                             const char *arg, struct gcc_options *opts,
                             struct gcc_options *opts_set,
@@ -283,8 +280,6 @@ init_opts_obstack (void)
 void
 init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
 {
-  size_t num_params = get_num_compiler_params ();
-
   /* Ensure that opts_obstack has already been initialized by the time
      that we initialize any gcc_options instances (PR jit/68446).  */
   gcc_assert (opts_obstack.chunk_size > 0);
@@ -294,13 +289,6 @@ init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
   if (opts_set)
     memset (opts_set, 0, sizeof (*opts_set));
 
-  opts->x_param_values = XNEWVEC (int, num_params);
-
-  if (opts_set)
-    opts_set->x_param_values = XCNEWVEC (int, num_params);
-
-  init_param_values (opts->x_param_values);
-
   /* Initialize whether `char' is signed.  */
   opts->x_flag_signed_char = DEFAULT_SIGNED_CHAR;
   /* Set this to a special "uninitialized" value.  The actual default
@@ -318,14 +306,6 @@ init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
   targetm_common.option_init_struct (opts);
 }
 
-/* Release any allocations owned by OPTS.  */
-
-void
-finalize_options_struct (struct gcc_options *opts)
-{
-  XDELETEVEC (opts->x_param_values);
-}
-
 /* If indicated by the optimization level LEVEL (-Os if SIZE is set,
    -Ofast if FAST is set, -Og if DEBUG is set), apply the option DEFAULT_OPT
    to OPTS and OPTS_SET, diagnostic context DC, location LOC, with language
@@ -2465,10 +2445,10 @@ common_handle_option (struct gcc_options *opts,
       break;
 
     case OPT_finline_limit_:
-      set_param_value ("max-inline-insns-single", value / 2,
-                      opts->x_param_values, opts_set->x_param_values);
-      set_param_value ("max-inline-insns-auto", value / 2,
-                      opts->x_param_values, opts_set->x_param_values);
+      SET_OPTION_IF_UNSET (opts, opts_set, param_max_inline_insns_single,
+                          value / 2);
+      SET_OPTION_IF_UNSET (opts, opts_set, param_max_inline_insns_auto,
+                          value / 2);
       break;
 
     case OPT_finstrument_functions_exclude_function_list_:
@@ -2836,49 +2816,6 @@ common_handle_option (struct gcc_options *opts,
   return true;
 }
 
-/* Handle --param NAME=VALUE.  */
-static void
-handle_param (struct gcc_options *opts, struct gcc_options *opts_set,
-             location_t loc, const char *carg)
-{
-  char *equal, *arg;
-  int value;
-
-  arg = xstrdup (carg);
-  equal = strchr (arg, '=');
-  if (!equal)
-    error_at (loc, "%s: %qs arguments should be of the form NAME=VALUE",
-             arg, "--param");
-  else
-    {
-      *equal = '\0';
-
-      enum compiler_param index;
-      if (!find_param (arg, &index))
-       {
-         const char *suggestion = find_param_fuzzy (arg);
-         if (suggestion)
-           error_at (loc, "invalid %qs name %qs; did you mean %qs?",
-                     "--param", arg, suggestion);
-         else
-           error_at (loc, "invalid %qs name %qs", "--param", arg);
-       }
-      else
-       {
-         if (!param_string_value_p (index, equal + 1, &value))
-           value = integral_argument (equal + 1);
-
-         if (value == -1)
-           error_at (loc, "invalid %qs value %qs", "--param", equal + 1);
-         else
-           set_param_value (arg, value,
-                            opts->x_param_values, opts_set->x_param_values);
-       }
-    }
-
-  free (arg);
-}
-
 /* Used to set the level of strict aliasing warnings in OPTS,
    when no level is specified (i.e., when -Wstrict-aliasing, and not
    -Wstrict-aliasing=level was given).
index 0de8e42..b617398 100644 (file)
@@ -345,7 +345,6 @@ extern void init_options_once (void);
 extern void init_options_struct (struct gcc_options *opts,
                                 struct gcc_options *opts_set);
 extern void init_opts_obstack (void);
-extern void finalize_options_struct (struct gcc_options *opts);
 extern void decode_cmdline_options_to_array_default_mask (unsigned int argc,
                                                          const char **argv, 
                                                          struct cl_decoded_option **decoded_options,
index 513e4e0..d4583ba 100644 (file)
@@ -1240,9 +1240,6 @@ general_init (const char *argv0, bool init_signals)
   /* Initialize register usage now so switches may override.  */
   init_reg_sets ();
 
-  /* Register the language-independent parameters.  */
-  global_init_params ();
-
   /* This must be done after global_init_params but before argument
      processing.  */
   init_ggc_heuristics ();
@@ -1262,7 +1259,6 @@ general_init (const char *argv0, bool init_signals)
 
   statistics_early_init ();
   debuginfo_early_init ();
-  finish_params ();
 }
 
 /* Return true if the current target supports -fsection-anchors.  */
@@ -2468,10 +2464,6 @@ toplev::finalize (void)
   gcse_c_finalize ();
   ipa_cp_c_finalize ();
   ira_costs_c_finalize ();
-  params_c_finalize ();
-
-  finalize_options_struct (&global_options);
-  finalize_options_struct (&global_options_set);
 
   /* save_decoded_options uses opts_obstack, so these must
      be cleaned up together.  */