Commit 3e28fe44 by Michael Meissner Committed by Michael Meissner

For phases starting with flow, print basic block information when doing dumps

From-SVN: r15082
parent 417b0fa2
Thu Sep 4 15:01:49 1997 Michael Meissner <meissner@cygnus.com>
* toplev.c (rest_of_compilation): For passes starting with
flow_analysis, use print_rtl_with_bb instead of print_rtl.
* print-rtl.c (print_rtl_single): Print a single rtl value to a
file.
* flow.c (print_rtl_with_bb): Print which insns start and end
basic blocks. For the start of a basic block, also print the live
information.
Thu Sep 4 11:51:43 1997 Jim Wilson <wilson@cygnus.com> Thu Sep 4 11:51:43 1997 Jim Wilson <wilson@cygnus.com>
* toplev.c (main): Change #elif to #else/#ifdef * toplev.c (main): Change #elif to #else/#ifdef
......
...@@ -2933,3 +2933,82 @@ dump_flow_info (file) ...@@ -2933,3 +2933,82 @@ dump_flow_info (file)
} }
fprintf (file, "\n"); fprintf (file, "\n");
} }
/* Like print_rtl, but also print out live information for the start of each
basic block. */
void
print_rtl_with_bb (outf, rtx_first)
FILE *outf;
rtx rtx_first;
{
register rtx tmp_rtx;
if (rtx_first == 0)
fprintf (outf, "(nil)\n");
else
{
int i, bb;
enum bb_state { NOT_IN_BB, IN_ONE_BB, IN_MULTIPLE_BB };
int max_uid = get_max_uid ();
int *start = alloca (max_uid * sizeof (int));
int *end = alloca (max_uid * sizeof (int));
char *in_bb_p = alloca (max_uid * sizeof (enum bb_state));
for (i = 0; i < max_uid; i++)
{
start[i] = end[i] = -1;
in_bb_p[i] = NOT_IN_BB;
}
for (i = n_basic_blocks-1; i >= 0; i--)
{
rtx x;
start[INSN_UID (basic_block_head[i])] = i;
end[INSN_UID (basic_block_end[i])] = i;
for (x = basic_block_head[i]; x != NULL_RTX; x = NEXT_INSN (x))
{
in_bb_p[ INSN_UID(x)] =
((in_bb_p[ INSN_UID(x)] == NOT_IN_BB)
? IN_ONE_BB
: IN_MULTIPLE_BB);
if (x == basic_block_end[i])
break;
}
}
for (tmp_rtx = rtx_first; NULL != tmp_rtx; tmp_rtx = NEXT_INSN (tmp_rtx))
{
if ((bb = start[INSN_UID (tmp_rtx)]) >= 0)
{
fprintf (outf, ";; Start of basic block %d, registers live:",
bb);
EXECUTE_IF_SET_IN_REG_SET (basic_block_live_at_start[bb], 0, i,
{
fprintf (outf, " %d", i);
if (i < FIRST_PSEUDO_REGISTER)
fprintf (outf, " [%s]",
reg_names[i]);
});
putc ('\n', outf);
}
if (in_bb_p[ INSN_UID(tmp_rtx)] == NOT_IN_BB
&& GET_CODE (tmp_rtx) != NOTE
&& GET_CODE (tmp_rtx) != BARRIER)
fprintf (outf, ";; Insn is not within a basic block\n");
else if (in_bb_p[ INSN_UID(tmp_rtx)] == IN_MULTIPLE_BB)
fprintf (outf, ";; Insn is in multiple basic blocks\n");
print_rtl_single (outf, tmp_rtx);
if ((bb = end[INSN_UID (tmp_rtx)]) >= 0)
fprintf (outf, ";; End of basic block %d\n", bb);
putc ('\n', outf);
}
}
}
...@@ -345,3 +345,16 @@ print_rtl (outf, rtx_first) ...@@ -345,3 +345,16 @@ print_rtl (outf, rtx_first)
print_rtx (rtx_first); print_rtx (rtx_first);
} }
} }
/* Like print_rtx, except specify a file. */
void
print_rtl_single (outf, x)
FILE *outf;
rtx x;
{
outfile = outf;
sawclose = 0;
print_rtx (x);
putc ('\n', outf);
}
...@@ -3350,7 +3350,7 @@ rest_of_compilation (decl) ...@@ -3350,7 +3350,7 @@ rest_of_compilation (decl)
if (flow_dump) if (flow_dump)
TIMEVAR (dump_time, TIMEVAR (dump_time,
{ {
print_rtl (flow_dump_file, insns); print_rtl_with_bb (flow_dump_file, insns);
fflush (flow_dump_file); fflush (flow_dump_file);
}); });
...@@ -3367,7 +3367,7 @@ rest_of_compilation (decl) ...@@ -3367,7 +3367,7 @@ rest_of_compilation (decl)
fprintf (combine_dump_file, "\n;; Function %s\n\n", fprintf (combine_dump_file, "\n;; Function %s\n\n",
(*decl_printable_name) (decl, 2)); (*decl_printable_name) (decl, 2));
dump_combine_stats (combine_dump_file); dump_combine_stats (combine_dump_file);
print_rtl (combine_dump_file, insns); print_rtl_with_bb (combine_dump_file, insns);
fflush (combine_dump_file); fflush (combine_dump_file);
}); });
...@@ -3387,7 +3387,7 @@ rest_of_compilation (decl) ...@@ -3387,7 +3387,7 @@ rest_of_compilation (decl)
if (regmove_dump) if (regmove_dump)
TIMEVAR (dump_time, TIMEVAR (dump_time,
{ {
print_rtl (regmove_dump_file, insns); print_rtl_with_bb (regmove_dump_file, insns);
fflush (regmove_dump_file); fflush (regmove_dump_file);
}); });
...@@ -3414,7 +3414,7 @@ rest_of_compilation (decl) ...@@ -3414,7 +3414,7 @@ rest_of_compilation (decl)
if (sched_dump) if (sched_dump)
TIMEVAR (dump_time, TIMEVAR (dump_time,
{ {
print_rtl (sched_dump_file, insns); print_rtl_with_bb (sched_dump_file, insns);
fflush (sched_dump_file); fflush (sched_dump_file);
}); });
...@@ -3437,7 +3437,7 @@ rest_of_compilation (decl) ...@@ -3437,7 +3437,7 @@ rest_of_compilation (decl)
(*decl_printable_name) (decl, 2)); (*decl_printable_name) (decl, 2));
dump_flow_info (local_reg_dump_file); dump_flow_info (local_reg_dump_file);
dump_local_alloc (local_reg_dump_file); dump_local_alloc (local_reg_dump_file);
print_rtl (local_reg_dump_file, insns); print_rtl_with_bb (local_reg_dump_file, insns);
fflush (local_reg_dump_file); fflush (local_reg_dump_file);
}); });
...@@ -3466,7 +3466,7 @@ rest_of_compilation (decl) ...@@ -3466,7 +3466,7 @@ rest_of_compilation (decl)
TIMEVAR (dump_time, TIMEVAR (dump_time,
{ {
dump_global_regs (global_reg_dump_file); dump_global_regs (global_reg_dump_file);
print_rtl (global_reg_dump_file, insns); print_rtl_with_bb (global_reg_dump_file, insns);
fflush (global_reg_dump_file); fflush (global_reg_dump_file);
}); });
...@@ -3505,7 +3505,7 @@ rest_of_compilation (decl) ...@@ -3505,7 +3505,7 @@ rest_of_compilation (decl)
if (sched2_dump) if (sched2_dump)
TIMEVAR (dump_time, TIMEVAR (dump_time,
{ {
print_rtl (sched2_dump_file, insns); print_rtl_with_bb (sched2_dump_file, insns);
fflush (sched2_dump_file); fflush (sched2_dump_file);
}); });
} }
...@@ -3533,7 +3533,7 @@ rest_of_compilation (decl) ...@@ -3533,7 +3533,7 @@ rest_of_compilation (decl)
{ {
fprintf (jump2_opt_dump_file, "\n;; Function %s\n\n", fprintf (jump2_opt_dump_file, "\n;; Function %s\n\n",
(*decl_printable_name) (decl, 2)); (*decl_printable_name) (decl, 2));
print_rtl (jump2_opt_dump_file, insns); print_rtl_with_bb (jump2_opt_dump_file, insns);
fflush (jump2_opt_dump_file); fflush (jump2_opt_dump_file);
}); });
...@@ -3555,7 +3555,7 @@ rest_of_compilation (decl) ...@@ -3555,7 +3555,7 @@ rest_of_compilation (decl)
{ {
fprintf (dbr_sched_dump_file, "\n;; Function %s\n\n", fprintf (dbr_sched_dump_file, "\n;; Function %s\n\n",
(*decl_printable_name) (decl, 2)); (*decl_printable_name) (decl, 2));
print_rtl (dbr_sched_dump_file, insns); print_rtl_with_bb (dbr_sched_dump_file, insns);
fflush (dbr_sched_dump_file); fflush (dbr_sched_dump_file);
}); });
} }
...@@ -3576,7 +3576,7 @@ rest_of_compilation (decl) ...@@ -3576,7 +3576,7 @@ rest_of_compilation (decl)
{ {
fprintf (stack_reg_dump_file, "\n;; Function %s\n\n", fprintf (stack_reg_dump_file, "\n;; Function %s\n\n",
(*decl_printable_name) (decl, 2)); (*decl_printable_name) (decl, 2));
print_rtl (stack_reg_dump_file, insns); print_rtl_with_bb (stack_reg_dump_file, insns);
fflush (stack_reg_dump_file); fflush (stack_reg_dump_file);
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment