Commit 8cc5fcaf by Martin Liska Committed by Martin Liska

Remove last leftover usage of params* files.

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
parent 0c29cac4
2019-11-12 Martin Liska <mliska@suse.cz> 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 * Makefile.in: Remove PARAMS_H and params.list
and params.options. and params.options.
* params-enum.h: Remove. * params-enum.h: Remove.
...@@ -63,9 +63,6 @@ int flag_complex_method = 1 ...@@ -63,9 +63,6 @@ int flag_complex_method = 1
Variable Variable
bool flag_warn_unused_result = false bool flag_warn_unused_result = false
Variable
int *param_values
; Nonzero if we should write GIMPLE bytecode for link-time optimization. ; Nonzero if we should write GIMPLE bytecode for link-time optimization.
Variable Variable
int flag_generate_lto int flag_generate_lto
......
...@@ -1340,8 +1340,6 @@ ix86_valid_target_attribute_p (tree fndecl, ...@@ -1340,8 +1340,6 @@ ix86_valid_target_attribute_p (tree fndecl,
DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl) = new_optimize; DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl) = new_optimize;
} }
finalize_options_struct (&func_options);
return ret; return ret;
} }
......
...@@ -7422,10 +7422,6 @@ driver::expand_at_files (int *argc, char ***argv) const ...@@ -7422,10 +7422,6 @@ driver::expand_at_files (int *argc, char ***argv) const
void void
driver::decode_argv (int argc, const char **argv) driver::decode_argv (int argc, const char **argv)
{ {
/* Register the language-independent parameters. */
global_init_params ();
finish_params ();
init_opts_obstack (); init_opts_obstack ();
init_options_struct (&global_options, &global_options_set); init_options_struct (&global_options, &global_options_set);
...@@ -10113,7 +10109,6 @@ void ...@@ -10113,7 +10109,6 @@ void
driver::finalize () driver::finalize ()
{ {
env.restore (); env.restore ();
params_c_finalize ();
diagnostic_finish (global_dc); diagnostic_finish (global_dc);
is_cpp_driver = 0; is_cpp_driver = 0;
...@@ -10134,9 +10129,6 @@ driver::finalize () ...@@ -10134,9 +10129,6 @@ driver::finalize ()
spec_machine = DEFAULT_TARGET_MACHINE; spec_machine = DEFAULT_TARGET_MACHINE;
greatest_status = 1; greatest_status = 1;
finalize_options_struct (&global_options);
finalize_options_struct (&global_options_set);
obstack_free (&obstack, NULL); obstack_free (&obstack, NULL);
obstack_free (&opts_obstack, NULL); /* in opts.c */ obstack_free (&opts_obstack, NULL); /* in opts.c */
obstack_free (&collect_obstack, NULL); obstack_free (&collect_obstack, NULL);
......
...@@ -64,32 +64,17 @@ option_proposer::get_completions (const char *option_prefix, ...@@ -64,32 +64,17 @@ option_proposer::get_completions (const char *option_prefix,
size_t length = strlen (option_prefix); size_t length = strlen (option_prefix);
/* Handle OPTION_PREFIX starting with "-param". */ /* Lazily populate m_option_suggestions. */
const char *prefix = "-param"; if (!m_option_suggestions)
if (length >= strlen (prefix) build_option_suggestions (option_prefix);
&& strstr (option_prefix, prefix) == option_prefix) gcc_assert (m_option_suggestions);
{
/* 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);
for (unsigned i = 0; i < m_option_suggestions->length (); i++) for (unsigned i = 0; i < m_option_suggestions->length (); i++)
{ {
char *candidate = (*m_option_suggestions)[i]; char *candidate = (*m_option_suggestions)[i];
if (strlen (candidate) >= length if (strlen (candidate) >= length
&& strstr (candidate, option_prefix) == candidate) && strstr (candidate, option_prefix) == candidate)
results.safe_push (concat ("-", candidate, NULL)); results.safe_push (concat ("-", candidate, NULL));
}
} }
} }
...@@ -212,25 +197,6 @@ option_proposer::build_option_suggestions (const char *prefix) ...@@ -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 #if CHECKING_P
namespace selftest { namespace selftest {
...@@ -400,9 +366,9 @@ test_completion_partial_match (option_proposer &proposer) ...@@ -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-functions"));
ASSERT_TRUE (in_completion_p (proposer, "-fipa-icf", "-fipa-icf")); ASSERT_TRUE (in_completion_p (proposer, "-fipa-icf", "-fipa-icf"));
ASSERT_TRUE (in_completion_p (proposer, "--param=", 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 ", 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", "-fipa"));
ASSERT_FALSE (in_completion_p (proposer, "-fipa-icf-functions", "-fipa-icf")); ASSERT_FALSE (in_completion_p (proposer, "-fipa-icf-functions", "-fipa-icf"));
......
...@@ -63,11 +63,6 @@ private: ...@@ -63,11 +63,6 @@ private:
it's set to NULL. */ it's set to NULL. */
void build_option_suggestions (const char *prefix); 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: private:
/* Cache with all suggestions. */ /* Cache with all suggestions. */
auto_string_vec *m_option_suggestions; auto_string_vec *m_option_suggestions;
......
...@@ -510,6 +510,17 @@ add_misspelling_candidates (auto_vec<char *> *candidates, ...@@ -510,6 +510,17 @@ add_misspelling_candidates (auto_vec<char *> *candidates,
candidates->safe_push (alternative); 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 /* Decode the switch beginning at ARGV for the language indicated by
......
...@@ -188,9 +188,6 @@ static const char use_diagnosed_msg[] = N_("Uses of this option are diagnosed.") ...@@ -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. */ 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, static void set_debug_level (enum debug_info_type type, int extended,
const char *arg, struct gcc_options *opts, const char *arg, struct gcc_options *opts,
struct gcc_options *opts_set, struct gcc_options *opts_set,
...@@ -283,8 +280,6 @@ init_opts_obstack (void) ...@@ -283,8 +280,6 @@ init_opts_obstack (void)
void void
init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set) 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 /* Ensure that opts_obstack has already been initialized by the time
that we initialize any gcc_options instances (PR jit/68446). */ that we initialize any gcc_options instances (PR jit/68446). */
gcc_assert (opts_obstack.chunk_size > 0); gcc_assert (opts_obstack.chunk_size > 0);
...@@ -294,13 +289,6 @@ init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set) ...@@ -294,13 +289,6 @@ init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
if (opts_set) if (opts_set)
memset (opts_set, 0, sizeof (*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. */ /* Initialize whether `char' is signed. */
opts->x_flag_signed_char = DEFAULT_SIGNED_CHAR; opts->x_flag_signed_char = DEFAULT_SIGNED_CHAR;
/* Set this to a special "uninitialized" value. The actual default /* 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) ...@@ -318,14 +306,6 @@ init_options_struct (struct gcc_options *opts, struct gcc_options *opts_set)
targetm_common.option_init_struct (opts); 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, /* 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 -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 to OPTS and OPTS_SET, diagnostic context DC, location LOC, with language
...@@ -2465,10 +2445,10 @@ common_handle_option (struct gcc_options *opts, ...@@ -2465,10 +2445,10 @@ common_handle_option (struct gcc_options *opts,
break; break;
case OPT_finline_limit_: case OPT_finline_limit_:
set_param_value ("max-inline-insns-single", value / 2, SET_OPTION_IF_UNSET (opts, opts_set, param_max_inline_insns_single,
opts->x_param_values, opts_set->x_param_values); value / 2);
set_param_value ("max-inline-insns-auto", value / 2, SET_OPTION_IF_UNSET (opts, opts_set, param_max_inline_insns_auto,
opts->x_param_values, opts_set->x_param_values); value / 2);
break; break;
case OPT_finstrument_functions_exclude_function_list_: case OPT_finstrument_functions_exclude_function_list_:
...@@ -2836,49 +2816,6 @@ common_handle_option (struct gcc_options *opts, ...@@ -2836,49 +2816,6 @@ common_handle_option (struct gcc_options *opts,
return true; 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, /* Used to set the level of strict aliasing warnings in OPTS,
when no level is specified (i.e., when -Wstrict-aliasing, and not when no level is specified (i.e., when -Wstrict-aliasing, and not
-Wstrict-aliasing=level was given). -Wstrict-aliasing=level was given).
......
...@@ -345,7 +345,6 @@ extern void init_options_once (void); ...@@ -345,7 +345,6 @@ extern void init_options_once (void);
extern void init_options_struct (struct gcc_options *opts, extern void init_options_struct (struct gcc_options *opts,
struct gcc_options *opts_set); struct gcc_options *opts_set);
extern void init_opts_obstack (void); 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, extern void decode_cmdline_options_to_array_default_mask (unsigned int argc,
const char **argv, const char **argv,
struct cl_decoded_option **decoded_options, struct cl_decoded_option **decoded_options,
......
...@@ -1240,9 +1240,6 @@ general_init (const char *argv0, bool init_signals) ...@@ -1240,9 +1240,6 @@ general_init (const char *argv0, bool init_signals)
/* Initialize register usage now so switches may override. */ /* Initialize register usage now so switches may override. */
init_reg_sets (); init_reg_sets ();
/* Register the language-independent parameters. */
global_init_params ();
/* This must be done after global_init_params but before argument /* This must be done after global_init_params but before argument
processing. */ processing. */
init_ggc_heuristics (); init_ggc_heuristics ();
...@@ -1262,7 +1259,6 @@ general_init (const char *argv0, bool init_signals) ...@@ -1262,7 +1259,6 @@ general_init (const char *argv0, bool init_signals)
statistics_early_init (); statistics_early_init ();
debuginfo_early_init (); debuginfo_early_init ();
finish_params ();
} }
/* Return true if the current target supports -fsection-anchors. */ /* Return true if the current target supports -fsection-anchors. */
...@@ -2468,10 +2464,6 @@ toplev::finalize (void) ...@@ -2468,10 +2464,6 @@ toplev::finalize (void)
gcse_c_finalize (); gcse_c_finalize ();
ipa_cp_c_finalize (); ipa_cp_c_finalize ();
ira_costs_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 /* save_decoded_options uses opts_obstack, so these must
be cleaned up together. */ be cleaned up together. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment