[PATCH] Output edge info in print_rtl_with_bb, and two small cleanups

Steven Bosscher stevenb.gcc@gmail.com
Wed Nov 29 22:02:00 GMT 2006


The cfgrtl part of this is basically the same as what what DJ posted
in http://gcc.gnu.org/ml/gcc-patches/2006-05/msg01210.html.  Ian already
approved it, too, but DJ hasn't commited it yet, and I badly need this
because without this change it's almost impossible to follow what the
RTL means when you're in cfglayout mode.

The other two bits are cleanups:
* The cgraphunit.c change makes us output a newline, so that we don't
  print the function name right after "...unit".
* The alloc-pool.c change allows you to look at what pool_free tried
  to free.  Right now pool_free first whipes, then checks.  With the
  change it first checks, then whipes.  This change turned out to be
  quite useful while debugging some df and cselib patches that I had
  (I'll submit the cselib patches soon).

The only significant change is the cfgrtl change, which was already
approved.  The rest is obvious so I'll commit this later tonight.

Bootstrapped and tested on various targets over a period of months, I
have had this in my local tree since May.


	* cfgrtl.c (print_rtl_with_bb): Print predecessor and
	successor edge information as well.  Make output of live regs
	on exit consistent with live regs on entry.

	* cgraphunit.c (cgraph_finalize_compilation_unit): Add a newline
	at the end of a diagnostics message.

	* alloc-pool.c (pool_free): Postpone clearing the pool entry
	until after asserting that it was allocated in the right pool.

Index: cgraphunit.c
--- cgraphunit.c	(revision 119333)
+++ cgraphunit.c	(working copy)
@@ -1076,7 +1076,7 @@ cgraph_finalize_compilation_unit (void)
   if (!quiet_flag)
-      fprintf (stderr, "\nAnalyzing compilation unit");
+      fprintf (stderr, "\nAnalyzing compilation unit\n");
       fflush (stderr);
Index: alloc-pool.c
--- alloc-pool.c	(revision 119333)
+++ alloc-pool.c	(working copy)
@@ -292,11 +292,11 @@ pool_free (alloc_pool pool, void *ptr)
   gcc_assert (ptr);
-  memset (ptr, 0xaf, pool->elt_size - offsetof (allocation_object, u.data));
   /* Check whether the PTR was allocated from POOL.  */
   gcc_assert (pool->id == ALLOCATION_OBJECT_PTR_FROM_USER_PTR (ptr)->id);
+  memset (ptr, 0xaf, pool->elt_size - offsetof (allocation_object, u.data));
   /* Mark the element to be free.  */
Index: cfgrtl.c
--- cfgrtl.c	(revision 119333)
+++ cfgrtl.c	(working copy)
@@ -1646,6 +1646,8 @@ print_rtl_with_bb (FILE *outf, rtx rtx_f
       for (tmp_rtx = rtx_first; NULL != tmp_rtx; tmp_rtx = NEXT_INSN (tmp_rtx))
 	  int did_output;
+	  edge_iterator ei;
+	  edge e;
 	  if ((bb = start[INSN_UID (tmp_rtx)]) != NULL)
@@ -1653,6 +1655,12 @@ print_rtl_with_bb (FILE *outf, rtx rtx_f
 	      dump_regset (bb->il.rtl->global_live_at_start, outf);
 	      putc ('\n', outf);
+	      FOR_EACH_EDGE (e, ei, bb->preds)
+		{
+		  fputs (";; Pred edge ", outf);
+		  dump_edge_info (outf, e, 0);
+		  fputc ('\n', outf);
+		}
 	  if (in_bb_p[INSN_UID (tmp_rtx)] == NOT_IN_BB
@@ -1666,10 +1674,16 @@ print_rtl_with_bb (FILE *outf, rtx rtx_f
 	  if ((bb = end[INSN_UID (tmp_rtx)]) != NULL)
-	      fprintf (outf, ";; End of basic block %d, registers live:\n",
+	      fprintf (outf, ";; End of basic block %d, registers live:",
 	      dump_regset (bb->il.rtl->global_live_at_end, outf);
 	      putc ('\n', outf);
+	      FOR_EACH_EDGE (e, ei, bb->succs)
+		{
+		  fputs (";; Succ edge ", outf);
+		  dump_edge_info (outf, e, 1);
+		  fputc ('\n', outf);
+		}
 	  if (did_output)

More information about the Gcc-patches mailing list