This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] goto <bb x>
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Andrew MacLeod <amacleod at redhat dot com>
- Cc: gcc mailing list <gcc at gcc dot gnu dot org>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 16 Dec 2003 18:40:35 +0100
- Subject: Re: [tree-ssa] goto <bb x>
- References: <1071583235.31157.2955.camel@p4>
Hello,
> Although I like showing the implicit goto's in this form
> GOTO <bb 3>
>
> its unfortunately not very useful if we aren't showing the basic block
> info.
here's the fix.
Zdenek
* tree-pretty-print.c (dump_bb_header): Show block number when
there is no label.
(pp_cfg_jump): Show labels in addition to block numbers.
(dump_generic_bb_buff): Always call dump_bb_header.
Index: tree-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-pretty-print.c,v
retrieving revision 1.1.2.68
diff -c -3 -p -r1.1.2.68 tree-pretty-print.c
*** tree-pretty-print.c 15 Dec 2003 22:58:34 -0000 1.1.2.68
--- tree-pretty-print.c 16 Dec 2003 17:36:09 -0000
*************** static void
*** 2082,2111 ****
dump_bb_header (pretty_printer *buffer, basic_block bb, int indent, int flags)
{
edge e;
! INDENT (indent);
! pp_string (buffer, "# BLOCK ");
! pp_decimal_int (buffer, bb->index);
!
! if (flags & TDF_LINENO)
{
! block_stmt_iterator bsi;
! for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
! if (get_lineno (bsi_stmt (bsi)) != -1)
! {
! pp_string (buffer, ", starting at line ");
! pp_decimal_int (buffer, get_lineno (bsi_stmt (bsi)));
! break;
! }
}
- newline_and_indent (buffer, indent);
-
- pp_string (buffer, "# PRED:");
- pp_write_text_to_stream (buffer);
- for (e = bb->pred; e; e = e->pred_next)
- dump_edge_info (buffer->buffer->stream, e, 0);
- pp_newline (buffer);
}
/* Dumps end of basic block BB to buffer BUFFER indented by INDENT
--- 2082,2127 ----
dump_bb_header (pretty_printer *buffer, basic_block bb, int indent, int flags)
{
edge e;
+ tree stmt;
! if (flags & TDF_BLOCKS)
{
! INDENT (indent);
! pp_string (buffer, "# BLOCK ");
! pp_decimal_int (buffer, bb->index);
! if (flags & TDF_LINENO)
! {
! block_stmt_iterator bsi;
!
! for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
! if (get_lineno (bsi_stmt (bsi)) != -1)
! {
! pp_string (buffer, ", starting at line ");
! pp_decimal_int (buffer, get_lineno (bsi_stmt (bsi)));
! break;
! }
! }
! newline_and_indent (buffer, indent);
!
! pp_string (buffer, "# PRED:");
! pp_write_text_to_stream (buffer);
! for (e = bb->pred; e; e = e->pred_next)
! dump_edge_info (buffer->buffer->stream, e, 0);
! pp_newline (buffer);
! }
! else
! {
! stmt = first_stmt (bb);
! if (!stmt || TREE_CODE (stmt) != LABEL_EXPR)
! {
! INDENT (indent - 2);
! pp_string (buffer, "<bb ");
! pp_decimal_int (buffer, bb->index);
! pp_string (buffer, ">:");
! pp_newline (buffer);
! }
}
}
/* Dumps end of basic block BB to buffer BUFFER indented by INDENT
*************** dump_phi_nodes (pretty_printer *buffer,
*** 2152,2160 ****
static void
pp_cfg_jump (pretty_printer *buffer, basic_block bb)
{
pp_string (buffer, "goto <bb ");
pp_decimal_int (buffer, bb->index);
! pp_string (buffer, ">;");
}
/* Dump edges represented implicitly in basic block BB to BUFFER, indented
--- 2168,2187 ----
static void
pp_cfg_jump (pretty_printer *buffer, basic_block bb)
{
+ tree stmt;
+
+ stmt = first_stmt (bb);
+
pp_string (buffer, "goto <bb ");
pp_decimal_int (buffer, bb->index);
! pp_string (buffer, ">");
! if (stmt && TREE_CODE (stmt) == LABEL_EXPR)
! {
! pp_string (buffer, " (");
! dump_generic_node (buffer, LABEL_EXPR_LABEL (stmt), 0, 0, false);
! pp_string (buffer, ")");
! }
! pp_semicolon (buffer);
}
/* Dump edges represented implicitly in basic block BB to BUFFER, indented
*************** dump_generic_bb_buff (pretty_printer *bu
*** 2192,2199 ****
if (label_indent < 0)
label_indent = 0;
! if (flags & TDF_BLOCKS)
! dump_bb_header (buffer, bb, indent, flags);
dump_phi_nodes (buffer, bb, indent, flags);
--- 2219,2225 ----
if (label_indent < 0)
label_indent = 0;
! dump_bb_header (buffer, bb, indent, flags);
dump_phi_nodes (buffer, bb, indent, flags);