Commit cfbeaedf by Steven Bosscher

rtl.h (debug_bb_n_slim, [...]): Remove prototypes.

	* 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.

From-SVN: r193873
parent 916bad55
2012-11-27 Steven Bosscher <steven@gcc.gnu.org>
* 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.
2012-11-27 Vladimir Makarov <vmakarov@redhat.com> 2012-11-27 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/55458 PR rtl-optimization/55458
...@@ -3719,7 +3719,8 @@ schedule_insn (rtx insn) ...@@ -3719,7 +3719,8 @@ schedule_insn (rtx insn)
print_insn (buf, insn, 0); print_insn (buf, insn, 0);
buf[40] = 0; buf[40] = 0;
fprintf (sched_dump, ";;\t%3i--> %-40s:", clock_var, buf); fprintf (sched_dump, ";;\t%3i--> %s%-40s:",
clock_var, (*current_sched_info->print_insn) (insn, 1), buf);
if (recog_memoized (insn) < 0) if (recog_memoized (insn) < 0)
fprintf (sched_dump, "nothing"); fprintf (sched_dump, "nothing");
......
...@@ -2246,7 +2246,7 @@ ira_update_equiv_info_by_shuffle_insn (int to_regno, int from_regno, rtx insns) ...@@ -2246,7 +2246,7 @@ ira_update_equiv_info_by_shuffle_insn (int to_regno, int from_regno, rtx insns)
fprintf (ira_dump_file, fprintf (ira_dump_file,
" Adding equiv note to insn %u for reg %d ", " Adding equiv note to insn %u for reg %d ",
INSN_UID (insn), to_regno); INSN_UID (insn), to_regno);
print_value_slim (ira_dump_file, x, 1); dump_value_slim (ira_dump_file, x, 1);
fprintf (ira_dump_file, "\n"); fprintf (ira_dump_file, "\n");
} }
} }
......
...@@ -425,7 +425,7 @@ get_reload_reg (enum op_type type, enum machine_mode mode, rtx original, ...@@ -425,7 +425,7 @@ get_reload_reg (enum op_type type, enum machine_mode mode, rtx original,
if (lra_dump_file != NULL) if (lra_dump_file != NULL)
{ {
fprintf (lra_dump_file, " Reuse r%d for reload ", regno); fprintf (lra_dump_file, " Reuse r%d for reload ", regno);
print_value_slim (lra_dump_file, original, 1); dump_value_slim (lra_dump_file, original, 1);
} }
if (new_class != lra_get_allocno_class (regno)) if (new_class != lra_get_allocno_class (regno))
change_class (regno, new_class, ", change", false); change_class (regno, new_class, ", change", false);
...@@ -994,7 +994,7 @@ check_and_process_move (bool *change_p, bool *sec_mem_p) ...@@ -994,7 +994,7 @@ check_and_process_move (bool *change_p, bool *sec_mem_p)
if (lra_dump_file != NULL) if (lra_dump_file != NULL)
{ {
fprintf (lra_dump_file, "Deleting move %u\n", INSN_UID (curr_insn)); fprintf (lra_dump_file, "Deleting move %u\n", INSN_UID (curr_insn));
debug_rtl_slim (lra_dump_file, curr_insn, curr_insn, -1, 0); dump_insn_slim (lra_dump_file, curr_insn);
} }
lra_set_insn_deleted (curr_insn); lra_set_insn_deleted (curr_insn);
return true; return true;
...@@ -1088,7 +1088,7 @@ process_addr_reg (rtx *loc, rtx *before, rtx *after, enum reg_class cl) ...@@ -1088,7 +1088,7 @@ process_addr_reg (rtx *loc, rtx *before, rtx *after, enum reg_class cl)
fprintf (lra_dump_file, fprintf (lra_dump_file,
"Changing pseudo %d in address of insn %u on equiv ", "Changing pseudo %d in address of insn %u on equiv ",
REGNO (reg), INSN_UID (curr_insn)); REGNO (reg), INSN_UID (curr_insn));
print_value_slim (lra_dump_file, *loc, 1); dump_value_slim (lra_dump_file, *loc, 1);
fprintf (lra_dump_file, "\n"); fprintf (lra_dump_file, "\n");
} }
*loc = copy_rtx (*loc); *loc = copy_rtx (*loc);
...@@ -2215,7 +2215,7 @@ equiv_address_substitution (struct address_info *ad) ...@@ -2215,7 +2215,7 @@ equiv_address_substitution (struct address_info *ad)
{ {
fprintf (lra_dump_file, "Changing address in insn %d ", fprintf (lra_dump_file, "Changing address in insn %d ",
INSN_UID (curr_insn)); INSN_UID (curr_insn));
print_value_slim (lra_dump_file, *ad->outer, 1); dump_value_slim (lra_dump_file, *ad->outer, 1);
} }
if (base_reg != new_base_reg) if (base_reg != new_base_reg)
{ {
...@@ -2272,7 +2272,7 @@ equiv_address_substitution (struct address_info *ad) ...@@ -2272,7 +2272,7 @@ equiv_address_substitution (struct address_info *ad)
else else
{ {
fprintf (lra_dump_file, " on equiv "); fprintf (lra_dump_file, " on equiv ");
print_value_slim (lra_dump_file, *ad->outer, 1); dump_value_slim (lra_dump_file, *ad->outer, 1);
fprintf (lra_dump_file, "\n"); fprintf (lra_dump_file, "\n");
} }
} }
...@@ -2676,7 +2676,7 @@ curr_insn_transform (void) ...@@ -2676,7 +2676,7 @@ curr_insn_transform (void)
fprintf (lra_dump_file, fprintf (lra_dump_file,
"Changing pseudo %d in operand %i of insn %u on equiv ", "Changing pseudo %d in operand %i of insn %u on equiv ",
REGNO (old), i, INSN_UID (curr_insn)); REGNO (old), i, INSN_UID (curr_insn));
print_value_slim (lra_dump_file, subst, 1); dump_value_slim (lra_dump_file, subst, 1);
fprintf (lra_dump_file, "\n"); fprintf (lra_dump_file, "\n");
} }
op_change_p = change_p = true; op_change_p = change_p = true;
...@@ -3467,8 +3467,7 @@ lra_constraints (bool first_p) ...@@ -3467,8 +3467,7 @@ lra_constraints (bool first_p)
" Removing equiv init insn %i (freq=%d)\n", " Removing equiv init insn %i (freq=%d)\n",
INSN_UID (curr_insn), INSN_UID (curr_insn),
BLOCK_FOR_INSN (curr_insn)->frequency); BLOCK_FOR_INSN (curr_insn)->frequency);
debug_rtl_slim (lra_dump_file, dump_insn_slim (lra_dump_file, curr_insn);
curr_insn, curr_insn, -1, 0);
} }
if (contains_reg_p (x, true, false)) if (contains_reg_p (x, true, false))
lra_risky_transformations_p = true; lra_risky_transformations_p = true;
...@@ -3807,7 +3806,7 @@ inherit_reload_reg (bool def_p, int original_regno, ...@@ -3807,7 +3806,7 @@ inherit_reload_reg (bool def_p, int original_regno,
" Rejecting inheritance %d->%d " " Rejecting inheritance %d->%d "
"as it results in 2 or more insns:\n", "as it results in 2 or more insns:\n",
original_regno, REGNO (new_reg)); original_regno, REGNO (new_reg));
debug_rtl_slim (lra_dump_file, new_insns, NULL_RTX, -1, 0); dump_rtl_slim (lra_dump_file, new_insns, NULL_RTX, -1, 0);
fprintf (lra_dump_file, fprintf (lra_dump_file,
" >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
} }
...@@ -3853,8 +3852,7 @@ inherit_reload_reg (bool def_p, int original_regno, ...@@ -3853,8 +3852,7 @@ inherit_reload_reg (bool def_p, int original_regno,
" Inheritance reuse change %d->%d (bb%d):\n", " Inheritance reuse change %d->%d (bb%d):\n",
original_regno, REGNO (new_reg), original_regno, REGNO (new_reg),
BLOCK_FOR_INSN (usage_insn)->index); BLOCK_FOR_INSN (usage_insn)->index);
debug_rtl_slim (lra_dump_file, usage_insn, usage_insn, dump_insn_slim (lra_dump_file, usage_insn);
-1, 0);
} }
} }
if (lra_dump_file != NULL) if (lra_dump_file != NULL)
...@@ -4058,7 +4056,7 @@ split_reg (bool before_p, int original_regno, rtx insn, rtx next_usage_insns) ...@@ -4058,7 +4056,7 @@ split_reg (bool before_p, int original_regno, rtx insn, rtx next_usage_insns)
(lra_dump_file, (lra_dump_file,
" Rejecting split %d->%d resulting in > 2 %s save insns:\n", " Rejecting split %d->%d resulting in > 2 %s save insns:\n",
original_regno, REGNO (new_reg), call_save_p ? "call" : ""); original_regno, REGNO (new_reg), call_save_p ? "call" : "");
debug_rtl_slim (lra_dump_file, save, NULL_RTX, -1, 0); dump_rtl_slim (lra_dump_file, save, NULL_RTX, -1, 0);
fprintf (lra_dump_file, fprintf (lra_dump_file,
" ))))))))))))))))))))))))))))))))))))))))))))))))\n"); " ))))))))))))))))))))))))))))))))))))))))))))))))\n");
} }
...@@ -4074,7 +4072,7 @@ split_reg (bool before_p, int original_regno, rtx insn, rtx next_usage_insns) ...@@ -4074,7 +4072,7 @@ split_reg (bool before_p, int original_regno, rtx insn, rtx next_usage_insns)
" Rejecting split %d->%d " " Rejecting split %d->%d "
"resulting in > 2 %s restore insns:\n", "resulting in > 2 %s restore insns:\n",
original_regno, REGNO (new_reg), call_save_p ? "call" : ""); original_regno, REGNO (new_reg), call_save_p ? "call" : "");
debug_rtl_slim (lra_dump_file, restore, NULL_RTX, -1, 0); dump_rtl_slim (lra_dump_file, restore, NULL_RTX, -1, 0);
fprintf (lra_dump_file, fprintf (lra_dump_file,
" ))))))))))))))))))))))))))))))))))))))))))))))))\n"); " ))))))))))))))))))))))))))))))))))))))))))))))))\n");
} }
...@@ -4101,8 +4099,7 @@ split_reg (bool before_p, int original_regno, rtx insn, rtx next_usage_insns) ...@@ -4101,8 +4099,7 @@ split_reg (bool before_p, int original_regno, rtx insn, rtx next_usage_insns)
{ {
fprintf (lra_dump_file, " Split reuse change %d->%d:\n", fprintf (lra_dump_file, " Split reuse change %d->%d:\n",
original_regno, REGNO (new_reg)); original_regno, REGNO (new_reg));
debug_rtl_slim (lra_dump_file, usage_insn, usage_insn, dump_insn_slim (lra_dump_file, usage_insn);
-1, 0);
} }
} }
lra_assert (NOTE_P (usage_insn) || NONDEBUG_INSN_P (usage_insn)); lra_assert (NOTE_P (usage_insn) || NONDEBUG_INSN_P (usage_insn));
...@@ -4245,7 +4242,7 @@ update_ebb_live_info (rtx head, rtx tail) ...@@ -4245,7 +4242,7 @@ update_ebb_live_info (rtx head, rtx tail)
if (lra_dump_file != NULL) if (lra_dump_file != NULL)
{ {
fprintf (lra_dump_file, " Removing dead insn:\n "); fprintf (lra_dump_file, " Removing dead insn:\n ");
debug_rtl_slim (lra_dump_file, curr_insn, curr_insn, -1, 0); dump_insn_slim (lra_dump_file, curr_insn);
} }
lra_set_insn_deleted (curr_insn); lra_set_insn_deleted (curr_insn);
} }
...@@ -4861,8 +4858,7 @@ remove_inheritance_pseudos (bitmap remove_pseudos) ...@@ -4861,8 +4858,7 @@ remove_inheritance_pseudos (bitmap remove_pseudos)
bitmap_bit_p (&lra_split_regs, sregno) bitmap_bit_p (&lra_split_regs, sregno)
|| bitmap_bit_p (&lra_split_regs, dregno) || bitmap_bit_p (&lra_split_regs, dregno)
? "split" : "inheritance"); ? "split" : "inheritance");
debug_rtl_slim (lra_dump_file, dump_insn_slim (lra_dump_file, curr_insn);
curr_insn, curr_insn, -1, 0);
} }
lra_set_insn_deleted (curr_insn); lra_set_insn_deleted (curr_insn);
done_p = true; done_p = true;
...@@ -4914,8 +4910,7 @@ remove_inheritance_pseudos (bitmap remove_pseudos) ...@@ -4914,8 +4910,7 @@ remove_inheritance_pseudos (bitmap remove_pseudos)
if (lra_dump_file != NULL) if (lra_dump_file != NULL)
{ {
fprintf (lra_dump_file, " Change reload insn:\n"); fprintf (lra_dump_file, " Change reload insn:\n");
debug_rtl_slim (lra_dump_file, dump_insn_slim (lra_dump_file, curr_insn);
curr_insn, curr_insn, -1, 0);
} }
} }
} }
...@@ -4958,7 +4953,7 @@ remove_inheritance_pseudos (bitmap remove_pseudos) ...@@ -4958,7 +4953,7 @@ remove_inheritance_pseudos (bitmap remove_pseudos)
if (restored_regs_p && lra_dump_file != NULL) if (restored_regs_p && lra_dump_file != NULL)
{ {
fprintf (lra_dump_file, " Insn after restoring regs:\n"); fprintf (lra_dump_file, " Insn after restoring regs:\n");
debug_rtl_slim (lra_dump_file, curr_insn, curr_insn, -1, 0); dump_insn_slim (lra_dump_file, curr_insn);
} }
} }
} }
......
...@@ -1817,16 +1817,16 @@ lra_process_new_insns (rtx insn, rtx before, rtx after, const char *title) ...@@ -1817,16 +1817,16 @@ lra_process_new_insns (rtx insn, rtx before, rtx after, const char *title)
if (lra_dump_file != NULL && (before != NULL_RTX || after != NULL_RTX)) if (lra_dump_file != NULL && (before != NULL_RTX || after != NULL_RTX))
{ {
debug_rtl_slim (lra_dump_file, insn, insn, -1, 0); dump_insn_slim (lra_dump_file, insn);
if (before != NULL_RTX) if (before != NULL_RTX)
{ {
fprintf (lra_dump_file," %s before:\n", title); fprintf (lra_dump_file," %s before:\n", title);
debug_rtl_slim (lra_dump_file, before, NULL_RTX, -1, 0); dump_rtl_slim (lra_dump_file, before, NULL_RTX, -1, 0);
} }
if (after != NULL_RTX) if (after != NULL_RTX)
{ {
fprintf (lra_dump_file, " %s after:\n", title); fprintf (lra_dump_file, " %s after:\n", title);
debug_rtl_slim (lra_dump_file, after, NULL_RTX, -1, 0); dump_rtl_slim (lra_dump_file, after, NULL_RTX, -1, 0);
} }
fprintf (lra_dump_file, "\n"); fprintf (lra_dump_file, "\n");
} }
......
...@@ -2575,14 +2575,6 @@ extern rtx make_compound_operation (rtx, enum rtx_code); ...@@ -2575,14 +2575,6 @@ extern rtx make_compound_operation (rtx, enum rtx_code);
/* In cfgcleanup.c */ /* In cfgcleanup.c */
extern void delete_dead_jumptables (void); extern void delete_dead_jumptables (void);
/* In sched-vis.c. */
extern void debug_bb_n_slim (int);
extern void debug_bb_slim (struct basic_block_def *);
extern void print_value_slim (FILE *, const_rtx, int);
extern void debug_rtl_slim (FILE *, const_rtx, const_rtx, int, int);
extern void dump_insn_slim (FILE *f, const_rtx x);
extern void debug_insn_slim (const_rtx x);
/* In sched-rgn.c. */ /* In sched-rgn.c. */
extern void schedule_insns (void); extern void schedule_insns (void);
...@@ -2609,9 +2601,12 @@ extern void print_inline_rtx (FILE *, const_rtx, int); ...@@ -2609,9 +2601,12 @@ extern void print_inline_rtx (FILE *, const_rtx, int);
sched-vis.c is compiled always. FIXME: Ideally these functions would sched-vis.c is compiled always. FIXME: Ideally these functions would
not be in sched-vis.c but in rtl.c, because they are not only used not be in sched-vis.c but in rtl.c, because they are not only used
by the scheduler anymore but for all "slim" RTL dumping. */ by the scheduler anymore but for all "slim" RTL dumping. */
extern void print_insn (char *, const_rtx, int); extern void dump_value_slim (FILE *, const_rtx, int);
extern void print_pattern (char *, const_rtx, int); extern void dump_insn_slim (FILE *, const_rtx);
extern void dump_rtl_slim (FILE *, const_rtx, const_rtx, int, int);
extern void print_value (char *, const_rtx, int); extern void print_value (char *, const_rtx, int);
extern void print_pattern (char *, const_rtx, int);
extern void print_insn (char *, const_rtx, int);
/* In function.c */ /* In function.c */
extern void reposition_prologue_and_epilogue_notes (void); extern void reposition_prologue_and_epilogue_notes (void);
......
/* Instruction scheduling pass. /* Printing of RTL in "slim", mnemonic like form.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright (C) 1992-2012
2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010
Free Software Foundation, Inc. Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by, Contributed by Michael Tiemann (tiemann@cygnus.com) Enhanced by,
and currently maintained by, Jim Wilson (wilson@cygnus.com) and currently maintained by, Jim Wilson (wilson@cygnus.com)
...@@ -20,6 +19,10 @@ for more details. ...@@ -20,6 +19,10 @@ for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */ <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 "config.h"
#include "system.h" #include "system.h"
...@@ -31,7 +34,6 @@ along with GCC; see the file COPYING3. If not see ...@@ -31,7 +34,6 @@ along with GCC; see the file COPYING3. If not see
#include "hard-reg-set.h" #include "hard-reg-set.h"
#include "basic-block.h" #include "basic-block.h"
#include "insn-attr.h" #include "insn-attr.h"
#include "sched-int.h"
#include "dumpfile.h" /* for the TDF_* flags */ #include "dumpfile.h" /* for the TDF_* flags */
static char *safe_concat (char *, char *, const char *); static char *safe_concat (char *, char *, const char *);
...@@ -498,11 +500,7 @@ print_value (char *buf, const_rtx x, int verbose) ...@@ -498,11 +500,7 @@ print_value (char *buf, const_rtx x, int verbose)
sprintf (t, "r%d", REGNO (x)); sprintf (t, "r%d", REGNO (x));
cur = safe_concat (buf, cur, t); cur = safe_concat (buf, cur, t);
} }
if (verbose if (verbose)
#ifdef INSN_SCHEDULING
&& !current_sched_info
#endif
)
{ {
sprintf (t, ":%s", GET_MODE_NAME (GET_MODE (x))); sprintf (t, ":%s", GET_MODE_NAME (GET_MODE (x)));
cur = safe_concat (buf, cur, t); cur = safe_concat (buf, cur, t);
...@@ -553,7 +551,7 @@ print_value (char *buf, const_rtx x, int verbose) ...@@ -553,7 +551,7 @@ print_value (char *buf, const_rtx x, int verbose)
memory. */ memory. */
void 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]; char buf[BUF_LEN];
...@@ -590,12 +588,9 @@ print_pattern (char *buf, const_rtx x, int verbose) ...@@ -590,12 +588,9 @@ print_pattern (char *buf, const_rtx x, int verbose)
print_exp (buf, x, verbose); print_exp (buf, x, verbose);
break; break;
case CLOBBER: case CLOBBER:
print_value (t1, XEXP (x, 0), verbose);
sprintf (buf, "clobber %s", t1);
break;
case USE: case USE:
print_value (t1, XEXP (x, 0), verbose); print_value (t1, XEXP (x, 0), verbose);
sprintf (buf, "use %s", t1); sprintf (buf, "%s %s", GET_RTX_NAME (GET_CODE (x)), t1);
break; break;
case VAR_LOCATION: case VAR_LOCATION:
print_value (t1, PAT_VAR_LOCATION_LOC (x), verbose); print_value (t1, PAT_VAR_LOCATION_LOC (x), verbose);
...@@ -657,151 +652,102 @@ print_pattern (char *buf, const_rtx x, int verbose) ...@@ -657,151 +652,102 @@ print_pattern (char *buf, const_rtx x, int verbose)
sprintf (buf, "trap_if %s", t1); sprintf (buf, "trap_if %s", t1);
break; break;
case UNSPEC: 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: case UNSPEC_VOLATILE:
{ /* Fallthru -- leave UNSPECs to print_exp. */
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;
default: default:
print_value (buf, x, verbose); print_value (buf, x, verbose);
} }
} /* print_pattern */ } /* print_pattern */
/* This is the main function in rtl visualization mechanism. It /* This is the main function in slim rtl visualization mechanism.
accepts an rtx and tries to recognize it as an insn, then prints it
properly in human readable form, resembling assembler mnemonics. X is an insn, to be printed into BUF.
For every insn it prints its UID and BB the insn belongs too.
(Probably the last "option" should be extended somehow, since it This function tries to print it properly in human-readable form,
depends now on sched.c inner variables ...) */ 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 void
print_insn (char *buf, const_rtx x, int verbose) print_insn (char *buf, const_rtx x, int verbose)
{ {
char t[BUF_LEN]; /* Collect the string to output for X in t1. t2 is a scratch area. */
const_rtx insn = x; char t1[BUF_LEN], t2[BUF_LEN];
switch (GET_CODE (x)) switch (GET_CODE (x))
{ {
case INSN: case INSN:
print_pattern (t, PATTERN (x), verbose); print_pattern (t1, 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);
break; break;
case DEBUG_INSN: case DEBUG_INSN:
{ {
const char *name = "?"; 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]; char idbuf[32];
if (id) if (id)
name = IDENTIFIER_POINTER (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) == DEBUG_EXPR_DECL)
{ {
sprintf (idbuf, "D#%i", sprintf (idbuf, "D#%i",
DEBUG_TEMP_UID (INSN_VAR_LOCATION_DECL (insn))); DEBUG_TEMP_UID (INSN_VAR_LOCATION_DECL (x)));
name = idbuf; name = idbuf;
} }
else else
{ {
sprintf (idbuf, "D.%i", sprintf (idbuf, "D.%i",
DECL_UID (INSN_VAR_LOCATION_DECL (insn))); DECL_UID (INSN_VAR_LOCATION_DECL (x)));
name = idbuf; name = idbuf;
} }
} }
if (VAR_LOC_UNKNOWN_P (INSN_VAR_LOCATION_LOC (insn))) if (VAR_LOC_UNKNOWN_P (INSN_VAR_LOCATION_LOC (x)))
sprintf (buf, " %4d: debug %s optimized away", INSN_UID (insn), name); sprintf (t1, "debug %s optimized away", name);
else else
{ {
print_pattern (t, INSN_VAR_LOCATION_LOC (insn), verbose); print_pattern (t2, INSN_VAR_LOCATION_LOC (x), verbose);
sprintf (buf, " %4d: debug %s => %s", INSN_UID (insn), name, t); sprintf (t1, "debug %s => %s", name, t2);
} }
} }
break; break;
case JUMP_INSN: case JUMP_INSN:
print_pattern (t, PATTERN (x), verbose); print_pattern (t1, 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);
break; break;
case CALL_INSN: case CALL_INSN:
x = PATTERN (insn); if (GET_CODE (PATTERN (x)) == PARALLEL)
if (GET_CODE (x) == PARALLEL) print_pattern (t1, XVECEXP (PATTERN (x), 0, 0), verbose);
{
x = XVECEXP (x, 0, 0);
print_pattern (t, x, verbose);
}
else else
strcpy (t, "call <...>"); print_pattern (t1, PATTERN (x), verbose);
#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);
break; break;
case CODE_LABEL: case CODE_LABEL:
sprintf (buf, "L%d:", INSN_UID (x)); sprintf (t1, "L%d:", INSN_UID (x));
break; break;
case BARRIER: case BARRIER:
sprintf (buf, "i%4d: barrier", INSN_UID (x)); sprintf (t1, "barrier");
break; break;
case NOTE: case NOTE:
{ {
int uid = INSN_UID (x);
const char *note_name = GET_NOTE_INSN_NAME (NOTE_KIND (x));
switch (NOTE_KIND (x)) switch (NOTE_KIND (x))
{ {
case NOTE_INSN_EH_REGION_BEG: case NOTE_INSN_EH_REGION_BEG:
case NOTE_INSN_EH_REGION_END: case NOTE_INSN_EH_REGION_END:
sprintf (buf, " %4d %s %d", uid, note_name, sprintf (t2, "%d", NOTE_EH_HANDLER (x));
NOTE_EH_HANDLER (x));
break; break;
case NOTE_INSN_BLOCK_BEG: case NOTE_INSN_BLOCK_BEG:
case NOTE_INSN_BLOCK_END: case NOTE_INSN_BLOCK_END:
sprintf (buf, " %4d %s %d", uid, note_name, sprintf (t2, "%d", BLOCK_NUMBER (NOTE_BLOCK (x)));
BLOCK_NUMBER (NOTE_BLOCK (x)));
break; break;
case NOTE_INSN_BASIC_BLOCK: case NOTE_INSN_BASIC_BLOCK:
sprintf (buf, " %4d %s %d", uid, note_name, sprintf (t2, "%d", NOTE_BASIC_BLOCK (x)->index);
NOTE_BASIC_BLOCK (x)->index);
break; break;
case NOTE_INSN_DELETED_LABEL: case NOTE_INSN_DELETED_LABEL:
...@@ -810,26 +756,35 @@ print_insn (char *buf, const_rtx x, int verbose) ...@@ -810,26 +756,35 @@ print_insn (char *buf, const_rtx x, int verbose)
const char *label = NOTE_DELETED_LABEL_NAME (x); const char *label = NOTE_DELETED_LABEL_NAME (x);
if (label == NULL) if (label == NULL)
label = ""; label = "";
sprintf (buf, " %4d %s (\"%s\")", uid, note_name, label); sprintf (t2, "(\"%s\")", label);
} }
break; break;
case NOTE_INSN_VAR_LOCATION: case NOTE_INSN_VAR_LOCATION:
print_pattern (t, NOTE_VAR_LOCATION (x), verbose); case NOTE_INSN_CALL_ARG_LOCATION:
sprintf (buf, " %4d %s {%s}", uid, note_name, t); /* 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; break;
default: default:
sprintf (buf, " %4d %s", uid, note_name); t2[0] = '\0';
break; break;
} }
sprintf (t1, "%s %s", GET_NOTE_INSN_NAME (NOTE_KIND (x)), t2);
break; break;
} }
default: default:
sprintf (buf, "i%4d <What %s?>", INSN_UID (x), sprintf (t1, "<What %s?>", GET_RTX_NAME (GET_CODE (x)));
GET_RTX_NAME (GET_CODE (x)));
break; break;
} }
if (verbose)
sprintf (buf, " %4d: %s", INSN_UID (x), t1);
else
sprintf (buf, "%s", t1);
} /* print_insn */ } /* print_insn */
/* Emit a slim dump of X (an insn) to the file F, including any register /* 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) ...@@ -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. /* Same as above, but stop at LAST or when COUNT == 0.
If COUNT < 0 it will stop only at LAST or NULL rtx. */ 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 void
debug_rtl_slim (FILE *f, const_rtx first, const_rtx last, dump_rtl_slim (FILE *f, const_rtx first, const_rtx last,
int count, int flags ATTRIBUTE_UNUSED) int count, int flags ATTRIBUTE_UNUSED)
{ {
const_rtx insn, tail; const_rtx insn, tail;
...@@ -882,6 +829,22 @@ debug_rtl_slim (FILE *f, const_rtx first, const_rtx last, ...@@ -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); extern void debug_bb_slim (basic_block);
DEBUG_FUNCTION void DEBUG_FUNCTION void
debug_bb_slim (basic_block bb) debug_bb_slim (basic_block bb)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment