information, explicitly reset it here. The allocation should have
already happened on the previous reg_scan pass. Make sure in case
some more registers were allocated. */
- allocate_reg_info (max_regno, FALSE);
+ allocate_reg_info (max_regno, FALSE, FALSE);
for (i = 0; i < max_regno; i++)
REG_N_SETS (i) = 0;
reg_offset = (char *) alloca (max_regno * sizeof (char));
reg_next_in_qty = (int *) alloca (max_regno * sizeof (int));
- reg_renumber = (short *) oballoc (max_regno * sizeof (short));
- for (i = 0; i < max_regno; i++)
- reg_renumber[i] = -1;
+ /* Allocate the reg_renumber array */
+ allocate_reg_info (max_regno, FALSE, TRUE);
/* Determine which pseudo-registers can be allocated by local-alloc.
In general, these are the registers used only in a single block and
Therefore, at all times, == 0 indicates an invariant register;
< 0 a conditionally invariant one. */
-static short *n_times_set;
+static int *n_times_set;
/* Original value of n_times_set; same except that this value
is not set negative for a reg whose sets have been made candidates
and not set to 0 for a reg that is moved. */
-static short *n_times_used;
+static int *n_times_used;
/* Index by register number, 1 indicates that the register
cannot be moved or strength reduced. */
/* Nonzero if we are scanning instructions in a sub-loop. */
int loop_depth = 0;
- n_times_set = (short *) alloca (nregs * sizeof (short));
- n_times_used = (short *) alloca (nregs * sizeof (short));
+ n_times_set = (int *) alloca (nregs * sizeof (int));
+ n_times_used = (int *) alloca (nregs * sizeof (int));
may_not_optimize = (char *) alloca (nregs);
/* Determine whether this loop starts with a jump down to a test at
the setting of register I. If this loop has calls, set
reg_single_usage[I]. */
- bzero ((char *) n_times_set, nregs * sizeof (short));
+ bzero ((char *) n_times_set, nregs * sizeof (int));
bzero (may_not_optimize, nregs);
if (loop_has_call)
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
may_not_optimize[i] = 1, n_times_set[i] = 1;
- bcopy ((char *) n_times_set, (char *) n_times_used, nregs * sizeof (short));
+ bcopy ((char *) n_times_set, (char *) n_times_used, nregs * sizeof (int));
if (loop_dump_stream)
{
/* Compute register class preferences for pseudo-registers.
- Copyright (C) 1987, 88, 91, 92, 93, 94, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1987, 88, 91, 92, 93, 94, 96, 1997 Free Software Foundation, Inc.
This file is part of GNU CC.
\f
/* Allocate enough space to hold NUM_REGS registers for the tables used for
reg_scan and flow_analysis that are indexed by the register number. If
- NEW_P is set, initialize all of the registers, otherwise only initialize the
- new registers allocated. The same table is kept from function to function,
- only reallocating it when we need more room. */
+ NEW_P is non zero, initialize all of the registers, otherwise only
+ initialize the new registers allocated. The same table is kept from
+ function to function, only reallocating it when we need more room. If
+ RENUMBER_P is non zero, allocate the reg_renumber array also. */
void
-allocate_reg_info (num_regs, new_p)
+allocate_reg_info (num_regs, new_p, renumber_p)
int num_regs;
int new_p;
+ int renumber_p;
{
static int regno_allocated = 0;
static int regno_max = 0;
+ static short *renumber = (short *)0;
int i;
- int size;
+ int size_info;
+ int size_renumber;
int min = (new_p) ? 0 : regno_max+1;
+ /* If this message come up, and you want to fix it, then all of the tables
+ like reg_renumber, etc. that use short will have to be found and lengthed
+ to int or HOST_WIDE_INT. */
+
+ /* Free up all storage allocated */
+ if (num_regs < 0)
+ {
+ if (reg_n_info)
+ {
+ free ((char *)reg_n_info);
+ free ((char *)renumber);
+ reg_n_info = (reg_info *)0;
+ renumber = (short *)0;
+ }
+ regno_allocated = 0;
+ regno_max = 0;
+ return;
+ }
+
if (num_regs > regno_allocated)
{
regno_allocated = num_regs + (num_regs / 20); /* add some slop space */
- size = regno_allocated * sizeof (reg_info);
- reg_n_info = ((reg_n_info)
- ? (reg_info *) xrealloc ((char *)reg_n_info, size)
- : (reg_info *) xmalloc (size));
+ size_info = regno_allocated * sizeof (reg_info);
+ size_renumber = regno_allocated * sizeof (short);
+
+ if (!reg_n_info)
+ {
+ reg_n_info = (reg_info *) xmalloc (size_info);
+ renumber = (short *) xmalloc (size_renumber);
+ }
+
+ else if (new_p) /* if we're zapping everything, no need to realloc */
+ {
+ free ((char *)reg_n_info);
+ free ((char *)renumber);
+ reg_n_info = (reg_info *) xmalloc (size_info);
+ renumber = (short *) xmalloc (size_renumber);
+ }
+
+ else
+ {
+ reg_n_info = (reg_info *) xrealloc ((char *)reg_n_info, size_info);
+ renumber = (short *) xrealloc ((char *)renumber, size_renumber);
+ }
}
if (min < num_regs)
{
bzero ((char *) ®_n_info[min], (num_regs - min) * sizeof (reg_info));
for (i = min; i < num_regs; i++)
- REG_BASIC_BLOCK (i) = REG_BLOCK_UNKNOWN;
+ {
+ REG_BASIC_BLOCK (i) = REG_BLOCK_UNKNOWN;
+ renumber[i] = -1;
+ }
}
+ if (renumber_p)
+ reg_renumber = renumber;
+
regno_max = num_regs;
}
{
register rtx insn;
- allocate_reg_info (nregs, TRUE);
+ allocate_reg_info (nregs, TRUE, FALSE);
max_parallel = 3;
for (insn = f; insn; insn = NEXT_INSN (insn))
/* Define per-register tables for data flow info and register allocation.
- Copyright (C) 1987, 1993, 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
This file is part of GNU CC.
This can't be folded into reg_n_info without changing all of the
machine dependent directories, since the reload functions
- access it. */
+ in the machine dependent files access it. */
extern short *reg_renumber;
extern int scratch_list_length;
/* Allocate reg_n_info tables */
-extern void allocate_reg_info PROTO((int, int));
+extern void allocate_reg_info PROTO((int, int, int));
Values of these arrays are copied at the end of this pass into the
arrays set up by flow analysis. */
-static short *sched_reg_n_deaths;
static int *sched_reg_n_calls_crossed;
static int *sched_reg_live_length;
struct sometimes
{
- short offset; short bit;
- short live_length; short calls_crossed;
+ int offset;
+ int bit;
+ int live_length;
+ int calls_crossed;
};
/* Forward declarations. */
if (reload_completed == 0)
{
- sched_reg_n_deaths = (short *) alloca (max_regno * sizeof (short));
sched_reg_n_calls_crossed = (int *) alloca (max_regno * sizeof (int));
sched_reg_live_length = (int *) alloca (max_regno * sizeof (int));
bb_dead_regs = (regset) alloca (regset_bytes);
bb_live_regs = (regset) alloca (regset_bytes);
bzero ((char *) sched_reg_n_calls_crossed, max_regno * sizeof (int));
bzero ((char *) sched_reg_live_length, max_regno * sizeof (int));
- for (i = 0; i < max_regno; i++)
- sched_reg_n_deaths[i] = REG_N_DEATHS (i);
init_alias_analysis ();
}
else
{
- sched_reg_n_deaths = 0;
sched_reg_n_calls_crossed = 0;
sched_reg_live_length = 0;
bb_dead_regs = 0;
/* Dummy data flow analysis for GNU compiler in nonoptimizing mode.
- Copyright (C) 1987, 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1987, 1991, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of GNU CC.
regs_crosses_setjmp = (char *) alloca (nregs * sizeof (char));
bzero ((char *) regs_crosses_setjmp, nregs * sizeof (char));
- reg_renumber = (short *) oballoc (nregs * sizeof (short));
+ /* Allocate the reg_renumber array */
+ allocate_reg_info (max_regno, FALSE, TRUE);
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
reg_renumber[i] = i;
- for (i = FIRST_VIRTUAL_REGISTER; i < max_regno; i++)
- reg_renumber[i] = -1;
-
after_insn_hard_regs
= (HARD_REG_SET *) alloca (max_suid * sizeof (HARD_REG_SET));