/* Command line option handling.
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Neil Booth.
This file is part of GCC.
write_symbols is set to DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
bool use_gnu_debug_info_extensions;
+/* The default visibility for all symbols (unless overridden) */
+enum symbol_visibility default_visibility = VISIBILITY_DEFAULT;
+
+/* Global visibility options. */
+struct visibility_flags visibility_options;
+
/* Columns of --help display. */
static unsigned int columns = 80;
static bool profile_arc_flag_set, flag_profile_values_set;
static bool flag_unroll_loops_set, flag_tracer_set;
static bool flag_value_profile_transformations_set;
+bool flag_speculative_prefetching_set;
static bool flag_peel_loops_set, flag_branch_probabilities_set;
/* Input file names. */
static void wrap_help (const char *help, const char *item, unsigned int);
static void print_help (void);
static void print_param_help (void);
-static void print_filtered_help (unsigned int flag);
static unsigned int print_switch (const char *text, unsigned int indent);
static void set_debug_level (enum debug_info_type type, int extended,
const char *arg);
{
const struct cl_option *opt = &cl_options[mn];
- /* Is this switch a prefix of the input? */
- if (!strncmp (input, opt->opt_text + 1, opt->opt_len))
+ /* Is the input either an exact match or a prefix that takes a
+ joined argument? */
+ if (!strncmp (input, opt->opt_text + 1, opt->opt_len)
+ && (input[opt->opt_len] == '\0' || (opt->flags & CL_JOINED)))
{
- /* If language is OK, and the match is exact or the switch
- takes a joined argument, return it. */
- if ((opt->flags & lang_mask)
- && (input[opt->opt_len] == '\0' || (opt->flags & CL_JOINED)))
+ /* If language is OK, return it. */
+ if (opt->flags & lang_mask)
return mn;
/* If we haven't remembered a prior match, remember this
opt = argv[0];
- /* Drop the "no-" from negative switches. */
- if ((opt[1] == 'W' || opt[1] == 'f')
+ opt_index = find_opt (opt + 1, lang_mask | CL_COMMON | CL_TARGET);
+ if (opt_index == cl_options_count
+ && (opt[1] == 'W' || opt[1] == 'f' || opt[1] == 'm')
&& opt[2] == 'n' && opt[3] == 'o' && opt[4] == '-')
{
+ /* Drop the "no-" from negative switches. */
size_t len = strlen (opt) - 3;
dup = xmalloc (len + 1);
memcpy (dup + 2, opt + 5, len - 2 + 1);
opt = dup;
value = 0;
+ opt_index = find_opt (opt + 1, lang_mask | CL_COMMON | CL_TARGET);
}
- opt_index = find_opt (opt + 1, lang_mask | CL_COMMON);
if (opt_index == cl_options_count)
goto done;
/* Now we've swallowed any potential argument, complain if this
is a switch for a different front end. */
- if (!(option->flags & (lang_mask | CL_COMMON)))
+ if (!(option->flags & (lang_mask | CL_COMMON | CL_TARGET)))
{
complain_wrong_lang (argv[0], option, lang_mask);
goto done;
}
if (option->flag_var)
- {
- if (option->has_set_value)
- {
- if (value)
- *option->flag_var = option->set_value;
- else
- *option->flag_var = !option->set_value;
- }
- else
+ switch (option->var_cond)
+ {
+ case CLVC_BOOLEAN:
*option->flag_var = value;
- }
+ break;
+
+ case CLVC_EQUAL:
+ *option->flag_var = value ? option->var_value : !option->var_value;
+ break;
+
+ case CLVC_BIT_CLEAR:
+ case CLVC_BIT_SET:
+ if ((value != 0) == (option->var_cond == CLVC_BIT_SET))
+ *option->flag_var |= option->var_value;
+ else
+ *option->flag_var &= ~option->var_value;
+ if (option->flag_var == &target_flags)
+ target_flags_explicit |= option->var_value;
+ break;
+ }
if (option->flags & lang_mask)
if (lang_hooks.handle_option (opt_index, arg, value) == 0)
if (common_handle_option (opt_index, arg, value) == 0)
result = 0;
+ if (result && (option->flags & CL_TARGET))
+ if (!targetm.handle_option (opt_index, arg, value))
+ result = 0;
+
done:
if (dup)
free (dup);
return result;
}
+/* Handle FILENAME from the command line. */
+static void
+add_input_filename (const char *filename)
+{
+ num_in_fnames++;
+ in_fnames = xrealloc (in_fnames, num_in_fnames * sizeof (in_fnames[0]));
+ in_fnames[num_in_fnames - 1] = filename;
+}
+
/* Decode and handle the vector of command line options. LANG_MASK
contains has a single bit set representing the current
language. */
}
}
-/* Handle FILENAME from the command line. */
-void
-add_input_filename (const char *filename)
-{
- num_in_fnames++;
- in_fnames = xrealloc (in_fnames, num_in_fnames * sizeof (in_fnames[0]));
- in_fnames[num_in_fnames - 1] = filename;
-}
-
/* Parse command line options and set default flag values. Do minimal
options processing. */
void
if (optimize >= 1)
{
flag_defer_pop = 1;
- flag_thread_jumps = 1;
#ifdef DELAY_SLOTS
flag_delayed_branch = 1;
#endif
flag_tree_dce = 1;
flag_tree_dom = 1;
flag_tree_dse = 1;
- flag_tree_pre = 1;
flag_tree_ter = 1;
flag_tree_live_range_split = 1;
flag_tree_sra = 1;
flag_tree_copyrename = 1;
flag_tree_fre = 1;
+ flag_tree_sink = 1;
+ flag_tree_salias = 1;
if (!optimize_size)
{
if (optimize >= 2)
{
+ flag_thread_jumps = 1;
flag_crossjumping = 1;
flag_optimize_sibling_calls = 1;
flag_cse_follow_jumps = 1;
flag_reorder_blocks = 1;
flag_reorder_functions = 1;
flag_unit_at_a_time = 1;
+
+ if (!optimize_size)
+ {
+ /* PRE tends to generate bigger code. */
+ flag_tree_pre = 1;
+ }
}
if (optimize >= 3)
/* 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;
+
+ /* We want to crossjump as much as possible. */
+ set_param_value ("min-crossjump-insns", 1);
}
/* Initialize whether `char' is signed. */
/* Initialize target_flags before OPTIMIZATION_OPTIONS so the latter can
modify it. */
- target_flags = 0;
+ target_flags = targetm.default_target_flags;
set_target_switch ("");
/* Unwind tables are always present when a target has ABI-specified unwind
flag_reorder_blocks_and_partition = 0;
flag_reorder_blocks = 1;
}
+
+ /* The optimization to partition hot and cold basic blocks into
+ separate sections of the .o and executable files does not currently
+ work correctly with DWARF debugging turned on. Until this is fixed
+ we will disable the optimization when DWARF debugging is set. */
+
+ if (flag_reorder_blocks_and_partition && write_symbols == DWARF2_DEBUG)
+ {
+ warning
+ ("-freorder-blocks-and-partition does not work with -g (currently)");
+ flag_reorder_blocks_and_partition = 0;
+ flag_reorder_blocks = 1;
+ }
}
/* Handle target- and language-independent options. Return zero to
case OPT_finline_limit_eq:
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);
break;
case OPT_fmessage_length_:
pp_set_line_maximum_length (global_dc->printer, value);
break;
+ case OPT_fpack_struct_:
+ if (value <= 0 || (value & (value - 1)) || value > 16)
+ error("structure alignment must be a small power of two, not %d", value);
+ else
+ {
+ initial_max_fld_align = value;
+ maximum_field_alignment = value * BITS_PER_UNIT;
+ }
+ break;
+
case OPT_fpeel_loops:
flag_peel_loops_set = true;
break;
flag_tracer = value;
if (!flag_value_profile_transformations_set)
flag_value_profile_transformations = value;
+#ifdef HAVE_prefetch
+ if (0 && !flag_speculative_prefetching_set)
+ flag_speculative_prefetching = value;
+#endif
break;
case OPT_fprofile_generate:
flag_profile_values = value;
if (!flag_value_profile_transformations_set)
flag_value_profile_transformations = value;
+ if (!flag_unroll_loops_set)
+ flag_unroll_loops = value;
+#ifdef HAVE_prefetch
+ if (0 && !flag_speculative_prefetching_set)
+ flag_speculative_prefetching = value;
+#endif
break;
case OPT_fprofile_values:
flag_profile_values_set = true;
break;
+ case OPT_fvisibility_:
+ {
+ if (!strcmp(arg, "default"))
+ default_visibility = VISIBILITY_DEFAULT;
+ else if (!strcmp(arg, "internal"))
+ default_visibility = VISIBILITY_INTERNAL;
+ else if (!strcmp(arg, "hidden"))
+ default_visibility = VISIBILITY_HIDDEN;
+ else if (!strcmp(arg, "protected"))
+ default_visibility = VISIBILITY_PROTECTED;
+ else
+ error ("unrecognised visibility value \"%s\"", arg);
+ }
+ break;
+
case OPT_fvpt:
- flag_value_profile_transformations_set = value;
+ flag_value_profile_transformations_set = true;
+ break;
+
+ case OPT_fspeculative_prefetching:
+ flag_speculative_prefetching_set = true;
break;
case OPT_frandom_seed:
stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (arg));
break;
+ case OPT_ftree_vectorizer_verbose_:
+ vect_set_verbosity_level (arg);
+ break;
+
case OPT_ftls_model_:
if (!strcmp (arg, "global-dynamic"))
flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
flag_tracer_set = true;
break;
- case OPT_ftree_points_to_:
- if (!strcmp (arg, "andersen"))
-#ifdef HAVE_BANSHEE
- flag_tree_points_to = PTA_ANDERSEN;
-#else
- warning ("Andersen's PTA not available - libbanshee not compiled.");
-#endif
- else if (!strcmp (arg, "none"))
- flag_tree_points_to = PTA_NONE;
- else
- {
- warning ("`%s`: unknown points-to analysis algorithm", arg);
- return 0;
- }
- break;
-
case OPT_funroll_loops:
flag_unroll_loops_set = true;
break;
{
value = integral_argument (equal + 1);
if (value == -1)
- error ("invalid --param value `%s'", equal + 1);
+ error ("invalid --param value %qs", equal + 1);
else
{
*equal = '\0';
{
flag_signaling_nans = 0;
flag_rounding_math = 0;
+ flag_cx_limited_range = 1;
}
}
}
/* Print help for a specific front-end, etc. */
-static void
+void
print_filtered_help (unsigned int flag)
{
unsigned int i, len, filter, indent = 0;
const char *help, *opt, *tab;
static char *printed;
- if (flag == CL_COMMON)
+ if (flag == CL_COMMON || flag == CL_TARGET)
{
filter = flag;
if (!printed)
}
while (remaining);
}
+
+/* Return 1 if OPTION is enabled, 0 if it is disabled, or -1 if it isn't
+ a simple on-off switch. */
+
+int
+option_enabled (const struct cl_option *option)
+{
+ if (option->flag_var)
+ switch (option->var_cond)
+ {
+ case CLVC_BOOLEAN:
+ return *option->flag_var != 0;
+
+ case CLVC_EQUAL:
+ return *option->flag_var == option->var_value;
+
+ case CLVC_BIT_CLEAR:
+ return (*option->flag_var & option->var_value) == 0;
+
+ case CLVC_BIT_SET:
+ return (*option->flag_var & option->var_value) != 0;
+ }
+ return -1;
+}