From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 0D4F43858D1E for ; Tue, 14 Feb 2023 09:57:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0D4F43858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 60CAB1042; Tue, 14 Feb 2023 01:58:02 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.99.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 484733F703; Tue, 14 Feb 2023 01:57:19 -0800 (PST) From: Richard Sandiford To: Hans-Peter Nilsson via Gcc-patches Mail-Followup-To: Hans-Peter Nilsson via Gcc-patches ,Hans-Peter Nilsson , richard.sandiford@arm.com Cc: Hans-Peter Nilsson Subject: Re: [PATCH] debug: Support "phrs" for dumping a HARD_REG_SET References: <20230214023346.2A85B20423@pchp3.se.axis.com> Date: Tue, 14 Feb 2023 09:57:18 +0000 In-Reply-To: <20230214023346.2A85B20423@pchp3.se.axis.com> (Hans-Peter Nilsson via Gcc-patches's message of "Tue, 14 Feb 2023 03:33:46 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-35.0 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_NONE,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hans-Peter Nilsson via Gcc-patches writes: > Ok to commit? It survived both a cris-elf regtest and a > x86_64-linux-gnu native regtest. :) OK, thanks. Richard > ---- 8< ---- > 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. > --- > gcc/gdbinit.in | 12 ++++++++++++ > gcc/ira-color.cc | 7 +++++++ > gcc/sel-sched-dump.cc | 10 ---------- > 3 files changed, 19 insertions(+), 10 deletions(-) > > diff --git a/gcc/gdbinit.in b/gcc/gdbinit.in > index 1f7592b0e26a..a76079a46af7 100644 > --- a/gcc/gdbinit.in > +++ b/gcc/gdbinit.in > @@ -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) > diff --git a/gcc/ira-color.cc b/gcc/ira-color.cc > index fe6dfc6e7692..1fb2958bddd0 100644 > --- a/gcc/ira-color.cc > +++ b/gcc/ira-color.cc > @@ -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 > diff --git a/gcc/sel-sched-dump.cc b/gcc/sel-sched-dump.cc > index b4eef8803df9..05de98409375 100644 > --- a/gcc/sel-sched-dump.cc > +++ b/gcc/sel-sched-dump.cc > @@ -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)