public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* line numbers for tree-ssa implicit gotos
@ 2004-06-09 18:07 Richard Henderson
  0 siblings, 0 replies; only message in thread
From: Richard Henderson @ 2004-06-09 18:07 UTC (permalink / raw)
  To: gcc-patches

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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-06-09 17:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-09 18:07 line numbers for tree-ssa implicit gotos Richard Henderson

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).