diff mbox series

[7/8] tree-ssa-loop-im.c port from fprintf to the dump API

Message ID 1529008375-20819-8-git-send-email-dmalcolm@redhat.com
State New
Headers show
Series v2 of optimization records patch kit | expand

Commit Message

David Malcolm June 14, 2018, 8:32 p.m. UTC
More porting from fprintf to using the dump API, so that
the messages appear in -fopt-info etc.

Note how these messages aren't consolidated into one
optimization record by the v2 patch kit.

gcc/ChangeLog:
	* tree-ssa-loop-im.c (move_computations_worker): Port from
	fprintf to the dump API.
---
 gcc/tree-ssa-loop-im.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 01a954e..b701171 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -1117,12 +1117,16 @@  move_computations_worker (basic_block bb)
 	  continue;
 	}
 
-      if (dump_file && (dump_flags & TDF_DETAILS))
+      if (dump_enabled_p ())
 	{
-	  fprintf (dump_file, "Moving PHI node\n");
-	  print_gimple_stmt (dump_file, stmt, 0);
-	  fprintf (dump_file, "(cost %u) out of loop %d.\n\n",
-		   cost, level->num);
+	  /* FIXME: consolidation etc.  */
+	  dump_printf_loc (MSG_OPTIMIZED_LOCATIONS | TDF_DETAILS, stmt,
+			   "Moving PHI node\n");
+	  dump_gimple_stmt (MSG_OPTIMIZED_LOCATIONS | TDF_DETAILS, TDF_SLIM,
+			    stmt, 0);
+	  dump_printf (MSG_OPTIMIZED_LOCATIONS | TDF_DETAILS,
+		       " (cost %u) out of loop %d.\n\n",
+		       cost, level->num);
 	}
 
       if (gimple_phi_num_args (stmt) == 1)
@@ -1186,12 +1190,14 @@  move_computations_worker (basic_block bb)
       if (gimple_code (stmt) == GIMPLE_COND)
 	continue;
 
-      if (dump_file && (dump_flags & TDF_DETAILS))
+      if (dump_enabled_p ())
 	{
-	  fprintf (dump_file, "Moving statement\n");
-	  print_gimple_stmt (dump_file, stmt, 0);
-	  fprintf (dump_file, "(cost %u) out of loop %d.\n\n",
-		   cost, level->num);
+	  dump_printf_loc (MSG_OPTIMIZED_LOCATIONS | TDF_DETAILS, stmt,
+			   "Moving statement\n");
+	  dump_gimple_stmt (MSG_OPTIMIZED_LOCATIONS | TDF_DETAILS, TDF_SLIM, stmt, 0);
+	  dump_printf (MSG_OPTIMIZED_LOCATIONS | TDF_DETAILS,
+		       "(cost %u) out of loop %d.\n\n",
+		       cost, level->num);
 	}
 
       e = loop_preheader_edge (level);