This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
dump file cleanup for reload
- To: gcc-patches at gcc dot gnu dot org
- Subject: dump file cleanup for reload
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Mon, 21 Aug 2000 07:39:24 -0600
- Reply-To: law at cygnus dot com
Per Richard's recommendation:
* global.c (global_alloc): Avoid passing dumpfile argument to
reload routines.
* toplev.c (rest_of_compilation): Likewise.
* reload.h (reload): Remove dumpfile argument. Callers changed.
(debug_reload, debug_reload_to_stream): Move prototypes here.
* rtl.h (reload): Remove dumpfile argument.
* reload.c (debug_reload): Remove prototype.
(debug_reload_to_stream): Likewise.
* reload1.c: Avoid passing dumpfile around, rely on rtl_dump_file
instead.
Index: global.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/global.c,v
retrieving revision 1.61
diff -c -3 -p -r1.61 global.c
*** global.c 2000/08/04 20:28:05 1.61
--- global.c 2000/08/21 13:37:06
*************** global_alloc (file)
*** 578,584 ****
#endif
{
build_insn_chain (get_insns ());
! retval = reload (get_insns (), 1, file);
}
/* Clean up. */
--- 578,584 ----
#endif
{
build_insn_chain (get_insns ());
! retval = reload (get_insns (), 1);
}
/* Clean up. */
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.362
diff -c -3 -p -r1.362 toplev.c
*** toplev.c 2000/08/19 01:31:47 1.362
--- toplev.c 2000/08/21 13:37:31
*************** rest_of_compilation (decl)
*** 3362,3368 ****
else
{
build_insn_chain (insns);
! failure = reload (insns, 0, rtl_dump_file);
}
timevar_pop (TV_GLOBAL_ALLOC);
--- 3362,3368 ----
else
{
build_insn_chain (insns);
! failure = reload (insns, 0);
}
timevar_pop (TV_GLOBAL_ALLOC);
Index: reload.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/reload.h,v
retrieving revision 1.29
diff -c -3 -p -r1.29 reload.h
*** reload.h 2000/07/28 17:46:17 1.29
--- reload.h 2000/08/21 13:37:31
*************** extern int reloads_conflict PARAMS ((in
*** 348,354 ****
extern void init_reload PARAMS ((void));
/* The reload pass itself. */
! extern int reload PARAMS ((rtx, int, FILE *));
/* Mark the slots in regs_ever_live for the hard regs
used by pseudo-reg number REGNO. */
--- 348,354 ----
extern void init_reload PARAMS ((void));
/* The reload pass itself. */
! extern int reload PARAMS ((rtx, int));
/* Mark the slots in regs_ever_live for the hard regs
used by pseudo-reg number REGNO. */
*************** extern void save_call_clobbered_regs PAR
*** 382,384 ****
--- 382,388 ----
/* Replace (subreg (reg)) with the appropriate (reg) for any operands. */
extern void cleanup_subreg_operands PARAMS ((rtx));
+
+ /* Debugging support. */
+ extern void debug_reload_to_stream PARAMS ((FILE *));
+ extern void debug_reload PARAMS ((void));
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtl.h,v
retrieving revision 1.217
diff -c -3 -p -r1.217 rtl.h
*** rtl.h 2000/08/18 02:41:58 1.217
--- rtl.h 2000/08/21 13:37:44
*************** extern int function_invariant_p PARAMS
*** 1847,1855 ****
extern void reload_cse_regs PARAMS ((rtx));
extern void init_reload PARAMS ((void));
extern void mark_home_live PARAMS ((int));
! #ifdef BUFSIZ
! extern int reload PARAMS ((rtx, int, FILE *));
! #endif
/* In caller-save.c */
extern void init_caller_save PARAMS ((void));
--- 1847,1853 ----
extern void reload_cse_regs PARAMS ((rtx));
extern void init_reload PARAMS ((void));
extern void mark_home_live PARAMS ((int));
! extern int reload PARAMS ((rtx, int));
/* In caller-save.c */
extern void init_caller_save PARAMS ((void));
Index: reload.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/reload.c,v
retrieving revision 1.119
diff -c -3 -p -r1.119 reload.c
*** reload.c 2000/08/16 16:53:02 1.119
--- reload.c 2000/08/21 13:38:11
*************** static void find_reloads_address_part PA
*** 272,279 ****
static rtx find_reloads_subreg_address PARAMS ((rtx, int, int, enum
reload_type,
int, rtx));
static int find_inc_amount PARAMS ((rtx, rtx));
- extern void debug_reload_to_stream PARAMS ((FILE *));
- extern void debug_reload PARAMS ((void));
#ifdef HAVE_SECONDARY_RELOADS
--- 272,277 ----
Index: reload1.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/reload1.c,v
retrieving revision 1.222
diff -c -3 -p -r1.222 reload1.c
*** reload1.c 2000/08/19 15:49:01 1.222
--- reload1.c 2000/08/21 13:38:49
*************** static int num_labels;
*** 373,382 ****
static void maybe_fix_stack_asms PARAMS ((void));
static void copy_reloads PARAMS ((struct insn_chain *));
static void calculate_needs_all_insns PARAMS ((int));
! static int find_reg PARAMS ((struct insn_chain *, int,
! FILE *));
! static void find_reload_regs PARAMS ((struct insn_chain *, FILE *));
! static void select_reload_regs PARAMS ((FILE *));
static void delete_caller_save_insns PARAMS ((void));
static void spill_failure PARAMS ((rtx, enum reg_class));
--- 373,381 ----
static void maybe_fix_stack_asms PARAMS ((void));
static void copy_reloads PARAMS ((struct insn_chain *));
static void calculate_needs_all_insns PARAMS ((int));
! static int find_reg PARAMS ((struct insn_chain *, int));
! static void find_reload_regs PARAMS ((struct insn_chain *));
! static void select_reload_regs PARAMS ((void));
static void delete_caller_save_insns PARAMS ((void));
static void spill_failure PARAMS ((rtx, enum reg_class));
*************** static void set_initial_label_offsets PA
*** 395,407 ****
static void set_offsets_for_label PARAMS ((rtx));
static void init_elim_table PARAMS ((void));
static void update_eliminables PARAMS ((HARD_REG_SET *));
! static void spill_hard_reg PARAMS ((unsigned int, FILE *, int));
! static int finish_spills PARAMS ((int, FILE *));
static void ior_hard_reg_set PARAMS ((HARD_REG_SET *, HARD_REG_SET *));
static void scan_paradoxical_subregs PARAMS ((rtx));
static void count_pseudo PARAMS ((int));
static void order_regs_for_reload PARAMS ((struct insn_chain *));
! static void reload_as_needed PARAMS ((int, FILE *));
static void forget_old_reloads_1 PARAMS ((rtx, rtx, void *));
static int reload_reg_class_lower PARAMS ((const PTR, const PTR));
static void mark_reload_reg_in_use PARAMS ((unsigned int, int,
--- 394,406 ----
static void set_offsets_for_label PARAMS ((rtx));
static void init_elim_table PARAMS ((void));
static void update_eliminables PARAMS ((HARD_REG_SET *));
! static void spill_hard_reg PARAMS ((unsigned int, int));
! static int finish_spills PARAMS ((int));
static void ior_hard_reg_set PARAMS ((HARD_REG_SET *, HARD_REG_SET *));
static void scan_paradoxical_subregs PARAMS ((rtx));
static void count_pseudo PARAMS ((int));
static void order_regs_for_reload PARAMS ((struct insn_chain *));
! static void reload_as_needed PARAMS ((int));
static void forget_old_reloads_1 PARAMS ((rtx, rtx, void *));
static int reload_reg_class_lower PARAMS ((const PTR, const PTR));
static void mark_reload_reg_in_use PARAMS ((unsigned int, int,
*************** static void do_input_reload PARAMS ((st
*** 431,437 ****
struct reload *, int));
static void do_output_reload PARAMS ((struct insn_chain *,
struct reload *, int));
! static void emit_reload_insns PARAMS ((struct insn_chain *, FILE *));
static void delete_output_reload PARAMS ((rtx, int, int));
static void delete_address_reloads PARAMS ((rtx, rtx));
static void delete_address_reloads_1 PARAMS ((rtx, rtx, rtx));
--- 430,436 ----
struct reload *, int));
static void do_output_reload PARAMS ((struct insn_chain *,
struct reload *, int));
! static void emit_reload_insns PARAMS ((struct insn_chain *));
static void delete_output_reload PARAMS ((rtx, int, int));
static void delete_address_reloads PARAMS ((rtx, rtx));
static void delete_address_reloads_1 PARAMS ((rtx, rtx, rtx));
*************** static void failed_reload PARAMS ((rtx,
*** 455,461 ****
static int set_reload_reg PARAMS ((int, int));
static void reload_cse_delete_noop_set PARAMS ((rtx, rtx));
static void reload_cse_simplify PARAMS ((rtx));
! extern void dump_needs PARAMS ((struct insn_chain *, FILE *));
/* Initialize the reload pass once per compilation. */
--- 454,460 ----
static int set_reload_reg PARAMS ((int, int));
static void reload_cse_delete_noop_set PARAMS ((rtx, rtx));
static void reload_cse_simplify PARAMS ((rtx));
! extern void dump_needs PARAMS ((struct insn_chain *));
/* Initialize the reload pass once per compilation. */
*************** static int failure;
*** 595,613 ****
If GLOBAL is zero, we do not have enough information to do that,
so any pseudo reg that is spilled must go to the stack.
- DUMPFILE is the global-reg debugging dump file stream, or 0.
- If it is nonzero, messages are written to it to describe
- which registers are seized as reload regs, which pseudo regs
- are spilled from them, and where the pseudo regs are reallocated to.
-
Return value is nonzero if reload failed
and we must not do any more for this function. */
int
! reload (first, global, dumpfile)
rtx first;
int global;
- FILE *dumpfile;
{
register int i;
register rtx insn;
--- 594,606 ----
If GLOBAL is zero, we do not have enough information to do that,
so any pseudo reg that is spilled must go to the stack.
Return value is nonzero if reload failed
and we must not do any more for this function. */
int
! reload (first, global)
rtx first;
int global;
{
register int i;
register rtx insn;
*************** reload (first, global, dumpfile)
*** 824,836 ****
CLEAR_HARD_REG_SET (used_spill_regs);
for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++)
if (! ep->can_eliminate)
! spill_hard_reg (ep->from, dumpfile, 1);
#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
if (frame_pointer_needed)
! spill_hard_reg (HARD_FRAME_POINTER_REGNUM, dumpfile, 1);
#endif
! finish_spills (global, dumpfile);
/* From now on, we may need to generate moves differently. We may also
allow modifications of insns which cause them to not be recognized.
--- 817,829 ----
CLEAR_HARD_REG_SET (used_spill_regs);
for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++)
if (! ep->can_eliminate)
! spill_hard_reg (ep->from, 1);
#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
if (frame_pointer_needed)
! spill_hard_reg (HARD_FRAME_POINTER_REGNUM, 1);
#endif
! finish_spills (global);
/* From now on, we may need to generate moves differently. We may also
allow modifications of insns which cause them to not be recognized.
*************** reload (first, global, dumpfile)
*** 946,952 ****
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (TEST_HARD_REG_BIT (to_spill, i))
{
! spill_hard_reg (i, dumpfile, 1);
did_spill = 1;
/* Regardless of the state of spills, if we previously had
--- 939,945 ----
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (TEST_HARD_REG_BIT (to_spill, i))
{
! spill_hard_reg (i, 1);
did_spill = 1;
/* Regardless of the state of spills, if we previously had
*************** reload (first, global, dumpfile)
*** 962,973 ****
}
}
! select_reload_regs (dumpfile);
if (failure)
goto failed;
if (insns_need_reload != 0 || did_spill)
! something_changed |= finish_spills (global, dumpfile);
if (! something_changed)
break;
--- 955,966 ----
}
}
! select_reload_regs ();
if (failure)
goto failed;
if (insns_need_reload != 0 || did_spill)
! something_changed |= finish_spills (global);
if (! something_changed)
break;
*************** reload (first, global, dumpfile)
*** 1023,1029 ****
{
int old_frame_size = get_frame_size ();
! reload_as_needed (global, dumpfile);
if (old_frame_size != get_frame_size ())
abort ();
--- 1016,1022 ----
{
int old_frame_size = get_frame_size ();
! reload_as_needed (global);
if (old_frame_size != get_frame_size ())
abort ();
*************** count_spilled_pseudo (spilled, spilled_n
*** 1585,1594 ****
/* Find reload register to use for reload number ORDER. */
static int
! find_reg (chain, order, dumpfile)
struct insn_chain *chain;
int order;
- FILE *dumpfile;
{
int rnum = reload_order[order];
struct reload *rl = rld + rnum;
--- 1578,1586 ----
/* Find reload register to use for reload number ORDER. */
static int
! find_reg (chain, order)
struct insn_chain *chain;
int order;
{
int rnum = reload_order[order];
struct reload *rl = rld + rnum;
*************** find_reg (chain, order, dumpfile)
*** 1659,1666 ****
if (best_reg == -1)
return 0;
! if (dumpfile)
! fprintf (dumpfile, "Using reg %d for reload %d\n", best_reg, rnum);
rl->nregs = HARD_REGNO_NREGS (best_reg, rl->mode);
rl->regno = best_reg;
--- 1651,1658 ----
if (best_reg == -1)
return 0;
! if (rtl_dump_file)
! fprintf (rtl_dump_file, "Using reg %d for reload %d\n", best_reg, rnum);
rl->nregs = HARD_REGNO_NREGS (best_reg, rl->mode);
rl->regno = best_reg;
*************** find_reg (chain, order, dumpfile)
*** 1694,1702 ****
for a smaller class even though it belongs to that class. */
static void
! find_reload_regs (chain, dumpfile)
struct insn_chain *chain;
- FILE *dumpfile;
{
int i;
--- 1686,1693 ----
for a smaller class even though it belongs to that class. */
static void
! find_reload_regs (chain)
struct insn_chain *chain;
{
int i;
*************** find_reload_regs (chain, dumpfile)
*** 1724,1731 ****
CLEAR_HARD_REG_SET (used_spill_regs_local);
! if (dumpfile)
! fprintf (dumpfile, "Spilling for insn %d.\n", INSN_UID (chain->insn));
qsort (reload_order, n_reloads, sizeof (short), reload_reg_class_lower);
--- 1715,1722 ----
CLEAR_HARD_REG_SET (used_spill_regs_local);
! if (rtl_dump_file)
! fprintf (rtl_dump_file, "Spilling for insn %d.\n", INSN_UID (chain->
insn));
qsort (reload_order, n_reloads, sizeof (short), reload_reg_class_lower);
*************** find_reload_regs (chain, dumpfile)
*** 1741,1747 ****
if ((rld[r].out != 0 || rld[r].in != 0 || rld[r].secondary_p)
&& ! rld[r].optional
&& rld[r].regno == -1)
! if (! find_reg (chain, i, dumpfile))
{
spill_failure (chain->insn, rld[r].class);
failure = 1;
--- 1732,1738 ----
if ((rld[r].out != 0 || rld[r].in != 0 || rld[r].secondary_p)
&& ! rld[r].optional
&& rld[r].regno == -1)
! if (! find_reg (chain, i))
{
spill_failure (chain->insn, rld[r].class);
failure = 1;
*************** find_reload_regs (chain, dumpfile)
*** 1756,1770 ****
}
static void
! select_reload_regs (dumpfile)
! FILE *dumpfile;
{
struct insn_chain *chain;
/* Try to satisfy the needs for each insn. */
for (chain = insns_need_reload; chain != 0;
chain = chain->next_need_reload)
! find_reload_regs (chain, dumpfile);
}
/* Delete all insns that were inserted by emit_caller_save_insns during
--- 1747,1760 ----
}
static void
! select_reload_regs ()
{
struct insn_chain *chain;
/* Try to satisfy the needs for each insn. */
for (chain = insns_need_reload; chain != 0;
chain = chain->next_need_reload)
! find_reload_regs (chain);
}
/* Delete all insns that were inserted by emit_caller_save_insns during
*************** init_elim_table ()
*** 3450,3456 ****
}
/* Kick all pseudos out of hard register REGNO.
- If DUMPFILE is nonzero, log actions taken on that file.
If CANT_ELIMINATE is nonzero, it means that we are doing this spill
because we found we can't eliminate some register. In the case, no
pseudos
--- 3440,3445 ----
*************** init_elim_table ()
*** 3461,3469 ****
Return nonzero if any pseudos needed to be kicked out. */
static void
! spill_hard_reg (regno, dumpfile, cant_eliminate)
unsigned int regno;
- FILE *dumpfile ATTRIBUTE_UNUSED;
int cant_eliminate;
{
register int i;
--- 3450,3457 ----
Return nonzero if any pseudos needed to be kicked out. */
static void
! spill_hard_reg (regno, cant_eliminate)
unsigned int regno;
int cant_eliminate;
{
register int i;
*************** ior_hard_reg_set (set1, set2)
*** 3503,3511 ****
spill_regs array for use by choose_reload_regs. */
static int
! finish_spills (global, dumpfile)
int global;
- FILE *dumpfile;
{
struct insn_chain *chain;
int something_changed = 0;
--- 3491,3498 ----
spill_regs array for use by choose_reload_regs. */
static int
! finish_spills (global)
int global;
{
struct insn_chain *chain;
int something_changed = 0;
*************** finish_spills (global, dumpfile)
*** 3636,3647 ****
alter_reg (i, reg_old_renumber[i]);
reg_old_renumber[i] = regno;
! if (dumpfile)
{
if (regno == -1)
! fprintf (dumpfile, " Register %d now on stack.\n\n", i);
else
! fprintf (dumpfile, " Register %d now in %d.\n\n",
i, reg_renumber[i]);
}
}
--- 3623,3634 ----
alter_reg (i, reg_old_renumber[i]);
reg_old_renumber[i] = regno;
! if (rtl_dump_file)
{
if (regno == -1)
! fprintf (rtl_dump_file, " Register %d now on stack.\n\n", i);
else
! fprintf (rtl_dump_file, " Register %d now in %d.\n\n",
i, reg_renumber[i]);
}
}
*************** scan_paradoxical_subregs (x)
*** 3717,3725 ****
as the insns are scanned. */
static void
! reload_as_needed (live_known, dumpfile)
int live_known;
- FILE *dumpfile;
{
struct insn_chain *chain;
#if defined (AUTO_INC_DEC)
--- 3704,3711 ----
as the insns are scanned. */
static void
! reload_as_needed (live_known)
int live_known;
{
struct insn_chain *chain;
#if defined (AUTO_INC_DEC)
*************** reload_as_needed (live_known, dumpfile)
*** 3820,3826 ****
/* Generate the insns to reload operands into or out of
their reload regs. */
! emit_reload_insns (chain, dumpfile);
/* Substitute the chosen reload regs from reload_reg_rtx
into the insn's body (or perhaps into the bodies of other
--- 3806,3812 ----
/* Generate the insns to reload operands into or out of
their reload regs. */
! emit_reload_insns (chain);
/* Substitute the chosen reload regs from reload_reg_rtx
into the insn's body (or perhaps into the bodies of other
*************** do_output_reload (chain, rl, j)
*** 6771,6779 ****
/* Output insns to reload values in and out of the chosen reload regs. */
static void
! emit_reload_insns (chain, dumpfile)
struct insn_chain *chain;
- FILE *dumpfile;
{
rtx insn = chain->insn;
--- 6757,6764 ----
/* Output insns to reload values in and out of the chosen reload regs. */
static void
! emit_reload_insns (chain)
struct insn_chain *chain;
{
rtx insn = chain->insn;
*************** emit_reload_insns (chain, dumpfile)
*** 6795,6804 ****
other_operand_reload_insns = 0;
/* Dump reloads into the dump file. */
! if (dumpfile)
{
! fprintf (dumpfile, "\nReloads for insn # %d\n", INSN_UID (insn));
! debug_reload_to_stream (dumpfile);
}
/* Now output the instructions to copy the data into and out of the
--- 6780,6789 ----
other_operand_reload_insns = 0;
/* Dump reloads into the dump file. */
! if (rtl_dump_file)
{
! fprintf (rtl_dump_file, "\nReloads for insn # %d\n", INSN_UID (insn));
! debug_reload_to_stream (rtl_dump_file);
}
/* Now output the instructions to copy the data into and out of the