summaryrefslogtreecommitdiff
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
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
-rw-r--r--gcc/ChangeLog19
-rw-r--r--gcc/Makefile.in4
-rw-r--r--gcc/basic-block.h1
-rw-r--r--gcc/cfg.c105
-rw-r--r--gcc/haifa-sched.c2
-rw-r--r--gcc/passes.c16
-rw-r--r--gcc/rtl.h5
-rw-r--r--gcc/sched-vis.c110
-rw-r--r--gcc/tree-dump.c9
9 files changed, 197 insertions, 74 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d9f1fe421ad..2e713bcb9b7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,22 @@
+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.
+
2006-01-25 Richard Sandiford <richard@codesourcery.com>
* doc/rtl.texi (SYMBOL_REF_CONSTANT, SYMBOL_REF_DATA): Document.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 6cc74fe85fd..cda9d74bc55 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -2518,8 +2518,8 @@ sched-ebb.o : sched-ebb.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(FUNCTION_H) $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H) \
$(PARAMS_H) $(CFGLAYOUT_H) $(TARGET_H)
sched-vis.o : sched-vis.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
- $(RTL_H) $(SCHED_INT_H) hard-reg-set.h $(BASIC_BLOCK_H) $(INSN_ATTR_H) \
- $(REGS_H) $(TM_P_H) $(TARGET_H) real.h toplev.h
+ $(RTL_H) $(SCHED_INT_H) hard-reg-set.h $(BASIC_BLOCK_H) $(OBSTACK_H) \
+ $(TM_P_H) real.h toplev.h tree-pass.h
final.o : final.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
$(TREE_H) $(FLAGS_H) intl.h $(REGS_H) $(RECOG_H) conditions.h \
insn-config.h $(INSN_ATTR_H) $(FUNCTION_H) real.h output.h hard-reg-set.h \
diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index ab2d927c308..19a2de7a00f 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -514,6 +514,7 @@ extern int dfs_enumerate_from (basic_block, int,
bool (*)(basic_block, void *),
basic_block *, int, void *);
extern void compute_dominance_frontiers (bitmap *);
+extern void dump_bb_info (basic_block, bool, bool, int, const char *, FILE *);
extern void dump_edge_info (FILE *, edge, int);
extern void brief_dump_cfg (FILE *);
extern void clear_edges (void);
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);
}
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 5713e9a2cfb..ab362cbab37 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -2362,5 +2362,7 @@ sched_finish (void)
if (targetm.sched.md_finish_global)
targetm.sched.md_finish_global (sched_dump, sched_verbose);
+
+ current_sched_info = NULL;
}
#endif /* INSN_SCHEDULING */
diff --git a/gcc/passes.c b/gcc/passes.c
index 8301590d98a..5b84c397304 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -748,16 +748,20 @@ execute_todo (struct tree_opt_pass *pass, unsigned int flags, bool use_required)
if (properties & PROP_trees)
dump_function_to_file (current_function_decl,
dump_file, dump_flags);
- else if (properties & PROP_cfg)
+ else
{
- print_rtl_with_bb (dump_file, get_insns ());
-
- if (graph_dump_format != no_graph
+ if (dump_flags & TDF_SLIM)
+ print_rtl_slim_with_bb (dump_file, get_insns (), dump_flags);
+ else if (properties & PROP_cfg)
+ print_rtl_with_bb (dump_file, get_insns ());
+ else
+ print_rtl (dump_file, get_insns ());
+
+ if (properties & PROP_cfg
+ && graph_dump_format != no_graph
&& (dump_flags & TDF_GRAPH))
print_rtl_graph_with_bb (dump_file_name, get_insns ());
}
- else
- print_rtl (dump_file, get_insns ());
/* Flush the file. If verification fails, we won't be able to
close the file before aborting. */
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 03cfcb6403e..8a959b89dbd 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1988,6 +1988,11 @@ extern rtx remove_death (unsigned int, rtx);
extern void dump_combine_stats (FILE *);
extern void dump_combine_total_stats (FILE *);
+/* In sched-vis.c. */
+extern void print_rtl_slim_with_bb (FILE *, rtx, int);
+extern void dump_insn_slim (FILE *f, rtx x);
+extern void debug_insn_slim (rtx x);
+
/* In sched-rgn.c. */
extern void schedule_insns (FILE *);
diff --git a/gcc/sched-vis.c b/gcc/sched-vis.c
index 243620743cc..20129559470 100644
--- a/gcc/sched-vis.c
+++ b/gcc/sched-vis.c
@@ -25,18 +25,13 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "system.h"
#include "coretypes.h"
#include "tm.h"
-#include "toplev.h"
#include "rtl.h"
-#include "tm_p.h"
-#include "regs.h"
+#include "obstack.h"
#include "hard-reg-set.h"
#include "basic-block.h"
-#include "insn-attr.h"
#include "real.h"
#include "sched-int.h"
-#include "target.h"
-
-#ifdef INSN_SCHEDULING
+#include "tree-pass.h"
static char *safe_concat (char *, char *, const char *);
static void print_exp (char *, rtx, int);
@@ -478,6 +473,15 @@ print_value (char *buf, rtx x, int verbose)
sprintf (t, "r%d", REGNO (x));
cur = safe_concat (buf, cur, t);
}
+ if (verbose
+#ifdef INSN_SCHEDULING
+ && !current_sched_info
+#endif
+ )
+ {
+ sprintf (t, ":%s", GET_MODE_NAME (GET_MODE (x)));
+ cur = safe_concat (buf, cur, t);
+ }
break;
case SUBREG:
print_value (t, SUBREG_REG (x), verbose);
@@ -629,19 +633,23 @@ print_insn (char *buf, rtx x, int verbose)
{
case INSN:
print_pattern (t, PATTERN (x), verbose);
- if (verbose)
+#ifdef INSN_SCHEDULING
+ if (verbose && current_sched_info)
sprintf (buf, "%s: %s", (*current_sched_info->print_insn) (x, 1),
t);
else
- sprintf (buf, "%-4d %s", INSN_UID (x), t);
+#endif
+ sprintf (buf, " %4d %s", INSN_UID (x), t);
break;
case JUMP_INSN:
print_pattern (t, PATTERN (x), verbose);
- if (verbose)
+#ifdef INSN_SCHEDULING
+ if (verbose && current_sched_info)
sprintf (buf, "%s: jump %s", (*current_sched_info->print_insn) (x, 1),
t);
else
- sprintf (buf, "%-4d %s", INSN_UID (x), t);
+#endif
+ sprintf (buf, " %4d %s", INSN_UID (x), t);
break;
case CALL_INSN:
x = PATTERN (insn);
@@ -652,38 +660,94 @@ print_insn (char *buf, rtx x, int verbose)
}
else
strcpy (t, "call <...>");
- if (verbose)
+#ifdef INSN_SCHEDULING
+ if (verbose && current_sched_info)
sprintf (buf, "%s: %s", (*current_sched_info->print_insn) (x, 1), t);
else
- sprintf (buf, "%-4d %s", INSN_UID (insn), t);
+#endif
+ sprintf (buf, " %4d %s", INSN_UID (insn), t);
break;
case CODE_LABEL:
sprintf (buf, "L%d:", INSN_UID (x));
break;
case BARRIER:
- sprintf (buf, "i% 4d: barrier", INSN_UID (x));
+ sprintf (buf, "i%4d: barrier", INSN_UID (x));
break;
case NOTE:
if (NOTE_LINE_NUMBER (x) > 0)
{
expanded_location xloc;
NOTE_EXPANDED_LOCATION (xloc, x);
- sprintf (buf, "%4d note \"%s\" %d", INSN_UID (x),
+ sprintf (buf, " %4d note \"%s\" %d", INSN_UID (x),
xloc.file, xloc.line);
}
else
- sprintf (buf, "%4d %s", INSN_UID (x),
+ sprintf (buf, " %4d %s", INSN_UID (x),
GET_NOTE_INSN_NAME (NOTE_LINE_NUMBER (x)));
break;
default:
- if (verbose)
+ sprintf (buf, "i%4d <What %s?>", INSN_UID (x),
+ GET_RTX_NAME (GET_CODE (x)));
+ }
+} /* print_insn */
+
+
+/* Emit a slim dump of X (an insn) to the file F, including any register
+ note attached to the instruction. */
+void
+dump_insn_slim (FILE *f, rtx x)
+{
+ char t[BUF_LEN + 32];
+ rtx note;
+
+ print_insn (t, x, 1);
+ fputs (t, f);
+ putc ('\n', f);
+ if (INSN_P (x) && REG_NOTES (x))
+ for (note = REG_NOTES (x); note; note = XEXP (note, 1))
+ {
+ print_value (t, XEXP (note, 0), 1);
+ fprintf (f, " %s: %s\n",
+ GET_REG_NOTE_NAME (REG_NOTE_KIND (note)), t);
+ }
+}
+
+/* Emit a slim dump of X (an insn) to stderr. */
+void
+debug_insn_slim (rtx x)
+{
+ dump_insn_slim (stderr, x);
+}
+
+/* Provide a slim dump the instruction chain starting at FIRST to F, honoring
+ the dump flags given in FLAGS. Currently, TDF_BLOCKS and TDF_DETAILS
+ include more information on the basic blocks. */
+void
+print_rtl_slim_with_bb (FILE *f, rtx first, int flags)
+{
+ basic_block current_bb = NULL;
+ rtx insn;
+
+ for (insn = first; NULL != insn; insn = NEXT_INSN (insn))
+ {
+ if ((flags & TDF_BLOCKS)
+ && (INSN_P (insn) || GET_CODE (insn) == NOTE)
+ && BLOCK_FOR_INSN (insn)
+ && !current_bb)
{
- sprintf (buf, "Not an INSN at all\n");
- debug_rtx (x);
+ current_bb = BLOCK_FOR_INSN (insn);
+ dump_bb_info (current_bb, true, false, flags, ";; ", f);
+ }
+
+ dump_insn_slim (f, insn);
+
+ if ((flags & TDF_BLOCKS)
+ && current_bb
+ && insn == BB_END (current_bb))
+ {
+ dump_bb_info (current_bb, false, true, flags, ";; ", f);
+ current_bb = NULL;
}
- else
- sprintf (buf, "i%-4d <What?>", INSN_UID (x));
}
-} /* print_insn */
+}
-#endif
diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c
index ea36129cdb6..dfcf456237a 100644
--- a/gcc/tree-dump.c
+++ b/gcc/tree-dump.c
@@ -926,24 +926,25 @@ dump_end (enum tree_dump_index phase ATTRIBUTE_UNUSED, FILE *stream)
static int
dump_enable_all (int flags, int letter)
{
+ int ir_type = (flags & (TDF_TREE | TDF_RTL | TDF_IPA));
int n = 0;
size_t i;
for (i = TDI_none + 1; i < (size_t) TDI_end; i++)
- if ((dump_files[i].flags & flags)
+ if ((dump_files[i].flags & ir_type)
&& (letter == 0 || letter == dump_files[i].letter))
{
dump_files[i].state = -1;
- dump_files[i].flags = flags;
+ dump_files[i].flags |= flags;
n++;
}
for (i = 0; i < extra_dump_files_in_use; i++)
- if ((extra_dump_files[i].flags & flags)
+ if ((extra_dump_files[i].flags & ir_type)
&& (letter == 0 || letter == extra_dump_files[i].letter))
{
extra_dump_files[i].state = -1;
- extra_dump_files[i].flags = flags;
+ extra_dump_files[i].flags |= flags;
n++;
}