@@ -25,6 +25,7 @@
#include "backend.h"
#include "tree.h"
#include "gimple.h"
+#include "tree-pretty-print.h"
#include "gimple-iterator.h"
#include "cfganal.h"
#include "diagnostic-move-history.h"
@@ -263,3 +264,69 @@ set_move_history_to_stmts_in_bb (basic_block bb, edge entry,
return true;
}
+
+/* Dump the move_history data structure MV_HISTORY. */
+
+void
+dump_move_history (FILE *file, move_history_t mv_history)
+{
+ fprintf (file, "The move history is: \n");
+ if (!mv_history)
+ {
+ fprintf (file, "No move history.\n");
+ return;
+ }
+
+ for (move_history_t cur_ch = mv_history; cur_ch;
+ cur_ch = cur_ch->prev_move)
+ {
+ expanded_location exploc_cond = expand_location (cur_ch->condition);
+
+ if (exploc_cond.file)
+ fprintf (file, "[%s:", exploc_cond.file);
+ fprintf (file, "%d, ", exploc_cond.line);
+ fprintf (file, "%d] ", exploc_cond.column);
+
+ fprintf (file, "%s ", cur_ch->is_true_path ? "true" : "false");
+ const char *reason = NULL;
+ switch (cur_ch->reason)
+ {
+ case COPY_BY_THREAD_JUMP:
+ reason = "copy_by_thread_jump";
+ break;
+ case COPY_BY_ISOLATE_PATH:
+ reason = "copy_by_isolate_path";
+ break;
+ case MOVE_BY_SINK:
+ reason = "move_by_sink";
+ break;
+ default:
+ reason = "UNKNOWN";
+ break;
+ }
+ fprintf (file, "%s \n", reason);
+ }
+}
+
+/* Dump the move_history date structure attached to the gimple STMT. */
+void
+dump_move_history_for (FILE *file, const gimple *stmt)
+{
+ move_history_t mv_history = get_move_history (stmt);
+ if (!mv_history)
+ fprintf (file, "No move history.\n");
+ else
+ dump_move_history (file, mv_history);
+}
+
+DEBUG_FUNCTION void
+debug_mv_h (const move_history_t mv_history)
+{
+ dump_move_history (stderr, mv_history);
+}
+
+DEBUG_FUNCTION void
+debug_mv_h (const gimple * stmt)
+{
+ dump_move_history_for (stderr, stmt);
+}
@@ -88,5 +88,7 @@ extern bool set_move_history_to_stmt (gimple *, edge,
of the entry edge. */
extern bool set_move_history_to_stmts_in_bb (basic_block, edge,
bool, enum move_reason);
+extern void dump_move_history (FILE *, move_history_t);
+extern void dump_move_history_for (FILE *, const gimple *);
#endif // DIAGNOSTIC_MOVE_HISTORY_H
@@ -176,6 +176,16 @@ isolate_path (basic_block bb, basic_block duplicate,
incoming edge. */
if (flag_diagnostics_details)
{
+ if (dump_file)
+ {
+ fprintf (dump_file, "Set move history for stmts of B[%d]"
+ " as not on the destination of the edge\n",
+ bb->index);
+ fprintf (dump_file, "Set move history for stmts of B[%d]"
+ " as on the destination of the edge\n",
+ duplicate->index);
+ }
+
set_move_history_to_stmts_in_bb (bb, e, false, COPY_BY_ISOLATE_PATH);
set_move_history_to_stmts_in_bb (duplicate, e,
true, COPY_BY_ISOLATE_PATH);
@@ -765,7 +765,15 @@ sink_code_in_bb (basic_block bb, virtual_operand_live &vop_live)
auto_vec<edge> edge_chain = get_edge_chain (bb, gsi_bb (togsi));
for (edge entry : edge_chain)
- set_move_history_to_stmt (stmt, entry, true, MOVE_BY_SINK);
+ {
+ set_move_history_to_stmt (stmt, entry, true, MOVE_BY_SINK);
+ if (dump_file)
+ fprintf (dump_file, " Set move history for the stmt"
+ " as on the destination of the edge"
+ " from bb %d to bb %d\n", entry->src->index,
+ entry->dest->index);
+
+ }
}
/* Update virtual operands of statements in the path we
@@ -1348,6 +1348,15 @@ ssa_redirect_edges (struct redirection_data **slot,
incoming edge. */
if (flag_diagnostics_details)
{
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Set move history for stmts of B[%d]"
+ " as not on the destination of the edge\n",
+ e->dest->index);
+ fprintf (dump_file, "Set move history for stmts of B[%d]"
+ " as on the destination of the edge\n",
+ rd->dup_blocks[0]->index);
+ }
set_move_history_to_stmts_in_bb (e->dest, e, false,
COPY_BY_THREAD_JUMP);
set_move_history_to_stmts_in_bb (rd->dup_blocks[0], e,
@@ -2438,6 +2447,15 @@ back_jt_path_registry::duplicate_thread_path (edge entry,
for (i = 0; i < n_region; i++)
if (flag_diagnostics_details)
{
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Set move history for stmts of B[%d]"
+ " as not on the destination of the edge\n",
+ region[i]->index);
+ fprintf (dump_file, "Set move history for stmts of B[%d]"
+ " as on the destination of the edge\n",
+ region_copy[i]->index);
+ }
set_move_history_to_stmts_in_bb (region[i], entry, false,
COPY_BY_THREAD_JUMP);
set_move_history_to_stmts_in_bb (region_copy[i], entry,