debug: Support "phrs" for dumping a HARD_REG_SET

The debug-function in sel-sched-dump.cc that would be
suitable for a hookup to a command in gdb is guarded by
#ifdef INSN_SCHEDULING, thus can't be used for all targets.
Better move the function marked DEBUG_FUNCTION elsewhere,
here to a file with a suitable static function to call.

There are multiple sets of similar functions dumping
HARD_REG_SETs, but cleaning that up is better left to a
separate commit.

gcc:
	* gdbinit.in (phrs): New command.
	* sel-sched-dump.cc (debug_hard_reg_set): Remove debug-function.
	* ira-color.cc (debug_hard_reg_set): New, calling print_hard_reg_set.
This commit is contained in:
Hans-Peter Nilsson 2023-02-15 01:09:06 +01:00 committed by Hans-Peter Nilsson
parent cce6262502
commit abbdb623c4
3 changed files with 19 additions and 10 deletions

View file

@ -31,6 +31,7 @@ GCC gdbinit file introduces several debugging shorthands:
pdd [dw_die_ref],
pbm [bitmap],
pel [location_t],
phrs [HARD_REG_SET]
pp, pbs, pcfun
They are generally implemented by calling a function that prints to stderr,
@ -145,6 +146,17 @@ Print given GENERIC expression in C syntax.
See also 'help-gcc-hooks'.
end
define phrs
eval "set $debug_arg = $%s", $argc ? "arg0" : ""
call debug_hard_reg_set ($debug_arg)
end
document phrs
GCC hook: debug_hard_reg_set (HARD_REG_SET)
Print given HARD_REG_SET.
See also 'help-gcc-hooks'.
end
define pmz
eval "set $debug_arg = $%s", $argc ? "arg0" : ""
call mpz_out_str(stderr, 10, $debug_arg)

View file

@ -512,6 +512,13 @@ print_hard_reg_set (FILE *f, HARD_REG_SET set, bool new_line_p)
fprintf (f, "\n");
}
/* Dump a hard reg set SET to stderr. */
DEBUG_FUNCTION void
debug_hard_reg_set (HARD_REG_SET set)
{
print_hard_reg_set (stderr, set, true);
}
/* Print allocno hard register subforest given by ROOTS and its LEVEL
to F. */
static void

View file

@ -986,16 +986,6 @@ debug_blist (blist_t bnds)
restore_dump ();
}
/* Dump a hard reg set SET to stderr. */
DEBUG_FUNCTION void
debug_hard_reg_set (HARD_REG_SET set)
{
switch_dump (stderr);
dump_hard_reg_set ("", set);
sel_print ("\n");
restore_dump ();
}
/* Debug a cfg region with default flags. */
void
sel_debug_cfg (void)