[PATCH] Turn non-detailed dumping verbosity of estimate_function_body_sizes

Martin Jambor mjambor@suse.cz
Tue Sep 15 11:39:00 GMT 2009


Hi,

estimate_function_body_sizes() in ipa-inline.c dumps info about every
statement in the function even when not dumping details.  So I
suppressed this when TDF_DETAILS is not set.  I also used this
opportunity to re-format the function since it is currently casually
exceeding 80 characters per line even when it was not necessary at all
and has some other minor formatting issues.  I have not changed the
functionality at all.

Bootstrapped and tested on x86_64-linux.  OK for trunk?

Thanks,

Martin



2009-09-14  Martin Jambor  <mjambor@suse.cz>

	* ipa-inline.c (estimate_function_body_sizes): Dump info about
	individual statements only at TDF_DETAILS dump level.  Format
	source for 80 characters per line.


Index: small/gcc/ipa-inline.c
===================================================================
--- small.orig/gcc/ipa-inline.c
+++ small/gcc/ipa-inline.c
@@ -1738,9 +1738,8 @@ estimate_function_body_sizes (struct cgr
   bitmap must_not_throw = must_not_throw_labels ();
 
   if (dump_file)
-    {
-      fprintf (dump_file, "Analyzing function body size: %s\n", cgraph_node_name (node));
-    }
+    fprintf (dump_file, "Analyzing function body size: %s\n",
+	     cgraph_node_name (node));
 
   gcc_assert (my_function && my_function->cfg);
   FOR_EACH_BB_FN (bb, my_function)
@@ -1748,29 +1747,34 @@ estimate_function_body_sizes (struct cgr
       freq = compute_call_stmt_bb_frequency (node->decl, bb);
       for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))
 	{
-	  int this_size = estimate_num_insns (gsi_stmt (bsi), &eni_size_weights);
-	  int this_time = estimate_num_insns (gsi_stmt (bsi), &eni_time_weights);
+	  int this_size = estimate_num_insns (gsi_stmt (bsi),
+					      &eni_size_weights);
+	  int this_time = estimate_num_insns (gsi_stmt (bsi),
+					      &eni_time_weights);
 
-	  /* MUST_NOT_THROW is usually handled by runtime calling terminate and stopping
-	     stacking unwinding.  However when there is local cleanup that can resume
-	     to MUST_NOT_THROW then we generate explicit handler containing
-	     std::terminate () call.
-	     
-	     Because inlining of function can introduce new cleanup region, prior
-	     inlining we keep std::terinate () calls for every MUST_NOT_THROW containing
-	     function call.  Wast majority of these will be eliminated after inlining
-	     and crossjumping will inify possible duplicated calls.  So ignore
-	     the handlers for function body estimates.  */
+	  /* MUST_NOT_THROW is usually handled by runtime calling terminate and
+	     stopping stacking unwinding.  However when there is local cleanup
+	     that can resume to MUST_NOT_THROW then we generate explicit
+	     handler containing std::terminate () call.
+
+	     Because inlining of function can introduce new cleanup region,
+	     prior inlining we keep std::terinate () calls for every
+	     MUST_NOT_THROW containing function call.  Wast majority of these
+	     will be eliminated after inlining and crossjumping will inify
+	     possible duplicated calls.  So ignore the handlers for function
+	     body estimates.  */
 	  if (gimple_code (gsi_stmt (bsi)) == GIMPLE_LABEL
 	      && bitmap_bit_p (must_not_throw, 
 	      		       LABEL_DECL_UID (gimple_label_label (gsi_stmt (bsi)))))
 	    {
-	      if (dump_file)
-	        fprintf (dump_file, "  MUST_NOT_THROW landing pad.  Ignoring whole BB.\n");
+	      if (dump_file && (dump_flags & TDF_DETAILS))
+	        fprintf (dump_file,"  MUST_NOT_THROW landing pad.  "
+			 "Ignoring whole BB.\n");
 	    }
-	  if (dump_file)
+	  if (dump_file && (dump_flags & TDF_DETAILS))
 	    {
-	      fprintf (dump_file, "  freq:%6i size:%3i time:%3i ", freq, this_size, this_time);
+	      fprintf (dump_file, "  freq:%6i size:%3i time:%3i ", freq,
+		       this_size, this_time);
 	      print_gimple_stmt (dump_file, gsi_stmt (bsi), 0, 0);
 	    }
 	  this_time *= freq;
@@ -1780,7 +1784,7 @@ estimate_function_body_sizes (struct cgr
 	    {
 	      size_inlining_benefit += this_size;
 	      time_inlining_benefit += this_time;
-	      if (dump_file)
+	      if (dump_file && (dump_flags & TDF_DETAILS))
 		fprintf (dump_file, "    Likely eliminated\n");
 	    }
 	  gcc_assert (time >= 0);
@@ -1791,11 +1795,9 @@ estimate_function_body_sizes (struct cgr
   time_inlining_benefit = ((time_inlining_benefit + CGRAPH_FREQ_BASE / 2)
   			   / CGRAPH_FREQ_BASE);
   if (dump_file)
-    {
-      fprintf (dump_file, "Overall function body time: %i-%i size: %i-%i\n",
-               (int)time, (int)time_inlining_benefit,
-      	       size, size_inlining_benefit);
-    }
+    fprintf (dump_file, "Overall function body time: %i-%i size: %i-%i\n",
+	     (int)time, (int)time_inlining_benefit,
+	     size, size_inlining_benefit);
   time_inlining_benefit += eni_time_weights.call_cost;
   size_inlining_benefit += eni_size_weights.call_cost;
   if (!VOID_TYPE_P (TREE_TYPE (funtype)))
@@ -1818,11 +1820,9 @@ estimate_function_body_sizes (struct cgr
   inline_summary (node)->self_time = time;
   inline_summary (node)->self_size = size;
   if (dump_file)
-    {
-      fprintf (dump_file, "With function call overhead time: %i-%i size: %i-%i\n",
-               (int)time, (int)time_inlining_benefit,
-      	       size, size_inlining_benefit);
-    }
+    fprintf (dump_file, "With function call overhead time: %i-%i size: %i-%i\n",
+	     (int)time, (int)time_inlining_benefit,
+	     size, size_inlining_benefit);
   inline_summary (node)->time_inlining_benefit = time_inlining_benefit;
   inline_summary (node)->size_inlining_benefit = size_inlining_benefit;
   BITMAP_FREE (must_not_throw);



More information about the Gcc-patches mailing list