opts.c (decode_options): Do not enable flag_rename_registers and flag_web at -O3.

2004-04-17  Paolo Bonzini  <bonzini@gnu.org>

        * opts.c (decode_options): Do not enable flag_rename_registers
        and flag_web at -O3.
        * toplev.c (flag_rename_registers): Initialize
        flag_rename_registers and flag_web to
        AUTODETECT_FLAG_VAR_TRACKING.
        (default_debug_hooks): New global.
        (process_options): Initialize default_debug_hooks.  Warn if
        -fvar-tracking specified but not supported by the current
        debug format.  Do not run var tracking at -O0 or if not
        supported by the current debug format, even if
        -fvar-tracking was given.  If -fno-rename-registers
        is not specified, always run register renaming if var
        tracking is supported by the default debugging information
        format for the target, and we are at -O1 or higher; similarly
        for -fweb, but only at -O2 or higher.
        * doc/invoke.texi (Optimize Options): Document this.

From-SVN: r80789
This commit is contained in:
Paolo Bonzini 2004-04-17 06:53:44 +00:00 committed by Paolo Bonzini
parent 82e923f6ff
commit 38d396e511
4 changed files with 92 additions and 18 deletions

View file

@ -1,3 +1,22 @@
2004-04-17 Paolo Bonzini <bonzini@gnu.org>
* opts.c (decode_options): Do not enable flag_rename_registers
and flag_web at -O3.
* toplev.c (flag_rename_registers): Initialize
flag_rename_registers and flag_web to
AUTODETECT_FLAG_VAR_TRACKING.
(default_debug_hooks): New global.
(process_options): Initialize default_debug_hooks. Warn if
-fvar-tracking specified but not supported by the current
debug format. Do not run var tracking at -O0 or if not
supported by the current debug format, even if
-fvar-tracking was given. If -fno-rename-registers
is not specified, always run register renaming if var
tracking is supported by the default debugging information
format for the target, and we are at -O1 or higher; similarly
for -fweb, but only at -O2 or higher.
* doc/invoke.texi (Optimize Options): Document this.
2004-04-17 Richard Sandiford <rsandifo@redhat.com>
* configure.ac (gcc_cv_ld_as_needed): Use AC_CACHE_CHECK.

View file

@ -4346,11 +4346,14 @@ Enabled at levels @option{-O2}, @option{-O3}.
@opindex frename-registers
Attempt to avoid false dependencies in scheduled code by making use
of registers left over after register allocation. This optimization
will most benefit processors with lots of registers. It can, however,
will most benefit processors with lots of registers. Depending on the
debug information format adopted by the target, however, it can
make debugging impossible, since variables will no longer stay in
a ``home register''.
Enabled at levels @option{-O3}.
Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
on targets where the default format for debugging information supports
variable tracking.
@item -fweb
@opindex fweb
@ -4361,7 +4364,9 @@ passes, such as CSE, loop optimizer and trivial dead code remover. It can,
however, make debugging impossible, since variables will no longer stay in a
``home register''.
Enabled at levels @option{-O3}.
Enabled at levels @option{-O2}, @option{-O3}, @option{-Os},
on targets where the default format for debugging information supports
variable tracking.
@item -fno-cprop-registers
@opindex fno-cprop-registers

View file

@ -571,9 +571,7 @@ decode_options (unsigned int argc, const char **argv)
if (optimize >= 3)
{
flag_inline_functions = 1;
flag_rename_registers = 1;
flag_unswitch_loops = 1;
flag_web = 1;
flag_gcse_after_reload = 1;
}

View file

@ -138,6 +138,10 @@ static const char **save_argv;
const char *main_input_filename;
/* Used to enable -fvar-tracking, -fweb and -frename-registers according
to optimize and default_debug_hooks in process_options (). */
#define AUTODETECT_FLAG_VAR_TRACKING 2
/* Current position in real source file. */
location_t input_location;
@ -177,6 +181,10 @@ int target_flags_explicit;
const struct gcc_debug_hooks *debug_hooks;
/* Debug hooks - target default. */
static const struct gcc_debug_hooks *default_debug_hooks;
/* Other flags saying which kinds of debugging dump have been requested. */
int rtl_dump_and_exit;
@ -258,9 +266,10 @@ int flag_reorder_blocks_and_partition = 0;
int flag_reorder_functions = 0;
/* Nonzero if registers should be renamed. */
int flag_rename_registers = 0;
/* Nonzero if registers should be renamed. When
flag_rename_registers == AUTODETECT_FLAG_VAR_TRACKING it will be set
according to optimize and default_debug_hooks in process_options (). */
int flag_rename_registers = AUTODETECT_FLAG_VAR_TRACKING;
int flag_cprop_registers = 0;
/* Nonzero for -pedantic switch: warn about anything
@ -485,9 +494,11 @@ int flag_complex_divide_method = 0;
int flag_syntax_only = 0;
/* Nonzero means performs web construction pass. */
/* Nonzero means performs web construction pass. When flag_web ==
AUTODETECT_FLAG_VAR_TRACKING it will be set according to optimize
and default_debug_hooks in process_options (). */
int flag_web;
int flag_web = AUTODETECT_FLAG_VAR_TRACKING;
/* Nonzero means perform loop optimizer. */
@ -800,8 +811,6 @@ int flag_unit_at_a_time = 0;
/* Nonzero if we should track variables. When
flag_var_tracking == AUTODETECT_FLAG_VAR_TRACKING it will be set according
to optimize, debug_info_level and debug_hooks in process_options (). */
#define AUTODETECT_FLAG_VAR_TRACKING 2
int flag_var_tracking = AUTODETECT_FLAG_VAR_TRACKING;
/* Values of the -falign-* flags: how much to align labels in code.
@ -2335,6 +2344,30 @@ process_options (void)
/* Now we know write_symbols, set up the debug hooks based on it.
By default we do nothing for debug output. */
if (PREFERRED_DEBUGGING_TYPE == NO_DEBUG)
default_debug_hooks = &do_nothing_debug_hooks;
#if defined(DBX_DEBUGGING_INFO)
else if (PREFERRED_DEBUGGING_TYPE == DBX_DEBUG)
default_debug_hooks = &dbx_debug_hooks;
#endif
#if defined(XCOFF_DEBUGGING_INFO)
else if (PREFERRED_DEBUGGING_TYPE == XCOFF_DEBUG)
default_debug_hooks = &xcoff_debug_hooks;
#endif
#ifdef SDB_DEBUGGING_INFO
else if (PREFERRED_DEBUGGING_TYPE == SDB_DEBUG)
default_debug_hooks = &sdb_debug_hooks;
#endif
#ifdef DWARF2_DEBUGGING_INFO
else if (PREFERRED_DEBUGGING_TYPE == DWARF2_DEBUG)
default_debug_hooks = &dwarf2_debug_hooks;
#endif
#ifdef VMS_DEBUGGING_INFO
else if (PREFERRED_DEBUGGING_TYPE == VMS_DEBUG
|| PREFERRED_DEBUGGING_TYPE == VMS_AND_DWARF2_DEBUG)
default_debug_hooks = &vmsdbg_debug_hooks;
#endif
if (write_symbols == NO_DEBUG)
debug_hooks = &do_nothing_debug_hooks;
#if defined(DBX_DEBUGGING_INFO)
@ -2362,15 +2395,34 @@ process_options (void)
debug_type_names[write_symbols]);
/* Now we know which debug output will be used so we can set
flag_var_tracking if user has not specified it. */
if (flag_var_tracking == AUTODETECT_FLAG_VAR_TRACKING)
flag_var_tracking, flag_rename_registers and flag_web if the user has
not specified them. */
if (debug_info_level < DINFO_LEVEL_NORMAL
|| debug_hooks->var_location == do_nothing_debug_hooks.var_location)
{
/* User has not specified -f(no-)var-tracking so autodetect it. */
flag_var_tracking
= (optimize >= 1 && debug_info_level >= DINFO_LEVEL_NORMAL
&& debug_hooks->var_location != do_nothing_debug_hooks.var_location);
if (flag_var_tracking == 1)
{
if (debug_info_level < DINFO_LEVEL_NORMAL)
warning ("variable tracking requested, but useless unless "
"producing debug info");
else
warning ("variable tracking requested, but not supported "
"by this debug format");
}
flag_var_tracking = 0;
}
if (flag_rename_registers == AUTODETECT_FLAG_VAR_TRACKING)
flag_rename_registers = default_debug_hooks->var_location
!= do_nothing_debug_hooks.var_location;
if (flag_web == AUTODETECT_FLAG_VAR_TRACKING)
flag_web = optimize >= 2 && (default_debug_hooks->var_location
!= do_nothing_debug_hooks.var_location);
if (flag_var_tracking == AUTODETECT_FLAG_VAR_TRACKING)
flag_var_tracking = optimize >= 1;
/* If auxiliary info generation is desired, open the output file.
This goes in the same directory as the source file--unlike
all the other output files. */