+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.
@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
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
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;
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;
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
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. */
/* 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.
/* 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)
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. */