diff options
Diffstat (limited to 'gcc/sched-vis.c')
-rw-r--r-- | gcc/sched-vis.c | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/gcc/sched-vis.c b/gcc/sched-vis.c index 242791ba9e1..2544338d646 100644 --- a/gcc/sched-vis.c +++ b/gcc/sched-vis.c @@ -29,13 +29,11 @@ along with GCC; see the file COPYING3. If not see #include "hard-reg-set.h" #include "basic-block.h" #include "real.h" +#include "insn-attr.h" #include "sched-int.h" #include "tree-pass.h" static char *safe_concat (char *, char *, const char *); -static void print_exp (char *, const_rtx, int); -static void print_value (char *, const_rtx, int); -static void print_pattern (char *, const_rtx, int); #define BUF_LEN 2048 @@ -425,7 +423,7 @@ print_exp (char *buf, const_rtx x, int verbose) /* Prints rtxes, I customarily classified as values. They're constants, registers, labels, symbols and memory accesses. */ -static void +void print_value (char *buf, const_rtx x, int verbose) { char t[BUF_LEN]; @@ -532,7 +530,7 @@ print_value (char *buf, const_rtx x, int verbose) /* The next step in insn detalization, its pattern recognition. */ -static void +void print_pattern (char *buf, const_rtx x, int verbose) { char t1[BUF_LEN], t2[BUF_LEN], t3[BUF_LEN]; @@ -643,10 +641,10 @@ print_pattern (char *buf, const_rtx x, int verbose) depends now on sched.c inner variables ...) */ void -print_insn (char *buf, rtx x, int verbose) +print_insn (char *buf, const_rtx x, int verbose) { char t[BUF_LEN]; - rtx insn = x; + const_rtx insn = x; switch (GET_CODE (x)) { @@ -681,7 +679,7 @@ print_insn (char *buf, rtx x, int verbose) strcpy (t, "call <...>"); #ifdef INSN_SCHEDULING if (verbose && current_sched_info) - sprintf (buf, "%s: %s", (*current_sched_info->print_insn) (x, 1), t); + sprintf (buf, "%s: %s", (*current_sched_info->print_insn) (insn, 1), t); else #endif sprintf (buf, " %4d %s", INSN_UID (insn), t); @@ -702,7 +700,6 @@ print_insn (char *buf, rtx x, int verbose) } } /* print_insn */ - /* Emit a slim dump of X (an insn) to the file F, including any register note attached to the instruction. */ void @@ -736,10 +733,21 @@ debug_insn_slim (rtx x) void print_rtl_slim_with_bb (FILE *f, rtx first, int flags) { + print_rtl_slim (f, first, NULL, -1, flags); +} + +/* Same as above, but stop at LAST or when COUNT == 0. + If COUNT < 0 it will stop only at LAST or NULL rtx. */ +void +print_rtl_slim (FILE *f, rtx first, rtx last, int count, int flags) +{ basic_block current_bb = NULL; - rtx insn; + rtx insn, tail; - for (insn = first; NULL != insn; insn = NEXT_INSN (insn)) + tail = last ? NEXT_INSN (last) : NULL_RTX; + for (insn = first; + (insn != NULL) && (insn != tail) && (count != 0); + insn = NEXT_INSN (insn)) { if ((flags & TDF_BLOCKS) && (INSN_P (insn) || GET_CODE (insn) == NOTE) @@ -759,6 +767,21 @@ print_rtl_slim_with_bb (FILE *f, rtx first, int flags) dump_bb_info (current_bb, false, true, flags, ";; ", f); current_bb = NULL; } + if (count > 0) + count--; } } +void +debug_bb_slim (struct basic_block_def *bb) +{ + print_rtl_slim (stderr, BB_HEAD (bb), BB_END (bb), -1, 32); +} + +void +debug_bb_n_slim (int n) +{ + struct basic_block_def *bb = BASIC_BLOCK (n); + debug_bb_slim (bb); +} + |