This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
line numbers for tree-ssa implicit gotos
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 9 Jun 2004 10:01:26 -0700
- Subject: line numbers for tree-ssa implicit gotos
Fixes the gcov regressions added by the return_expr changes.
r~
* basic-block.h (struct edge_def): Add goto_locus.
* tree-cfg.c (make_goto_expr_edges): Set it.
(disband_implicit_edges): Use it.
* tree-pretty-print.c (dump_implicit_edges): Print it.
Index: gcc/basic-block.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/basic-block.h,v
retrieving revision 1.197
diff -c -p -d -r1.197 basic-block.h
*** gcc/basic-block.h 3 Jun 2004 12:07:36 -0000 1.197
--- gcc/basic-block.h 9 Jun 2004 16:57:19 -0000
*************** struct edge_def GTY((chain_next ("%h.pre
*** 142,147 ****
--- 142,150 ----
/* Auxiliary info specific to a pass. */
PTR GTY ((skip (""))) aux;
+ /* Location of any goto implicit in the edge, during tree-ssa. */
+ location_t *goto_locus;
+
int flags; /* see EDGE_* below */
int probability; /* biased by REG_BR_PROB_BASE */
gcov_type count; /* Expected number of executions calculated
Index: gcc/tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.9
diff -c -p -d -r2.9 tree-cfg.c
*** gcc/tree-cfg.c 7 Jun 2004 06:11:59 -0000 2.9
--- gcc/tree-cfg.c 9 Jun 2004 16:57:20 -0000
*************** make_goto_expr_edges (basic_block bb)
*** 680,686 ****
/* A GOTO to a local label creates normal edges. */
if (simple_goto_p (goto_t))
{
! make_edge (bb, label_to_block (dest), EDGE_FALLTHRU);
bsi_remove (&last);
return;
}
--- 680,687 ----
/* A GOTO to a local label creates normal edges. */
if (simple_goto_p (goto_t))
{
! edge e = make_edge (bb, label_to_block (dest), EDGE_FALLTHRU);
! e->goto_locus = EXPR_LOCUS (goto_t);
bsi_remove (&last);
return;
}
*************** disband_implicit_edges (void)
*** 2640,2647 ****
if (e->flags & EDGE_FALLTHRU)
break;
! if (!e
! || e->dest == bb->next_bb)
continue;
if (e->dest == EXIT_BLOCK_PTR)
--- 2641,2647 ----
if (e->flags & EDGE_FALLTHRU)
break;
! if (!e || e->dest == bb->next_bb)
continue;
if (e->dest == EXIT_BLOCK_PTR)
*************** disband_implicit_edges (void)
*** 2658,2666 ****
&& TREE_CODE (forward) == GOTO_EXPR)
label = GOTO_DESTINATION (forward);
! bsi_insert_after (&last,
! build1 (GOTO_EXPR, void_type_node, label),
! BSI_NEW_STMT);
e->flags &= ~EDGE_FALLTHRU;
}
}
--- 2658,2666 ----
&& TREE_CODE (forward) == GOTO_EXPR)
label = GOTO_DESTINATION (forward);
! stmt = build1 (GOTO_EXPR, void_type_node, label);
! SET_EXPR_LOCUS (stmt, e->goto_locus);
! bsi_insert_after (&last, stmt, BSI_NEW_STMT);
e->flags &= ~EDGE_FALLTHRU;
}
}
Index: gcc/tree-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-pretty-print.c,v
retrieving revision 2.4
diff -c -p -d -r2.4 tree-pretty-print.c
*** gcc/tree-pretty-print.c 30 May 2004 18:32:30 -0000 2.4
--- gcc/tree-pretty-print.c 9 Jun 2004 16:57:20 -0000
*************** pp_cfg_jump (pretty_printer *buffer, bas
*** 2227,2233 ****
by INDENT spaces, with details given by FLAGS. */
static void
! dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent)
{
edge e;
--- 2227,2234 ----
by INDENT spaces, with details given by FLAGS. */
static void
! dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent,
! int flags)
{
edge e;
*************** dump_implicit_edges (pretty_printer *buf
*** 2239,2244 ****
--- 2240,2258 ----
if (e && e->dest != bb->next_bb)
{
INDENT (indent);
+
+ if ((flags & TDF_LINENO) && e->goto_locus)
+ {
+ pp_character (buffer, '[');
+ if (e->goto_locus->file)
+ {
+ pp_string (buffer, e->goto_locus->file);
+ pp_string (buffer, " : ");
+ }
+ pp_decimal_int (buffer, e->goto_locus->line);
+ pp_string (buffer, "] ");
+ }
+
pp_cfg_jump (buffer, e->dest);
pp_newline (buffer);
}
*************** dump_generic_bb_buff (pretty_printer *bu
*** 2276,2282 ****
pp_newline (buffer);
}
! dump_implicit_edges (buffer, bb, indent);
if (flags & TDF_BLOCKS)
dump_bb_end (buffer, bb, indent, flags);
--- 2290,2296 ----
pp_newline (buffer);
}
! dump_implicit_edges (buffer, bb, indent, flags);
if (flags & TDF_BLOCKS)
dump_bb_end (buffer, bb, indent, flags);