This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Omit INSN_LOCATION from compact dumps
- From: David Malcolm <dmalcolm at redhat dot com>
- To: Bernd Schmidt <bschmidt at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Cc: David Malcolm <dmalcolm at redhat dot com>
- Date: Thu, 13 Oct 2016 11:52:57 -0400
- Subject: [PATCH] Omit INSN_LOCATION from compact dumps
- Authentication-results: sourceware.org; auth=none
- References: <c658a740-e61f-8b7a-57ad-5338c6acea35@redhat.com>
On Thu, 2016-10-13 at 12:21 +0200, Bernd Schmidt wrote:
> On 10/12/2016 10:37 PM, David Malcolm wrote:
> > It didn't pass, due to this change:
> >
> > (print_rtx_operand_code_i): When printing source locations,
> > wrap
> > xloc.file in quotes. [...snip...]
> [...]
> > The following is a revised version of the patch which updates this
> > test case.
>
> Also ok.
(committed to trunk as r241120)
> This reminds me, wrapping the filename in quotes was a side
> issue - what I was really hoping for was to have testcases without
> this
> visual clutter unless they wanted to explicitly test functionality
> related to it.
The following patch omits the INSN_LOCATION in compact mode.
Currently bootstrapping®rtesting.
OK for trunk if it passes?
Alternatively, it seems that we might want an additional flag for
this. If so, maybe it's time to introduce a "class rtx_writer" or
similar to hold the global state relating to dumping, and rewrite
the dumping in those terms?
gcc/ChangeLog:
* print-rtl-function.c (print_rtx_function): Update comment for
omission of INSN_LOCATIONs in compact mode.
* print-rtl.c (print_rtx_operand_code_i): Omit INSN_LOCATIONs in
compact mode.
---
gcc/print-rtl-function.c | 13 +++++++------
gcc/print-rtl.c | 5 +++--
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/gcc/print-rtl-function.c b/gcc/print-rtl-function.c
index 90a0ff7..87a6458 100644
--- a/gcc/print-rtl-function.c
+++ b/gcc/print-rtl-function.c
@@ -133,6 +133,7 @@ can_have_basic_block_p (const rtx_insn *insn)
- INSN_CODEs are omitted,
- register numbers are omitted for hard and virtual regs
- insn names are prefixed with "c" (e.g. "cinsn", "cnote", etc)
+ - INSN_LOCATIONs are omitted.
Example output (with COMPACT==true):
@@ -144,30 +145,30 @@ can_have_basic_block_p (const rtx_insn *insn)
(cnote [bb 2] NOTE_INSN_BASIC_BLOCK)
(cinsn (set (mem/c:SI (plus:DI (reg/f:DI virtual-stack-vars)
(const_int -4)) [1 i+0 S4 A32])
- (reg:SI di [ i ])) "t.c":2
+ (reg:SI di [ i ]))
(nil))
(cnote NOTE_INSN_FUNCTION_BEG)
(cinsn (set (reg:SI 89)
(mem/c:SI (plus:DI (reg/f:DI virtual-stack-vars)
- (const_int -4)) [1 i+0 S4 A32])) "t.c":3
+ (const_int -4)) [1 i+0 S4 A32]))
(nil))
(cinsn (parallel [
(set (reg:SI 87 [ _2 ])
(ashift:SI (reg:SI 89)
(const_int 1)))
(clobber (reg:CC flags))
- ]) "t.c":3
+ ])
(expr_list:REG_EQUAL (ashift:SI (mem/c:SI (plus:DI (reg/f:DI virtual-stack-vars)
(const_int -4)) [1 i+0 S4 A32])
(const_int 1))
(nil)))
(cinsn (set (reg:SI 88 [ <retval> ])
- (reg:SI 87 [ _2 ])) "t.c":3
+ (reg:SI 87 [ _2 ]))
(nil))
(cinsn (set (reg/i:SI ax)
- (reg:SI 88 [ <retval> ])) "t.c":4
+ (reg:SI 88 [ <retval> ]))
(nil))
- (cinsn (use (reg/i:SI ax)) "t.c":4
+ (cinsn (use (reg/i:SI ax))
(nil))
(edge-to exit (flags "FALLTHRU"))
) ;; block 2
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index f114cb4..2bf7a13 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -288,8 +288,9 @@ print_rtx_operand_code_i (const_rtx in_rtx, int idx)
/* Pretty-print insn locations. Ignore scoping as it is mostly
redundant with line number information and do not print anything
- when there is no location information available. */
- if (INSN_HAS_LOCATION (in_insn))
+ when there is no location information available.
+ Don't print locations when in compact mode. */
+ if (INSN_HAS_LOCATION (in_insn) && !flag_compact)
{
expanded_location xloc = insn_location (in_insn);
fprintf (outfile, " \"%s\":%i", xloc.file, xloc.line);
--
1.8.5.3