diff options
author | Michael Meissner <meissner@cygnus.com> | 1997-09-04 19:15:50 +0000 |
---|---|---|
committer | Michael Meissner <meissner@gcc.gnu.org> | 1997-09-04 19:15:50 +0000 |
commit | 3e28fe4442551e4d0014159ecbdb95521e278956 (patch) | |
tree | 992f01f05d3d923c09f01383c24bf63b264414f6 /gcc | |
parent | 417b0fa21150c9049decf23ffff6e5ccbaaac0d3 (diff) | |
download | gcc-3e28fe4442551e4d0014159ecbdb95521e278956.zip gcc-3e28fe4442551e4d0014159ecbdb95521e278956.tar.gz gcc-3e28fe4442551e4d0014159ecbdb95521e278956.tar.bz2 |
For phases starting with flow, print basic block information when doing dumps
From-SVN: r15082
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/flow.c | 79 | ||||
-rw-r--r-- | gcc/print-rtl.c | 13 | ||||
-rw-r--r-- | gcc/toplev.c | 20 |
4 files changed, 114 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fbaba78..b1bee7c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +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> * toplev.c (main): Change #elif to #else/#ifdef @@ -2933,3 +2933,82 @@ dump_flow_info (file) } 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); + } + } +} diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c index 1073288..bb4ee0d 100644 --- a/gcc/print-rtl.c +++ b/gcc/print-rtl.c @@ -345,3 +345,16 @@ print_rtl (outf, 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); +} diff --git a/gcc/toplev.c b/gcc/toplev.c index 156310b..d1ddf20 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -3350,7 +3350,7 @@ rest_of_compilation (decl) if (flow_dump) TIMEVAR (dump_time, { - print_rtl (flow_dump_file, insns); + print_rtl_with_bb (flow_dump_file, insns); fflush (flow_dump_file); }); @@ -3367,7 +3367,7 @@ rest_of_compilation (decl) fprintf (combine_dump_file, "\n;; Function %s\n\n", (*decl_printable_name) (decl, 2)); dump_combine_stats (combine_dump_file); - print_rtl (combine_dump_file, insns); + print_rtl_with_bb (combine_dump_file, insns); fflush (combine_dump_file); }); @@ -3387,7 +3387,7 @@ rest_of_compilation (decl) if (regmove_dump) TIMEVAR (dump_time, { - print_rtl (regmove_dump_file, insns); + print_rtl_with_bb (regmove_dump_file, insns); fflush (regmove_dump_file); }); @@ -3414,7 +3414,7 @@ rest_of_compilation (decl) if (sched_dump) TIMEVAR (dump_time, { - print_rtl (sched_dump_file, insns); + print_rtl_with_bb (sched_dump_file, insns); fflush (sched_dump_file); }); @@ -3437,7 +3437,7 @@ rest_of_compilation (decl) (*decl_printable_name) (decl, 2)); dump_flow_info (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); }); @@ -3466,7 +3466,7 @@ rest_of_compilation (decl) TIMEVAR (dump_time, { 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); }); @@ -3505,7 +3505,7 @@ rest_of_compilation (decl) if (sched2_dump) TIMEVAR (dump_time, { - print_rtl (sched2_dump_file, insns); + print_rtl_with_bb (sched2_dump_file, insns); fflush (sched2_dump_file); }); } @@ -3533,7 +3533,7 @@ rest_of_compilation (decl) { fprintf (jump2_opt_dump_file, "\n;; Function %s\n\n", (*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); }); @@ -3555,7 +3555,7 @@ rest_of_compilation (decl) { fprintf (dbr_sched_dump_file, "\n;; Function %s\n\n", (*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); }); } @@ -3576,7 +3576,7 @@ rest_of_compilation (decl) { fprintf (stack_reg_dump_file, "\n;; Function %s\n\n", (*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); }); } |