diff mbox

print SEQUENCE of insns in sched-vis.c

Message ID CABu31nM6rvPq8uJ=nwMZvm0LfY2n4KgJqdu4NCn3XuF3Gc1GGw@mail.gmail.com
State New
Headers show

Commit Message

Steven Bosscher April 9, 2013, 11 a.m. UTC
Hello,

sched-vis.c would print insns in a SEQUENCE as a pattern, in effect
printing only GET_CODE(insn). Fixed with this patch.

Bootstrapped&tested on powerpc64-unknown-linux-gnu and
sparc64-unknown-linux-gnu with some dump inspections to make sure
everything looks as expected now.
OK for trunk?

Ciao!
Steven
* sched-vis.c (print_pattern): Print SEQUENCE of insns as insns.

Comments

Eric Botcazou April 9, 2013, 11:09 a.m. UTC | #1
> Bootstrapped&tested on powerpc64-unknown-linux-gnu and
> sparc64-unknown-linux-gnu with some dump inspections to make sure
> everything looks as expected now.
> OK for trunk?

Yes, thanks.
diff mbox

Patch

Index: sched-vis.c
===================================================================
--- sched-vis.c	(revision 197610)
+++ sched-vis.c	(working copy)
@@ -51,6 +51,9 @@  along with GCC; see the file COPYING3.  If not see
 static bool rtl_slim_pp_initialized = false;
 static pretty_printer rtl_slim_pp;
 
+/* For insns we print patterns, and for some patterns we print insns...  */
+static void print_insn_with_notes (pretty_printer *, const_rtx);
+
 /* This recognizes rtx'en classified as expressions.  These are always
    represent some action on values or results of other expression, that
    may be stored in objects representing values.  */
@@ -562,14 +565,32 @@  print_pattern (pretty_printer *pp, const_rtx x, in
       break;
     case SEQUENCE:
       {
-	int i;
-
 	pp_string (pp, "sequence{");
-	for (i = 0; i < XVECLEN (x, 0); i++)
+	if (INSN_P (XVECEXP (x, 0, 0)))
 	  {
-	    print_pattern (pp, XVECEXP (x, 0, i), verbose);
-	    pp_character (pp, ';');
+	    /* Print the sequence insns indented.  */
+	    const char * save_print_rtx_head = print_rtx_head;
+	    char indented_print_rtx_head[32];
+
+	    pp_newline (pp);
+	    gcc_assert (strlen (print_rtx_head) < sizeof (indented_print_rtx_head) - 4);
+	    snprintf (indented_print_rtx_head,
+		      sizeof (indented_print_rtx_head),
+		      "%s     ", print_rtx_head);
+	    print_rtx_head = indented_print_rtx_head;
+	    for (int i = 0; i < XVECLEN (x, 0); i++)
+	      print_insn_with_notes (pp, XVECEXP (x, 0, i));
+	    pp_printf (pp, "%s      ", save_print_rtx_head);
+	    print_rtx_head = save_print_rtx_head;
 	  }
+	else
+	  {
+	    for (int i = 0; i < XVECLEN (x, 0); i++)
+	      {
+		print_pattern (pp, XVECEXP (x, 0, i), verbose);
+		pp_character (pp, ';');
+	      }
+	  }
 	pp_character (pp, '}');
       }
       break;