summaryrefslogtreecommitdiff
path: root/gcc/sched-vis.c
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-27 22:26:15 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-27 22:26:15 +0000
commit6dde9719053873bec1aa0fe32c86c2715027071a (patch)
tree5a205a6205f6e25e3d64b5c9f8227e22e33ff3db /gcc/sched-vis.c
parentd115204161af3b52f016d207d9bc80c3e40500f1 (diff)
downloadgcc-6dde9719053873bec1aa0fe32c86c2715027071a.tar.gz
* rtl.h (debug_bb_n_slim, debug_bb_slim, debug_insn_slim): Remove
prototypes. (debug_rtl_slim): Rename to dump_rtl_slim. (print_value_slim): Rename to dump_value_slim. * ira.c (ira_update_equiv_info_by_shuffle_insn): Update print_value_slim user. * lra.c (lra_process_new_insns): Use dump_insn_slim to dump single insns. Use dump_rtl_slim for insn chains. * lra-constraints.c (get_reload_reg): Update print_value_slim user. (process_addr_reg): Likewise. (equiv_address_substitution): Likewise. (inherit_reload_reg): Likewise. Use dump_insn_slim to dump single insns. (check_and_process_move): Likewise. (lra_constraints): Likewise. (split_reg): Likewise. (update_ebb_live_info): Likewise. (remove_inheritance_pseudos): Likewise. * sched-vis.c: Don't include sched-int.h. Remove #ifdef INSN_SCHEDULING tests. (print_value_slim): Rename to dump_value_slim. Simplify a few cases using GET_RTX_NAME. (print_pattern): Do not handle UNSPEC and UNSPECV here, explain why. (print_insn): Reorganize code to be independent of INSN_SCHEDULING. Always print CALL_INSN patterns. Harmonize INSN_UID dumping template. Handle NOTE_INSN_CALL_ARG_LOCATION. (dump_rtl_slim): Copied from debug_rtl_slim. (debug_rtl_slim): Wrapper around dump_rtl_slim to stderr. * haifa-sched.c (schedule_insn): Update print_insn user. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193873 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sched-vis.c')
-rw-r--r--gcc/sched-vis.c191
1 files changed, 77 insertions, 114 deletions
diff --git a/gcc/sched-vis.c b/gcc/sched-vis.c
index 9572a47dc46..18a3f07d4d5 100644
--- a/gcc/sched-vis.c
+++ b/gcc/sched-vis.c
@@ -1,6 +1,5 @@
-/* Instruction scheduling pass.
- Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010
+/* Printing of RTL in "slim", mnemonic like form.
+ Copyright (C) 1992-2012
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by,
and currently maintained by, Jim Wilson (wilson@cygnus.com)
@@ -20,6 +19,10 @@ for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
+
+/* Historically this form of RTL dumping was introduced along with
+ the Haifa instruction scheduling pass, hence the name of this file.
+ But there is nothing in this file left that is scheduler-specific. */
#include "config.h"
#include "system.h"
@@ -31,7 +34,6 @@ along with GCC; see the file COPYING3. If not see
#include "hard-reg-set.h"
#include "basic-block.h"
#include "insn-attr.h"
-#include "sched-int.h"
#include "dumpfile.h" /* for the TDF_* flags */
static char *safe_concat (char *, char *, const char *);
@@ -498,11 +500,7 @@ print_value (char *buf, const_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
- )
+ if (verbose)
{
sprintf (t, ":%s", GET_MODE_NAME (GET_MODE (x)));
cur = safe_concat (buf, cur, t);
@@ -553,7 +551,7 @@ print_value (char *buf, const_rtx x, int verbose)
memory. */
void
-print_value_slim (FILE *f, const_rtx x, int verbose)
+dump_value_slim (FILE *f, const_rtx x, int verbose)
{
char buf[BUF_LEN];
@@ -590,12 +588,9 @@ print_pattern (char *buf, const_rtx x, int verbose)
print_exp (buf, x, verbose);
break;
case CLOBBER:
- print_value (t1, XEXP (x, 0), verbose);
- sprintf (buf, "clobber %s", t1);
- break;
case USE:
print_value (t1, XEXP (x, 0), verbose);
- sprintf (buf, "use %s", t1);
+ sprintf (buf, "%s %s", GET_RTX_NAME (GET_CODE (x)), t1);
break;
case VAR_LOCATION:
print_value (t1, PAT_VAR_LOCATION_LOC (x), verbose);
@@ -657,151 +652,102 @@ print_pattern (char *buf, const_rtx x, int verbose)
sprintf (buf, "trap_if %s", t1);
break;
case UNSPEC:
- {
- int i;
-
- sprintf (t1, "unspec{");
- for (i = 0; i < XVECLEN (x, 0); i++)
- {
- print_pattern (t2, XVECEXP (x, 0, i), verbose);
- sprintf (t3, "%s%s;", t1, t2);
- strcpy (t1, t3);
- }
- sprintf (buf, "%s}", t1);
- }
- break;
case UNSPEC_VOLATILE:
- {
- int i;
-
- sprintf (t1, "unspec/v{");
- for (i = 0; i < XVECLEN (x, 0); i++)
- {
- print_pattern (t2, XVECEXP (x, 0, i), verbose);
- sprintf (t3, "%s%s;", t1, t2);
- strcpy (t1, t3);
- }
- sprintf (buf, "%s}", t1);
- }
- break;
+ /* Fallthru -- leave UNSPECs to print_exp. */
default:
print_value (buf, x, verbose);
}
} /* print_pattern */
-/* This is the main function in rtl visualization mechanism. It
- accepts an rtx and tries to recognize it as an insn, then prints it
- properly in human readable form, resembling assembler mnemonics.
- For every insn it prints its UID and BB the insn belongs too.
- (Probably the last "option" should be extended somehow, since it
- depends now on sched.c inner variables ...) */
+/* This is the main function in slim rtl visualization mechanism.
+
+ X is an insn, to be printed into BUF.
+
+ This function tries to print it properly in human-readable form,
+ resembling assembler mnemonics (instead of the older Lisp-style
+ form).
+
+ If VERBOSE is TRUE, insns are printed with more complete (but
+ longer) pattern names and with extra information, and prefixed
+ with their INSN_UIDs. */
void
print_insn (char *buf, const_rtx x, int verbose)
{
- char t[BUF_LEN];
- const_rtx insn = x;
+ /* Collect the string to output for X in t1. t2 is a scratch area. */
+ char t1[BUF_LEN], t2[BUF_LEN];
switch (GET_CODE (x))
{
case INSN:
- print_pattern (t, PATTERN (x), verbose);
-#ifdef INSN_SCHEDULING
- if (verbose && current_sched_info)
- sprintf (buf, "%s: %s", (*current_sched_info->print_insn) (x, 1),
- t);
- else
-#endif
- sprintf (buf, " %4d %s", INSN_UID (x), t);
+ print_pattern (t1, PATTERN (x), verbose);
break;
case DEBUG_INSN:
{
const char *name = "?";
- if (DECL_P (INSN_VAR_LOCATION_DECL (insn)))
+ if (DECL_P (INSN_VAR_LOCATION_DECL (x)))
{
- tree id = DECL_NAME (INSN_VAR_LOCATION_DECL (insn));
+ tree id = DECL_NAME (INSN_VAR_LOCATION_DECL (x));
char idbuf[32];
if (id)
name = IDENTIFIER_POINTER (id);
- else if (TREE_CODE (INSN_VAR_LOCATION_DECL (insn))
+ else if (TREE_CODE (INSN_VAR_LOCATION_DECL (x))
== DEBUG_EXPR_DECL)
{
sprintf (idbuf, "D#%i",
- DEBUG_TEMP_UID (INSN_VAR_LOCATION_DECL (insn)));
+ DEBUG_TEMP_UID (INSN_VAR_LOCATION_DECL (x)));
name = idbuf;
}
else
{
sprintf (idbuf, "D.%i",
- DECL_UID (INSN_VAR_LOCATION_DECL (insn)));
+ DECL_UID (INSN_VAR_LOCATION_DECL (x)));
name = idbuf;
}
}
- if (VAR_LOC_UNKNOWN_P (INSN_VAR_LOCATION_LOC (insn)))
- sprintf (buf, " %4d: debug %s optimized away", INSN_UID (insn), name);
+ if (VAR_LOC_UNKNOWN_P (INSN_VAR_LOCATION_LOC (x)))
+ sprintf (t1, "debug %s optimized away", name);
else
{
- print_pattern (t, INSN_VAR_LOCATION_LOC (insn), verbose);
- sprintf (buf, " %4d: debug %s => %s", INSN_UID (insn), name, t);
+ print_pattern (t2, INSN_VAR_LOCATION_LOC (x), verbose);
+ sprintf (t1, "debug %s => %s", name, t2);
}
}
break;
case JUMP_INSN:
- print_pattern (t, PATTERN (x), verbose);
-#ifdef INSN_SCHEDULING
- if (verbose && current_sched_info)
- sprintf (buf, "%s: jump %s", (*current_sched_info->print_insn) (x, 1),
- t);
- else
-#endif
- sprintf (buf, " %4d %s", INSN_UID (x), t);
+ print_pattern (t1, PATTERN (x), verbose);
break;
case CALL_INSN:
- x = PATTERN (insn);
- if (GET_CODE (x) == PARALLEL)
- {
- x = XVECEXP (x, 0, 0);
- print_pattern (t, x, verbose);
- }
+ if (GET_CODE (PATTERN (x)) == PARALLEL)
+ print_pattern (t1, XVECEXP (PATTERN (x), 0, 0), verbose);
else
- strcpy (t, "call <...>");
-#ifdef INSN_SCHEDULING
- if (verbose && current_sched_info)
- sprintf (buf, "%s: %s", (*current_sched_info->print_insn) (insn, 1), t);
- else
-#endif
- sprintf (buf, " %4d %s", INSN_UID (insn), t);
+ print_pattern (t1, PATTERN (x), verbose);
break;
case CODE_LABEL:
- sprintf (buf, "L%d:", INSN_UID (x));
+ sprintf (t1, "L%d:", INSN_UID (x));
break;
case BARRIER:
- sprintf (buf, "i%4d: barrier", INSN_UID (x));
+ sprintf (t1, "barrier");
break;
case NOTE:
{
- int uid = INSN_UID (x);
- const char *note_name = GET_NOTE_INSN_NAME (NOTE_KIND (x));
switch (NOTE_KIND (x))
{
case NOTE_INSN_EH_REGION_BEG:
case NOTE_INSN_EH_REGION_END:
- sprintf (buf, " %4d %s %d", uid, note_name,
- NOTE_EH_HANDLER (x));
+ sprintf (t2, "%d", NOTE_EH_HANDLER (x));
break;
case NOTE_INSN_BLOCK_BEG:
case NOTE_INSN_BLOCK_END:
- sprintf (buf, " %4d %s %d", uid, note_name,
- BLOCK_NUMBER (NOTE_BLOCK (x)));
+ sprintf (t2, "%d", BLOCK_NUMBER (NOTE_BLOCK (x)));
break;
case NOTE_INSN_BASIC_BLOCK:
- sprintf (buf, " %4d %s %d", uid, note_name,
- NOTE_BASIC_BLOCK (x)->index);
+ sprintf (t2, "%d", NOTE_BASIC_BLOCK (x)->index);
break;
case NOTE_INSN_DELETED_LABEL:
@@ -810,26 +756,35 @@ print_insn (char *buf, const_rtx x, int verbose)
const char *label = NOTE_DELETED_LABEL_NAME (x);
if (label == NULL)
label = "";
- sprintf (buf, " %4d %s (\"%s\")", uid, note_name, label);
+ sprintf (t2, "(\"%s\")", label);
}
break;
case NOTE_INSN_VAR_LOCATION:
- print_pattern (t, NOTE_VAR_LOCATION (x), verbose);
- sprintf (buf, " %4d %s {%s}", uid, note_name, t);
+ case NOTE_INSN_CALL_ARG_LOCATION:
+ /* It's safe here to use t1 for scratch because the output
+ is printed in t2 and put back in t1 at the bottom of
+ the inner switch statement. */
+ print_pattern (t1, NOTE_VAR_LOCATION (x), verbose);
+ sprintf (t2, "{%s}", t1);
break;
default:
- sprintf (buf, " %4d %s", uid, note_name);
+ t2[0] = '\0';
break;
}
+ sprintf (t1, "%s %s", GET_NOTE_INSN_NAME (NOTE_KIND (x)), t2);
break;
}
default:
- sprintf (buf, "i%4d <What %s?>", INSN_UID (x),
- GET_RTX_NAME (GET_CODE (x)));
+ sprintf (t1, "<What %s?>", GET_RTX_NAME (GET_CODE (x)));
break;
}
+
+ if (verbose)
+ sprintf (buf, " %4d: %s", INSN_UID (x), t1);
+ else
+ sprintf (buf, "%s", t1);
} /* print_insn */
/* Emit a slim dump of X (an insn) to the file F, including any register
@@ -854,20 +809,12 @@ dump_insn_slim (FILE *f, const_rtx x)
}
}
-/* Emit a slim dump of X (an insn) to stderr. */
-extern void debug_insn_slim (const_rtx);
-DEBUG_FUNCTION void
-debug_insn_slim (const_rtx x)
-{
- dump_insn_slim (stderr, x);
-}
-
/* Same as above, but stop at LAST or when COUNT == 0.
If COUNT < 0 it will stop only at LAST or NULL rtx. */
-extern void debug_rtl_slim (FILE *, const_rtx, const_rtx, int, int);
-DEBUG_FUNCTION void
-debug_rtl_slim (FILE *f, const_rtx first, const_rtx last,
- int count, int flags ATTRIBUTE_UNUSED)
+
+void
+dump_rtl_slim (FILE *f, const_rtx first, const_rtx last,
+ int count, int flags ATTRIBUTE_UNUSED)
{
const_rtx insn, tail;
@@ -882,6 +829,22 @@ debug_rtl_slim (FILE *f, const_rtx first, const_rtx last,
}
}
+/* Emit a slim dump of X (an insn) to stderr. */
+extern void debug_insn_slim (const_rtx);
+DEBUG_FUNCTION void
+debug_insn_slim (const_rtx x)
+{
+ dump_insn_slim (stderr, x);
+}
+
+/* Same as above, but using dump_rtl_slim. */
+extern void debug_rtl_slim (FILE *, const_rtx, const_rtx, int, int);
+DEBUG_FUNCTION void
+debug_rtl_slim (const_rtx first, const_rtx last, int count, int flags)
+{
+ dump_rtl_slim (stderr, first, last, count, flags);
+}
+
extern void debug_bb_slim (basic_block);
DEBUG_FUNCTION void
debug_bb_slim (basic_block bb)