toplev.c (no_new_pseudos): Define.

* toplev.c (no_new_pseudos): Define.
        (rest_of_compilation):  Set no_new_pseudos as needed.
        * emit-rtl.c (gen_reg_rtx): Abort if we try to create a new pseudo
        if no_new_pseudos is set.
        * rtl.h (no_new_pseudos): Declare it.
        * reload1.c (reload): Update comments.
        * md.texi: Corresponding changes.
        * reload1.c (reg_used_in_insn): Renamed from reg_used_by_pseudo.
        (choose_reload_regs): Rename it here as well.  When computing it,
        also merge in used hardregs.

From-SVN: r23855
This commit is contained in:
Jeff Law 1998-11-25 03:31:24 -07:00
parent 6edfbe4c58
commit f1db357664
6 changed files with 56 additions and 16 deletions

View File

@ -1,3 +1,19 @@
Wed Nov 25 11:26:19 1998 Jeffrey A Law (law@cygnus.com)
* toplev.c (no_new_pseudos): Define.
(rest_of_compilation): Set no_new_pseudos as needed.
* emit-rtl.c (gen_reg_rtx): Abort if we try to create a new pseudo
if no_new_pseudos is set.
* rtl.h (no_new_pseudos): Declare it.
* reload1.c (reload): Update comments.
* md.texi: Corresponding changes.
Wed Nov 25 11:26:17 1998 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
* reload1.c (reg_used_in_insn): Renamed from reg_used_by_pseudo.
(choose_reload_regs): Rename it here as well. When computing it,
also merge in used hardregs.
1998-11-25 07:51 -0500 Zack Weinberg <zack@rabi.phys.columbia.edu>
* gcc.c: Split out Objective-C specs to...

View File

@ -505,11 +505,9 @@ gen_reg_rtx (mode)
{
register rtx val;
/* Don't let anything called by or after reload create new registers
(actually, registers can't be created after flow, but this is a good
approximation). */
if (reload_in_progress || reload_completed)
/* Don't let anything called after initial flow analysis create new
registers. */
if (no_new_pseudos)
abort ();
if (GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT

View File

@ -1746,14 +1746,20 @@ pseudo registers that did not get hard registers, while on other
machines explicit memory references will get optional reloads.
If a scratch register is required to move an object to or from memory,
it can be allocated using @code{gen_reg_rtx} prior to reload. But this
is impossible during and after reload. If there are cases needing
it can be allocated using @code{gen_reg_rtx} prior to life analysis.
If there are cases needing
scratch registers after reload, you must define
@code{SECONDARY_INPUT_RELOAD_CLASS} and perhaps also
@code{SECONDARY_OUTPUT_RELOAD_CLASS} to detect them, and provide
patterns @samp{reload_in@var{m}} or @samp{reload_out@var{m}} to handle
them. @xref{Register Classes}.
@findex no_new_pseudos
The global variable @code{no_new_pseudos} can be used to determine if it
is unsafe to create new pseudo registers. If this variable is nonzero, then
it is unsafe to call @code{gen_reg_rtx} to allocate a new pseudo.
The constraints on a @samp{mov@var{m}} must permit moving any hard
register to any other hard register provided that
@code{HARD_REGNO_MODE_OK} permits mode @var{m} in both registers and

View File

@ -815,7 +815,9 @@ reload (first, global, dumpfile)
#endif
finish_spills (global, dumpfile);
/* From now on, we need to emit any moves without making new pseudos. */
/* From now on, we may need to generate moves differently. We may also
allow modifications of insns which cause them to not be recognized.
Any such modifications will be cleaned up during reload itself. */
reload_in_progress = 1;
/* This loop scans the entire function each go-round
@ -4487,9 +4489,9 @@ static HARD_REG_SET reload_reg_used_at_all;
in the group. */
static HARD_REG_SET reload_reg_used_for_inherit;
/* Records which hard regs are allocated to a pseudo during any point of the
current insn. */
static HARD_REG_SET reg_used_by_pseudo;
/* Records which hard regs are used in any way, either as explicit use or
by being allocated to a pseudo during any point of the current insn. */
static HARD_REG_SET reg_used_in_insn;
/* Mark reg REGNO as in use for a reload of the sort spec'd by OPNUM and
TYPE. MODE is used to indicate how many consecutive regs are
@ -5522,10 +5524,16 @@ choose_reload_regs (chain)
CLEAR_HARD_REG_SET (reload_reg_used_in_insn);
CLEAR_HARD_REG_SET (reload_reg_used_in_other_addr);
CLEAR_HARD_REG_SET (reg_used_by_pseudo);
compute_use_by_pseudos (&reg_used_by_pseudo, chain->live_before);
compute_use_by_pseudos (&reg_used_by_pseudo, chain->live_after);
CLEAR_HARD_REG_SET (reg_used_in_insn);
{
HARD_REG_SET tmp;
REG_SET_TO_HARD_REG_SET (tmp, chain->live_before);
IOR_HARD_REG_SET (reg_used_in_insn, tmp);
REG_SET_TO_HARD_REG_SET (tmp, chain->live_after);
IOR_HARD_REG_SET (reg_used_in_insn, tmp);
compute_use_by_pseudos (&reg_used_in_insn, chain->live_before);
compute_use_by_pseudos (&reg_used_in_insn, chain->live_after);
}
for (i = 0; i < reload_n_operands; i++)
{
CLEAR_HARD_REG_SET (reload_reg_used_in_output[i]);
@ -5838,7 +5846,7 @@ choose_reload_regs (chain)
(i, reload_opnum[r], reload_when_needed[r],
reload_in[r], reload_out[r], r, 1))
/* Don't use it if we'd clobber a pseudo reg. */
|| (TEST_HARD_REG_BIT (reg_used_by_pseudo, i)
|| (TEST_HARD_REG_BIT (reg_used_in_insn, i)
&& reload_out[r]
&& ! TEST_HARD_REG_BIT (reg_reloaded_dead, i))
/* Don't really use the inherited spill reg

View File

@ -1222,6 +1222,10 @@ extern int reload_in_progress;
the same indirect address eventually. */
extern int cse_not_expected;
/* Set to nonzero before life analysis to indicate that it is unsafe to
generate any new pseudo registers. */
extern int no_new_pseudos;
/* Indexed by pseudo register number, gives the rtx for that pseudo.
Allocated in parallel with regno_pointer_flag. */
extern rtx *regno_reg_rtx;

View File

@ -242,6 +242,9 @@ char *main_input_filename;
int lineno;
/* Nonzero if it is unsafe to create any new pseudo registers. */
int no_new_pseudos;
/* Stack of currently pending input files. */
struct file_stack *input_file_stack;
@ -3862,6 +3865,10 @@ rest_of_compilation (decl)
print_rtl_graph_with_bb (dump_base_name, ".flow", insns);
}
/* The first life analysis pass has finished. From now on we can not
generate any new pseudos. */
no_new_pseudos = 1;
/* If -opt, try combining insns through substitution. */
if (optimize > 0)
@ -4170,6 +4177,7 @@ rest_of_compilation (decl)
reload_completed = 0;
flow2_completed = 0;
no_new_pseudos = 0;
TIMEVAR (final_time,
{