added more reorg statistics

Herman ten Brugge Haj.Ten.Brugge@net.HCC.nl
Sun Oct 31 01:17:00 GMT 1999


Hello,

I added some new code to reorg.c to print some more statistics. I needed
this to verify my patches I send earlier. These patches extended an
existing delay list. There are two options to print this. The first
is to make a two dimensional array and store all info:

filled_delays [old_delay_list_size][new_delay_list_size]

The second option was to print the total size at the end. This was the
one I implemented because the other implementation would probably give
to much output that could not be validated very easy. Now I just grep
on 'Reorg delays' and 'Reorg annuls' before and after my patch to 
extend existing delay lists and check the difference.
I also corrected a typo. Delay lists with 3 slots filled are not printed.

	Herman.

1999-31-10 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>

	* reorg.c (dbr_schedule) Print more statistics. Corrected
	problem when printing info when 3 delay slots are filled.

--- reorg.c.org	Sun Oct 31 08:36:52 1999
+++ reorg.c	Sun Oct 31 09:16:39 1999
@@ -3623,6 +3783,8 @@ dbr_schedule (first, file)
   if (file)
     {
       register int i, j, need_comma;
+      int total_delay_slots[MAX_DELAY_HISTOGRAM + 1];
+      int total_annul_slots[MAX_DELAY_HISTOGRAM + 1];
 
       for (reorg_pass_number = 0;
 	   reorg_pass_number < MAX_REORG_PASSES;
@@ -3637,7 +3799,7 @@ dbr_schedule (first, file)
 	      fprintf (file, ";; %d insns needing delay slots\n;; ",
 		       num_insns_needing_delays[i][reorg_pass_number]);
 
-	      for (j = 0; j < MAX_DELAY_HISTOGRAM; j++)
+	      for (j = 0; j < MAX_DELAY_HISTOGRAM + 1; j++)
 		if (num_filled_delays[i][j][reorg_pass_number])
 		  {
 		    if (need_comma)
@@ -3649,6 +3811,58 @@ dbr_schedule (first, file)
 	      fprintf (file, "\n");
 	    }
 	}
+      bzero ((char *) total_delay_slots, sizeof total_delay_slots);
+      bzero ((char *) total_annul_slots, sizeof total_annul_slots);
+      for (insn = first; insn; insn = NEXT_INSN (insn))
+	{
+	  if (! INSN_DELETED_P (insn)
+	      && GET_CODE (insn) == INSN
+	      && GET_CODE (PATTERN (insn)) != USE
+	      && GET_CODE (PATTERN (insn)) != CLOBBER)
+	    {
+	      if (GET_CODE (PATTERN (insn)) == SEQUENCE)
+		{
+		  j = XVECLEN (PATTERN (insn), 0) - 1;
+		  if (j > MAX_DELAY_HISTOGRAM)
+		    j = MAX_DELAY_HISTOGRAM;
+		  if (INSN_ANNULLED_BRANCH_P (XVECEXP (PATTERN (insn), 0, 0)))
+		    total_annul_slots[j]++;
+		  else
+		    total_delay_slots[j]++;
+		}
+              else if (num_delay_slots (insn) > 0)
+		total_delay_slots[0]++;
+	    }
+	}
+      fprintf (file, ";; Reorg totals: ");
+      need_comma = 0;
+      for (j = 0; j < MAX_DELAY_HISTOGRAM + 1; j++)
+	{
+	  if (total_delay_slots[j])
+	    {
+	      if (need_comma)
+		fprintf (file, ", ");
+	      need_comma = 1;
+	      fprintf (file, "%d got %d delays", total_delay_slots[j], j);
+	    }
+	}
+      fprintf (file, "\n");
+#if defined (ANNUL_IFTRUE_SLOTS) || defined (ANNUL_IFFALSE_SLOTS)
+      fprintf (file, ";; Reorg annuls: ");
+      need_comma = 0;
+      for (j = 0; j < MAX_DELAY_HISTOGRAM + 1; j++)
+	{
+	  if (total_annul_slots[j])
+	    {
+	      if (need_comma)
+		fprintf (file, ", ");
+	      need_comma = 1;
+	      fprintf (file, "%d got %d delays", total_annul_slots[j], j);
+	    }
+	}
+      fprintf (file, "\n");
+#endif
+      fprintf (file, "\n");
     }
 
   /* For all JUMP insns, fill in branch prediction notes, so that during


More information about the Gcc-patches mailing list