| Index: gcc/gcc/sel-sched-dump.c
|
| diff --git a/gcc/gcc/sel-sched-dump.c b/gcc/gcc/sel-sched-dump.c
|
| index 5fce7cf6b9e88a8887d1d56cc7c1d0a8bf6040d2..724ab4269cff8582d9a772de4511a59e1ae9fb58 100644
|
| --- a/gcc/gcc/sel-sched-dump.c
|
| +++ b/gcc/gcc/sel-sched-dump.c
|
| @@ -1,5 +1,5 @@
|
| /* Instruction scheduling pass. Log dumping infrastructure.
|
| - Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
|
| + Copyright (C) 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
|
|
|
| This file is part of GCC.
|
|
|
| @@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see
|
| #include "output.h"
|
| #include "basic-block.h"
|
| #include "cselib.h"
|
| +#include "target.h"
|
|
|
| #ifdef INSN_SCHEDULING
|
| #include "sel-sched-ir.h"
|
| @@ -74,7 +75,7 @@ static void
|
| switch_dump (FILE *to)
|
| {
|
| gcc_assert (saved_sched_dump == NULL);
|
| -
|
| +
|
| saved_sched_dump = sched_dump;
|
| sched_dump = to;
|
| }
|
| @@ -88,7 +89,7 @@ restore_dump (void)
|
| }
|
|
|
|
|
| -/* Functions for dumping instructions, av sets, and exprs. */
|
| +/* Functions for dumping instructions, av sets, and exprs. */
|
|
|
| /* Default flags for dumping insns. */
|
| static int dump_insn_rtx_flags = DUMP_INSN_RTX_PATTERN;
|
| @@ -218,7 +219,7 @@ debug_vinsn (vinsn_t vi)
|
| {
|
| switch_dump (stderr);
|
| dump_vinsn_1 (vi, debug_vinsn_flags);
|
| - sel_print ("\n");
|
| + sel_print ("\n");
|
| restore_dump ();
|
| }
|
|
|
| @@ -280,7 +281,7 @@ dump_expr_1 (expr_t expr, int flags)
|
| if (orig_bb != 0)
|
| sel_print ("orig_bb:%d;", orig_bb);
|
| }
|
| -
|
| +
|
| if (EXPR_TARGET_AVAILABLE (expr) < 1)
|
| sel_print ("target:%d;", EXPR_TARGET_AVAILABLE (expr));
|
| sel_print ("]");
|
| @@ -367,10 +368,10 @@ dump_av_set (av_set_t av)
|
| {
|
| av_set_iterator i;
|
| expr_t expr;
|
| -
|
| +
|
| if (!sched_dump_to_dot_p)
|
| sel_print ("{");
|
| -
|
| +
|
| FOR_EACH_EXPR (expr, i, av)
|
| {
|
| dump_expr (expr);
|
| @@ -379,7 +380,7 @@ dump_av_set (av_set_t av)
|
| else
|
| sel_print ("\n");
|
| }
|
| -
|
| +
|
| if (!sched_dump_to_dot_p)
|
| sel_print ("}");
|
| }
|
| @@ -390,7 +391,7 @@ dump_lv_set (regset lv)
|
| {
|
| sel_print ("{");
|
|
|
| - /* This code was adapted from flow.c: dump_regset (). */
|
| + /* This code was adapted from cfg.c: dump_regset (). */
|
| if (lv == NULL)
|
| sel_print ("nil");
|
| else
|
| @@ -398,7 +399,7 @@ dump_lv_set (regset lv)
|
| unsigned i;
|
| reg_set_iterator rsi;
|
| int count = 0;
|
| -
|
| +
|
| EXECUTE_IF_SET_IN_REG_SET (lv, 0, i, rsi)
|
| {
|
| sel_print (" %d", i);
|
| @@ -407,9 +408,9 @@ dump_lv_set (regset lv)
|
| sel_print (" [%s]", reg_names[i]);
|
| ++count;
|
| }
|
| -
|
| +
|
| ++count;
|
| -
|
| +
|
| if (sched_dump_to_dot_p && count == 12)
|
| {
|
| count = 0;
|
| @@ -417,7 +418,7 @@ dump_lv_set (regset lv)
|
| }
|
| }
|
| }
|
| -
|
| +
|
| sel_print ("}\n");
|
| }
|
|
|
| @@ -439,7 +440,7 @@ dump_blist (blist_t bnds)
|
| for (; bnds; bnds = BLIST_NEXT (bnds))
|
| {
|
| bnd_t bnd = BLIST_BND (bnds);
|
| -
|
| +
|
| sel_print ("[to: %d; ptr: ", INSN_UID (BND_TO (bnd)));
|
| dump_ilist (BND_PTR (bnd));
|
| sel_print ("] ");
|
| @@ -464,7 +465,7 @@ dump_insn_vector (rtx_vec_t succs)
|
| {
|
| int i;
|
| rtx succ;
|
| -
|
| +
|
| for (i = 0; VEC_iterate (rtx, succs, i, succ); i++)
|
| if (succ)
|
| dump_insn (succ);
|
| @@ -500,16 +501,16 @@ sel_print_insn (const_rtx insn, int aligned ATTRIBUTE_UNUSED)
|
| {
|
| static char buf[80];
|
|
|
| - /* '+' before insn means it is a new cycle start and it's not been
|
| + /* '+' before insn means it is a new cycle start and it's not been
|
| scheduled yet. '>' - has been scheduled. */
|
| if (s_i_d && INSN_LUID (insn) > 0)
|
| if (GET_MODE (insn) == TImode)
|
| - sprintf (buf, "%s %4d",
|
| - INSN_SCHED_TIMES (insn) > 0 ? "> " : "< ",
|
| + sprintf (buf, "%s %4d",
|
| + INSN_SCHED_TIMES (insn) > 0 ? "> " : "< ",
|
| INSN_UID (insn));
|
| else
|
| - sprintf (buf, "%s %4d",
|
| - INSN_SCHED_TIMES (insn) > 0 ? "! " : " ",
|
| + sprintf (buf, "%s %4d",
|
| + INSN_SCHED_TIMES (insn) > 0 ? "! " : " ",
|
| INSN_UID (insn));
|
| else
|
| if (GET_MODE (insn) == TImode)
|
| @@ -537,7 +538,7 @@ replace_str_in_buf (char *buf, const char *str1, const char *str2)
|
| do
|
| {
|
| p = strstr (p, str1);
|
| - if (p)
|
| + if (p)
|
| {
|
| char *p1 = p + str1_len;
|
| /* Copy the rest of buf and '\0'. */
|
| @@ -555,7 +556,7 @@ replace_str_in_buf (char *buf, const char *str1, const char *str2)
|
| /* Copy str2. */
|
| for (i = 0; i < str2_len; i++)
|
| p[i] = str2[i];
|
| -
|
| +
|
| p += str2_len;
|
| buf_len += diff;
|
| }
|
| @@ -565,12 +566,12 @@ replace_str_in_buf (char *buf, const char *str1, const char *str2)
|
| }
|
|
|
| /* Replace characters in BUF that have special meaning in .dot file. */
|
| -void
|
| +static void
|
| sel_prepare_string_for_dot_label (char *buf)
|
| {
|
| static char specials_from[7][2] = { "<", ">", "{", "|", "}", "\"",
|
| "\n" };
|
| - static char specials_to[7][3] = { "\\<", "\\>", "\\{", "\\|", "\\}",
|
| + static char specials_to[7][3] = { "\\<", "\\>", "\\{", "\\|", "\\}",
|
| "\\\"", "\\l" };
|
| unsigned i;
|
|
|
| @@ -578,6 +579,28 @@ sel_prepare_string_for_dot_label (char *buf)
|
| replace_str_in_buf (buf, specials_from[i], specials_to[i]);
|
| }
|
|
|
| +/* This function acts like printf but dumps to the sched_dump file. */
|
| +void
|
| +sel_print (const char *fmt, ...)
|
| +{
|
| + va_list ap;
|
| + va_start (ap, fmt);
|
| + if (sched_dump_to_dot_p)
|
| + {
|
| + char *message;
|
| + if (vasprintf (&message, fmt, ap) >= 0 && message != NULL)
|
| + {
|
| + message = (char *) xrealloc (message, 2 * strlen (message) + 1);
|
| + sel_prepare_string_for_dot_label (message);
|
| + fprintf (sched_dump, "%s", message);
|
| + free (message);
|
| + }
|
| + }
|
| + else
|
| + vfprintf (sched_dump, fmt, ap);
|
| + va_end (ap);
|
| +}
|
| +
|
| /* Dump INSN with FLAGS. */
|
| static void
|
| sel_dump_cfg_insn (insn_t insn, int flags)
|
| @@ -800,7 +823,7 @@ sel_dump_cfg_2 (FILE *f, int flags)
|
| sched_dump_to_dot_p = false;
|
| }
|
|
|
| -/* Dump a cfg region to the file specified by TAG honoring flags.
|
| +/* Dump a cfg region to the file specified by TAG honoring flags.
|
| The file is created by the function. */
|
| static void
|
| sel_dump_cfg_1 (const char *tag, int flags)
|
| @@ -931,10 +954,13 @@ rtx
|
| debug_mem_addr_value (rtx x)
|
| {
|
| rtx t, addr;
|
| + enum machine_mode address_mode;
|
|
|
| gcc_assert (MEM_P (x));
|
| + address_mode = targetm.addr_space.address_mode (MEM_ADDR_SPACE (x));
|
| +
|
| t = shallow_copy_rtx (x);
|
| - if (cselib_lookup (XEXP (t, 0), Pmode, 0))
|
| + if (cselib_lookup (XEXP (t, 0), address_mode, 0))
|
| XEXP (t, 0) = cselib_subst_to_values (XEXP (t, 0));
|
|
|
| t = canon_rtx (t);
|
|
|