summaryrefslogtreecommitdiff
path: root/gcc/cfg.c
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2006-01-25 17:39:37 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2006-01-25 17:39:37 +0000
commita68e7e6c6648e57706db51b202f3e72406517b9f (patch)
tree0224d6afcc2c0d457d50b20bc90f70a16273ba21 /gcc/cfg.c
parent6d3874a7e42efbe54406950fea9c3de746971099 (diff)
downloadgcc-a68e7e6c6648e57706db51b202f3e72406517b9f.tar.gz
Makefile.in (sched-vis.o): Update dependencies.
2006-01-25 Paolo Bonzini <bonzini@gnu.org> * Makefile.in (sched-vis.o): Update dependencies. * haifa-sched.c (sched_finish): Clear current_sched_info. * cfg.c (dump_bb_info): New, split from dump_flow_info. (dump_flow_info): Call it. * passes.c (execute_todo): Call print_rtl_slim_with_bb to make a slim RTL dump. * basic-block.h (dump_bb_info): Declare. * tree-dump.c (dump_enable_all): OR the flags of a -fdump-tree-all option, and apply options only for dump files whose TDF_RTL, TDF_TREE, or TDF_IPA bits match. * rtl.h: Declare new functions exported from sched-vis.c. * sched-vis.c: Enable also if scheduling is not used. (print_value): Print the mode of registers if not inside scheduling. (print_insn): Make it work outside the scheduler. Beautify the output a bit. (dump_insn_slim, debug_insn_slim, print_rtl_slim_with_bb): New. From-SVN: r110217
Diffstat (limited to 'gcc/cfg.c')
-rw-r--r--gcc/cfg.c105
1 files changed, 66 insertions, 39 deletions
diff --git a/gcc/cfg.c b/gcc/cfg.c
index 7b2a30fea6d..feac79bc71c 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -62,6 +62,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "tm_p.h"
#include "obstack.h"
#include "timevar.h"
+#include "tree-pass.h"
#include "ggc.h"
#include "hashtab.h"
#include "alloc-pool.h"
@@ -467,11 +468,75 @@ check_bb_profile (basic_block bb, FILE * file)
}
}
+/* Emit basic block information for BB. HEADER is true if the user wants
+ the generic information and the predecessors, FOOTER is true if they want
+ the successors. FLAGS is the dump flags of interest; TDF_DETAILS emit
+ global register liveness information. PREFIX is put in front of every
+ line. The output is emitted to FILE. */
+void
+dump_bb_info (basic_block bb, bool header, bool footer, int flags,
+ const char *prefix, FILE *file)
+{
+ edge e;
+ edge_iterator ei;
+
+ if (header)
+ {
+ fprintf (file, "\n%sBasic block %d ", prefix, bb->index);
+ if (bb->prev_bb)
+ fprintf (file, ", prev %d", bb->prev_bb->index);
+ if (bb->next_bb)
+ fprintf (file, ", next %d", bb->next_bb->index);
+ fprintf (file, ", loop_depth %d, count ", bb->loop_depth);
+ fprintf (file, HOST_WIDEST_INT_PRINT_DEC, bb->count);
+ fprintf (file, ", freq %i", bb->frequency);
+ if (maybe_hot_bb_p (bb))
+ fprintf (file, ", maybe hot");
+ if (probably_never_executed_bb_p (bb))
+ fprintf (file, ", probably never executed");
+ fprintf (file, ".\n");
+
+ fprintf (file, "%sPredecessors: ", prefix);
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ dump_edge_info (file, e, 0);
+ }
+
+ if (footer)
+ {
+ fprintf (file, "\n%sSuccessors: ", prefix);
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ dump_edge_info (file, e, 1);
+ }
+
+ if ((flags & TDF_DETAILS)
+ && (bb->flags & BB_RTL))
+ {
+ if (bb->il.rtl->global_live_at_start && header)
+ {
+ fprintf (file, "\n%sRegisters live at start:", prefix);
+ dump_regset (bb->il.rtl->global_live_at_start, file);
+ }
+
+ if (bb->il.rtl->global_live_at_end && footer)
+ {
+ fprintf (file, "\n%sRegisters live at end:", prefix);
+ dump_regset (bb->il.rtl->global_live_at_end, file);
+ }
+ }
+
+ putc ('\n', file);
+}
+
void
dump_flow_info (FILE *file)
{
basic_block bb;
+ if (file == dump_file
+ && (dump_flags & TDF_SLIM)
+ && !(dump_flags & TDF_DETAILS))
+ return;
+
/* There are no pseudo registers after reload. Don't dump them. */
if (reg_n_info && !reload_completed)
{
@@ -524,45 +589,7 @@ dump_flow_info (FILE *file)
fprintf (file, "\n%d basic blocks, %d edges.\n", n_basic_blocks, n_edges);
FOR_EACH_BB (bb)
{
- edge e;
- edge_iterator ei;
-
- fprintf (file, "\nBasic block %d ", bb->index);
- fprintf (file, "prev %d, next %d, ",
- bb->prev_bb->index, bb->next_bb->index);
- fprintf (file, "loop_depth %d, count ", bb->loop_depth);
- fprintf (file, HOST_WIDEST_INT_PRINT_DEC, bb->count);
- fprintf (file, ", freq %i", bb->frequency);
- if (maybe_hot_bb_p (bb))
- fprintf (file, ", maybe hot");
- if (probably_never_executed_bb_p (bb))
- fprintf (file, ", probably never executed");
- fprintf (file, ".\n");
-
- fprintf (file, "Predecessors: ");
- FOR_EACH_EDGE (e, ei, bb->preds)
- dump_edge_info (file, e, 0);
-
- fprintf (file, "\nSuccessors: ");
- FOR_EACH_EDGE (e, ei, bb->succs)
- dump_edge_info (file, e, 1);
-
- if (bb->flags & BB_RTL)
- {
- if (bb->il.rtl->global_live_at_start)
- {
- fprintf (file, "\nRegisters live at start:");
- dump_regset (bb->il.rtl->global_live_at_start, file);
- }
-
- if (bb->il.rtl->global_live_at_end)
- {
- fprintf (file, "\nRegisters live at end:");
- dump_regset (bb->il.rtl->global_live_at_end, file);
- }
- }
-
- putc ('\n', file);
+ dump_bb_info (bb, true, true, TDF_DETAILS, "", file);
check_bb_profile (bb, file);
}