From 62b857eabfaedc1e5f9c824d0d508ac4a6005d9b Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 9 Jun 2004 10:00:30 -0700 Subject: [PATCH] basic-block.h (struct edge_def): Add goto_locus. * 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. From-SVN: r82842 --- gcc/ChangeLog | 7 +++++++ gcc/basic-block.h | 3 +++ gcc/tree-cfg.c | 12 ++++++------ gcc/tree-pretty-print.c | 18 ++++++++++++++++-- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4ec225d1f70..09d1c8edfa4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-06-09 Richard Henderson + + * 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. + 2004-06-08 Anil Paranjpe * h8300.md (ldm_h8300s_4): Fix condition for expander. diff --git a/gcc/basic-block.h b/gcc/basic-block.h index f087f8b5180..02ca28180ab 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -142,6 +142,9 @@ struct edge_def GTY((chain_next ("%h.pred_next"))) /* 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 diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 65e8e89ab78..d5ff9191d72 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -680,7 +680,8 @@ make_goto_expr_edges (basic_block bb) /* A GOTO to a local label creates normal edges. */ if (simple_goto_p (goto_t)) { - make_edge (bb, label_to_block (dest), EDGE_FALLTHRU); + edge e = make_edge (bb, label_to_block (dest), EDGE_FALLTHRU); + e->goto_locus = EXPR_LOCUS (goto_t); bsi_remove (&last); return; } @@ -2640,8 +2641,7 @@ disband_implicit_edges (void) if (e->flags & EDGE_FALLTHRU) break; - if (!e - || e->dest == bb->next_bb) + if (!e || e->dest == bb->next_bb) continue; if (e->dest == EXIT_BLOCK_PTR) @@ -2658,9 +2658,9 @@ disband_implicit_edges (void) && TREE_CODE (forward) == GOTO_EXPR) label = GOTO_DESTINATION (forward); - bsi_insert_after (&last, - build1 (GOTO_EXPR, void_type_node, label), - BSI_NEW_STMT); + 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; } } diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index ef130d822da..d5566b822bf 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -2227,7 +2227,8 @@ pp_cfg_jump (pretty_printer *buffer, basic_block bb) by INDENT spaces, with details given by FLAGS. */ static void -dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent) +dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent, + int flags) { edge e; @@ -2239,6 +2240,19 @@ dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent) 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); } @@ -2276,7 +2290,7 @@ dump_generic_bb_buff (pretty_printer *buffer, basic_block bb, pp_newline (buffer); } - dump_implicit_edges (buffer, bb, indent); + dump_implicit_edges (buffer, bb, indent, flags); if (flags & TDF_BLOCKS) dump_bb_end (buffer, bb, indent, flags); -- 2.30.2