public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] final: Improve output for -dp and -fverbose-asm
@ 2017-11-29 23:37 Segher Boessenkool
  2017-11-30  7:52 ` Martin Sebor
                   ` (2 more replies)
  0 siblings, 3 replies; 26+ messages in thread
From: Segher Boessenkool @ 2017-11-29 23:37 UTC (permalink / raw)
  To: gcc-patches; +Cc: Segher Boessenkool

This improves the assembler output (for -dp and -fverbose-asm) in
several ways.  It always prints the insn_cost.  It does not print
"[length = NN]" but "[c=NN l=NN]", to save space.  It does not add one
to the instruction alternative number (everything else starts counting
those at 0, too).  And finally, it tries to keep things lined up in
columns a bit better.

Tested on powerpc64-linux {-m32,-m64}; is this okay for trunk?


Segher


2017-11-29  Segher Boessenkool  <segher@kernel.crashing.org>

	* final.c (output_asm_name): Print insn_cost.  Shorten output.  Print
	which_alternative instead of which_alternative + 1.
	(output_asm_insn): Print an extra tab if the template is short.

---
 gcc/final.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/gcc/final.c b/gcc/final.c
index fdae241..afb6906 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -3469,16 +3469,20 @@ output_asm_name (void)
 {
   if (debug_insn)
     {
-      int num = INSN_CODE (debug_insn);
-      fprintf (asm_out_file, "\t%s %d\t%s",
-	       ASM_COMMENT_START, INSN_UID (debug_insn),
-	       insn_data[num].name);
-      if (insn_data[num].n_alternatives > 1)
-	fprintf (asm_out_file, "/%d", which_alternative + 1);
+      fprintf (asm_out_file, "\t%s %d\t",
+	       ASM_COMMENT_START, INSN_UID (debug_insn));
 
+      fprintf (asm_out_file, "[c=%d",
+	       insn_cost (debug_insn, optimize_insn_for_speed_p ()));
       if (HAVE_ATTR_length)
-	fprintf (asm_out_file, "\t[length = %d]",
+	fprintf (asm_out_file, " l=%d",
 		 get_attr_length (debug_insn));
+      fprintf (asm_out_file, "]  ");
+
+      int num = INSN_CODE (debug_insn);
+      fprintf (asm_out_file, "%s", insn_data[num].name);
+      if (insn_data[num].n_alternatives > 1)
+	fprintf (asm_out_file, "/%d", which_alternative);
 
       /* Clear this so only the first assembler insn
 	 of any rtl insn will get the special comment for -dp.  */
@@ -3824,6 +3828,10 @@ output_asm_insn (const char *templ, rtx *operands)
 	putc (c, asm_out_file);
       }
 
+  /* Try to keep the asm a bit more readable.  */
+  if ((flag_verbose_asm || flag_print_asm_name) && strlen (templ) < 9)
+    putc ('\t', asm_out_file);
+
   /* Write out the variable names for operands, if we know them.  */
   if (flag_verbose_asm)
     output_asm_operand_names (operands, oporder, ops);
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2017-12-04 15:49 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-29 23:37 [PATCH] final: Improve output for -dp and -fverbose-asm Segher Boessenkool
2017-11-30  7:52 ` Martin Sebor
2017-11-30 11:54   ` Segher Boessenkool
2017-11-30 16:06     ` Michael Matz
2017-11-30 16:36     ` Martin Sebor
2017-11-30 16:50       ` Segher Boessenkool
2017-11-30 17:02         ` Martin Sebor
2017-11-30 17:14           ` Michael Matz
2017-11-30 17:55             ` Martin Sebor
2017-12-01  0:32               ` Jeff Law
2017-12-01 22:52               ` Segher Boessenkool
2017-12-04 12:39               ` Michael Matz
2017-11-30 17:55             ` David Malcolm
2017-12-04 15:49               ` Michael Matz
2017-11-30 17:15           ` Segher Boessenkool
2017-11-30 22:59             ` Martin Sebor
2017-12-01  0:26               ` Jeff Law
2017-12-01  0:49       ` Jeff Law
2017-12-01 23:45         ` Segher Boessenkool
2017-11-30 16:44 ` Kyrill Tkachov
2017-11-30 16:54   ` Michael Matz
2017-11-30 16:55     ` Kyrill Tkachov
2017-11-30 17:07       ` Michael Matz
2017-12-01  0:22         ` Jeff Law
2017-12-01  0:25       ` Jeff Law
2017-12-01  1:17 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).