Switch reg_n_info structure to use varrays

From-SVN: r20894
This commit is contained in:
Michael Meissner 1998-07-02 13:49:34 +00:00
parent 39403d8233
commit 6feacd0954
6 changed files with 192 additions and 99 deletions

View File

@ -18,13 +18,37 @@ Thu Jul 2 14:34:48 1998 David Edelsohn <edelsohn@mhpcc.edu>
Thu Jul 2 14:16:11 1998 Michael Meissner <meissner@cygnus.com>
* varray.{c,h}: New files to provide virtual array support.
* Makefile.in (OBJS): Add varray.o.
(varray.o): Add new file.
(REGS_H): New variable for dependencies for files including
regs.h. Add varray.h and files it includes. Change all regs.h
dependencies to $(REGS_H).
* toplev.c (x{m,re}alloc): If size is 0, allocate 1 byte.
(xcalloc): Provide frontend for calloc.
* {tree,rtl}.h (xcalloc): Add declaration.
* basic-block.h (REG_BASIC_BLOCK): Convert reg_n_info to be a
varray.
* regs.h (toplevel): Include varray.h.
(reg_n_info): Switch to use a varray.
(REG_*): Ditto.
(allocate_reg_info): Change num_regs argument to be size_t.
* regclass.c (reg_info_data): New structure to remember groups of
reg_info structures allocated that are to be zeroed.
({pref,alt}class_buffer): New statics to hold buffers
allocate_reg_info allocates for {pref,alt}class_buffer.
(regclass): Use {pref,alt}class_buffer to initialize
{pref,alt}class.
(allocate_reg_info): Switch to make reg_n_info use varrays.
Allocate buffers for the preferred and alter register class
information. Change num_regs argument to be size_t, not int.
* flow.c (reg_n_info): Switch to use varrays.
Thu Jul 2 10:11:47 1998 Robert Lipe <robertl@dgii.com>
* install.texi (sco3.2v5): Document new --with-gnu-as flag.

View File

@ -637,7 +637,7 @@ OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \
function.o stmt.o except.o expr.o calls.o expmed.o explow.o optabs.o \
varasm.o rtl.o print-rtl.o rtlanal.o emit-rtl.o genrtl.o real.o regmove.o \
dbxout.o sdbout.o dwarfout.o dwarf2out.o xcoffout.o bitmap.o alias.o \
integrate.o jump.o cse.o loop.o unroll.o flow.o stupid.o combine.o \
integrate.o jump.o cse.o loop.o unroll.o flow.o stupid.o combine.o varray.o \
regclass.o local-alloc.o global.o reload.o reload1.o caller-save.o gcse.o \
insn-peep.o reorg.o $(SCHED_PREFIX)sched.o final.o recog.o reg-stack.o \
insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o \
@ -720,6 +720,7 @@ BASIC_BLOCK_H = basic-block.h bitmap.h
DEMANGLE_H = demangle.h gansidecl.h
RECOG_H = recog.h gansidecl.h
EXPR_H = expr.h insn-codes.h
REGS_H = regs.h varray.h machmode.h machmode.def gansidecl.h
#
# Language makefile fragments.
@ -1379,116 +1380,117 @@ print-rtl.o : print-rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h
rtlanal.o : rtlanal.c $(CONFIG_H) system.h $(RTL_H)
varasm.o : varasm.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h \
function.h defaults.h $(EXPR_H) hard-reg-set.h regs.h \
function.h defaults.h $(EXPR_H) hard-reg-set.h $(REGS_H) \
xcoffout.h output.h c-pragma.h toplev.h except.h dbxout.h sdbout.h
function.o : function.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
function.h insn-flags.h insn-codes.h $(EXPR_H) regs.h hard-reg-set.h \
function.h insn-flags.h insn-codes.h $(EXPR_H) $(REGS_H) hard-reg-set.h \
insn-config.h $(RECOG_H) output.h toplev.h except.h
stmt.o : stmt.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \
insn-flags.h insn-config.h insn-codes.h hard-reg-set.h $(EXPR_H) except.h \
loop.h $(RECOG_H) toplev.h output.h
except.o : except.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
function.h insn-flags.h $(EXPR_H) regs.h hard-reg-set.h \
function.h insn-flags.h $(EXPR_H) $(REGS_H) hard-reg-set.h \
insn-config.h $(RECOG_H) output.h except.h toplev.h
expr.o : expr.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \
regs.h insn-flags.h insn-codes.h $(EXPR_H) insn-config.h $(RECOG_H) output.h \
$(REGS_H) insn-flags.h insn-codes.h $(EXPR_H) insn-config.h $(RECOG_H) output.h \
typeclass.h hard-reg-set.h toplev.h hard-reg-set.h except.h
calls.o : calls.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h $(EXPR_H) \
insn-flags.h regs.h toplev.h output.h
insn-flags.h $(REGS_H) toplev.h output.h
expmed.o : expmed.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) real.h
explow.o : explow.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
hard-reg-set.h insn-config.h $(EXPR_H) $(RECOG_H) insn-flags.h insn-codes.h
optabs.o : optabs.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) reload.h
dbxout.o : dbxout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h regs.h \
dbxout.o : dbxout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h $(REGS_H) \
insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h dbxout.h \
toplev.h
sdbout.o : sdbout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h except.h \
function.h $(EXPR_H) output.h hard-reg-set.h regs.h defaults.h real.h \
function.h $(EXPR_H) output.h hard-reg-set.h $(REGS_H) defaults.h real.h \
insn-config.h obstack.h xcoffout.h c-pragma.h sdbout.h toplev.h
dwarfout.o : dwarfout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf.h \
flags.h insn-config.h reload.h output.h defaults.h toplev.h dwarfout.h
dwarf2out.o : dwarf2out.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf2.h \
flags.h insn-config.h reload.h output.h defaults.h \
hard-reg-set.h regs.h $(EXPR_H) toplev.h dwarf2out.h
hard-reg-set.h $(REGS_H) $(EXPR_H) toplev.h dwarf2out.h
xcoffout.o : xcoffout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) xcoffout.h \
flags.h toplev.h output.h dbxout.h
emit-rtl.o : emit-rtl.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
except.h function.h regs.h insn-config.h $(RECOG_H) real.h \
except.h function.h $(REGS_H) insn-config.h $(RECOG_H) real.h \
$(EXPR_H) obstack.h hard-reg-set.h bitmap.h
real.o : real.c $(CONFIG_H) system.h $(TREE_H) toplev.h
getpwd.o : getpwd.c $(CONFIG_H) system.h
integrate.o : integrate.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
integrate.h insn-flags.h insn-config.h $(EXPR_H) real.h regs.h \
integrate.h insn-flags.h insn-config.h $(EXPR_H) real.h $(REGS_H) \
function.h output.h $(RECOG_H) except.h toplev.h
jump.o : jump.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h regs.h \
jump.o : jump.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \
insn-config.h insn-flags.h $(RECOG_H) $(EXPR_H) real.h except.h \
toplev.h
stupid.o : stupid.c $(CONFIG_H) system.h $(RTL_H) regs.h hard-reg-set.h \
stupid.o : stupid.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h \
flags.h toplev.h
cse.o : cse.c $(CONFIG_H) system.h $(RTL_H) regs.h hard-reg-set.h flags.h \
cse.o : cse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h output.h
gcse.o : gcse.c $(CONFIG_H) system.h $(RTL_H) regs.h hard-reg-set.h flags.h \
gcse.o : gcse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
real.h insn-config.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) output.h
profile.o : profile.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-flags.h \
gcov-io.h $(TREE_H) output.h regs.h toplev.h
gcov-io.h $(TREE_H) output.h $(REGS_H) toplev.h
loop.o : loop.c $(CONFIG_H) system.h $(RTL_H) flags.h loop.h insn-config.h \
insn-flags.h regs.h hard-reg-set.h $(RECOG_H) $(EXPR_H) real.h \
insn-flags.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) real.h \
toplev.h
unroll.o : unroll.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \
integrate.h regs.h $(RECOG_H) flags.h $(EXPR_H) loop.h toplev.h
integrate.h $(REGS_H) $(RECOG_H) flags.h $(EXPR_H) loop.h toplev.h
flow.o : flow.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-config.h \
$(BASIC_BLOCK_H) regs.h hard-reg-set.h output.h toplev.h
$(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h
combine.o : combine.c $(CONFIG_H) system.h $(RTL_H) flags.h \
insn-config.h insn-flags.h insn-codes.h insn-attr.h regs.h $(EXPR_H) \
insn-config.h insn-flags.h insn-codes.h insn-attr.h $(REGS_H) $(EXPR_H) \
$(BASIC_BLOCK_H) $(RECOG_H) real.h hard-reg-set.h toplev.h
regclass.o : regclass.c $(CONFIG_H) system.h $(RTL_H) hard-reg-set.h flags.h \
$(BASIC_BLOCK_H) regs.h insn-config.h $(RECOG_H) reload.h real.h toplev.h \
$(BASIC_BLOCK_H) $(REGS_H) insn-config.h $(RECOG_H) reload.h real.h toplev.h \
output.h
local-alloc.o : local-alloc.c $(CONFIG_H) system.h $(RTL_H) flags.h \
$(BASIC_BLOCK_H) regs.h hard-reg-set.h insn-config.h $(RECOG_H) output.h \
$(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) output.h \
insn-attr.h toplev.h
bitmap.o : bitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H) \
regs.h
$(REGS_H)
global.o : global.c $(CONFIG_H) system.h $(RTL_H) flags.h \
$(BASIC_BLOCK_H) regs.h hard-reg-set.h insn-config.h output.h toplev.h
$(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h output.h toplev.h
varray.o : varray.c $(CONFIG_H) system.h varray.h $(RTL_H) $(TREE_H) bitmap.h
reload.o : reload.c $(CONFIG_H) system.h $(RTL_H) flags.h output.h $(EXPR_H) \
reload.h $(RECOG_H) hard-reg-set.h insn-config.h insn-codes.h regs.h \
reload.h $(RECOG_H) hard-reg-set.h insn-config.h insn-codes.h $(REGS_H) \
real.h toplev.h
reload1.o : reload1.c $(CONFIG_H) system.h $(RTL_H) real.h flags.h $(EXPR_H) \
reload.h regs.h hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
reload.h $(REGS_H) hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
$(BASIC_BLOCK_H) $(RECOG_H) output.h toplev.h
caller-save.o : caller-save.c $(CONFIG_H) system.h $(RTL_H) flags.h \
regs.h hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) \
$(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) \
$(RECOG_H) reload.h $(EXPR_H) toplev.h
reorg.o : reorg.c $(CONFIG_H) system.h $(RTL_H) conditions.h hard-reg-set.h \
$(BASIC_BLOCK_H) regs.h insn-config.h insn-attr.h \
$(BASIC_BLOCK_H) $(REGS_H) insn-config.h insn-attr.h \
insn-flags.h $(RECOG_H) flags.h output.h $(EXPR_H)
alias.o : alias.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h regs.h \
alias.o : alias.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \
toplev.h
regmove.o : regmove.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \
$(RECOG_H) output.h reload.h regs.h hard-reg-set.h flags.h \
$(RECOG_H) output.h reload.h $(REGS_H) hard-reg-set.h flags.h \
$(EXPR_H) insn-flags.h $(BASIC_BLOCK_H) toplev.h
$(SCHED_PREFIX)sched.o : $(SCHED_PREFIX)sched.c $(CONFIG_H) system.h $(RTL_H) \
$(BASIC_BLOCK_H) regs.h hard-reg-set.h flags.h insn-config.h insn-attr.h \
$(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h insn-attr.h \
toplev.h
final.o : final.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h regs.h \
final.o : final.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h $(REGS_H) \
$(RECOG_H) conditions.h insn-config.h insn-attr.h except.h real.h output.h \
hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h \
toplev.h reload.h dwarfout.h dwarf2out.h sdbout.h dbxout.h
recog.o : recog.c $(CONFIG_H) system.h $(RTL_H) \
regs.h $(RECOG_H) hard-reg-set.h flags.h insn-config.h insn-attr.h \
$(REGS_H) $(RECOG_H) hard-reg-set.h flags.h insn-config.h insn-attr.h \
insn-flags.h insn-codes.h real.h
reg-stack.o : reg-stack.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) \
regs.h hard-reg-set.h flags.h insn-config.h insn-flags.h toplev.h
$(REGS_H) hard-reg-set.h flags.h insn-config.h insn-flags.h toplev.h
$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) \
$(RTL_H) regs.h hard-reg-set.h real.h insn-config.h conditions.h \
$(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \
insn-flags.h output.h insn-attr.h insn-codes.h system.h toplev.h
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(out_file)
@ -1597,7 +1599,7 @@ s-extract : $(md_file) genextract $(srcdir)/move-if-change
$(srcdir)/move-if-change tmp-extract.c insn-extract.c
touch s-extract
insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) regs.h output.h real.h system.h
insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) $(REGS_H) output.h real.h system.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c
insn-peep.c: s-peep ; @true
@ -1606,7 +1608,7 @@ s-peep : $(md_file) genpeep $(srcdir)/move-if-change
$(srcdir)/move-if-change tmp-peep.c insn-peep.c
touch s-peep
insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) regs.h real.h output.h \
insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h output.h \
insn-attr.h insn-config.h system.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
@ -1628,7 +1630,7 @@ s-attrtab : $(md_file) genattrtab $(srcdir)/move-if-change
$(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
touch s-attrtab
insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) regs.h real.h conditions.h \
insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h conditions.h \
hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h $(RECOG_H) \
insn-codes.h system.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c
@ -1766,7 +1768,7 @@ $(HOST_PREFIX_1)print-rtl.o: $(srcdir)/print-rtl.c $(CONFIG_H) $(RTL_H)
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c
$(HOST_PREFIX_1)bitmap.o: $(srcdir)/bitmap.c $(CONFIG_H) system.h $(RTL_H) \
flags.h $(BASIC_BLOCK_H) regs.h
flags.h $(BASIC_BLOCK_H) $(REGS_H)
rm -f $(HOST_PREFIX)bitmap.c
sed -e 's/config[.]h/hconfig.h/' $(srcdir)/bitmap.c > $(HOST_PREFIX)bitmap.c
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)bitmap.c

View File

@ -1,5 +1,5 @@
/* Define control and data flow tables, and regsets.
Copyright (C) 1987, 1997 Free Software Foundation, Inc.
Copyright (C) 1987, 1997, 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -132,7 +132,7 @@ extern regset regs_live_at_setjmp;
#define REG_BLOCK_UNKNOWN -1
#define REG_BLOCK_GLOBAL -2
#define REG_BASIC_BLOCK(N) (reg_n_info[(N)].basic_block)
#define REG_BASIC_BLOCK(N) (VARRAY_REG (reg_n_info, N)->basic_block)
/* List of integers.
These are used for storing things like predecessors, etc.

View File

@ -174,7 +174,7 @@ static int num_scratch;
/* Indexed by n, giving various register information */
reg_info *reg_n_info;
varray_type reg_n_info;
/* Size of the reg_n_info table. */

View File

@ -193,6 +193,21 @@ static rtx top_of_stack[MAX_MACHINE_MODE];
#endif /* HAVE_SECONDARY_RELOADS */
/* Linked list of reg_info structures allocated for reg_n_info array.
Grouping all of the allocated structures together in one lump
means only one call to bzero to clear them, rather than n smaller
calls. */
struct reg_info_data {
struct reg_info_data *next; /* next set of reg_info structures */
size_t min_index; /* minimum index # */
size_t max_index; /* maximum index # */
char used_p; /* non-zero if this has been used previously */
reg_info data[1]; /* beginning of the reg_info data */
};
static struct reg_info_data *reg_info_head;
/* Function called only once to initialize the above data on reg usage.
Once this is done, various switches may override. */
@ -637,6 +652,10 @@ static char *prefclass;
static char *altclass;
/* Allocated buffers for prefclass and altclass. */
static char *prefclass_buffer;
static char *altclass_buffer;
/* Record the depth of loops that we are in. */
static int loop_depth;
@ -987,8 +1006,8 @@ regclass (f, nregs)
if (pass == 0)
{
prefclass = (char *) oballoc (nregs);
altclass = (char *) oballoc (nregs);
prefclass = prefclass_buffer;
altclass = altclass_buffer;
}
for (i = FIRST_PSEUDO_REGISTER; i < nregs; i++)
@ -1750,29 +1769,36 @@ auto_inc_dec_reg_p (reg, mode)
void
allocate_reg_info (num_regs, new_p, renumber_p)
int num_regs;
size_t num_regs;
int new_p;
int renumber_p;
{
static int regno_allocated = 0;
static size_t regno_allocated = 0;
static short *renumber = (short *)0;
int i;
int size_info;
int size_renumber;
int min = (new_p) ? 0 : reg_n_max;
/* 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. */
size_t size_info;
size_t size_renumber;
size_t min = (new_p) ? 0 : reg_n_max;
struct reg_info_data *reg_data;
struct reg_info_data *reg_next;
/* 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;
VARRAY_FREE (reg_n_info);
for (reg_data = reg_info_head; reg_data; reg_data = reg_next)
{
reg_next = reg_data->next;
free ((char *)reg_data);
}
free (prefclass_buffer);
free (altclass_buffer);
prefclass_buffer = (char *)0;
altclass_buffer = (char *)0;
reg_info_head = (struct reg_info_data *)0;
renumber = (short *)0;
}
regno_allocated = 0;
@ -1782,39 +1808,91 @@ allocate_reg_info (num_regs, new_p, renumber_p)
if (num_regs > regno_allocated)
{
size_t old_allocated = regno_allocated;
regno_allocated = num_regs + (num_regs / 20); /* add some slop space */
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);
VARRAY_REG_INIT (reg_n_info, regno_allocated, "reg_n_info");
renumber = (short *) xmalloc (size_renumber);
prefclass_buffer = (char *) xmalloc (regno_allocated);
altclass_buffer = (char *) xmalloc (regno_allocated);
}
else
{
reg_n_info = (reg_info *) xrealloc ((char *)reg_n_info, size_info);
renumber = (short *) xrealloc ((char *)renumber, size_renumber);
VARRAY_GROW (reg_n_info, regno_allocated);
if (new_p) /* if we're zapping everything, no need to realloc */
{
free ((char *)renumber);
free ((char *)prefclass_buffer);
free ((char *)altclass_buffer);
renumber = (short *) xmalloc (size_renumber);
prefclass_buffer = (char *) xmalloc (regno_allocated);
altclass_buffer = (char *) xmalloc (regno_allocated);
}
else
{
renumber = (short *) xrealloc ((char *)renumber, size_renumber);
prefclass_buffer = (char *) xrealloc ((char *)prefclass_buffer,
regno_allocated);
altclass_buffer = (char *) xrealloc ((char *)altclass_buffer,
regno_allocated);
}
}
size_info = (regno_allocated - old_allocated) * sizeof (reg_info)
+ sizeof (struct reg_info_data) - sizeof (reg_info);
reg_data = (struct reg_info_data *) xcalloc (size_info, 1);
reg_data->min_index = old_allocated;
reg_data->max_index = regno_allocated - 1;
reg_data->next = reg_info_head;
reg_info_head = reg_data;
}
reg_n_max = num_regs;
if (min < num_regs)
{
/* Loop through each of the segments allocated for the actual
reg_info pages, and set up the pointers, zero the pages, etc. */
for (reg_data = reg_info_head; reg_data; reg_data = reg_next)
{
size_t min_index = reg_data->min_index;
size_t max_index = reg_data->max_index;
reg_next = reg_data->next;
if (min_index <= num_regs)
{
size_t max = (max_index > num_regs) ? num_regs : max_index;
if (!reg_data->used_p) /* page just allocated with calloc */
reg_data->used_p = 1; /* no need to zero */
else
bzero ((char *) &reg_data->data,
sizeof (reg_info) * (max - min_index + 1));
for (i = min_index; i <= max; i++)
{
VARRAY_REG (reg_n_info, i) = &reg_data->data[i-min_index];
REG_BASIC_BLOCK (i) = REG_BLOCK_UNKNOWN;
renumber[i] = -1;
prefclass_buffer[i] = (char) NO_REGS;
altclass_buffer[i] = (char) NO_REGS;
}
}
}
}
if (min < num_regs)
/* If {pref,alt}class have already been allocated, update the pointers to
the newly realloced ones. */
if (prefclass)
{
bzero ((char *) &reg_n_info[min], (num_regs - min) * sizeof (reg_info));
for (i = min; i < num_regs; i++)
{
REG_BASIC_BLOCK (i) = REG_BLOCK_UNKNOWN;
renumber[i] = -1;
}
prefclass = prefclass_buffer;
altclass = altclass_buffer;
}
if (renumber_p)
@ -1822,8 +1900,6 @@ allocate_reg_info (num_regs, new_p, renumber_p)
/* Tell the regset code about the new number of registers */
MAX_REGNO_REG_SET (num_regs, new_p, renumber_p);
reg_n_max = num_regs;
}

View File

@ -1,5 +1,5 @@
/* Define per-register tables for data flow info and register allocation.
Copyright (C) 1987, 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
Copyright (C) 1987, 1993, 1994, 1995, 1997, 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -19,6 +19,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "varray.h"
#define REG_BYTES(R) mode_size[(int) GET_MODE (R)]
@ -60,30 +61,20 @@ typedef struct reg_info_def {
char changes_size; /* whether (SUBREG (REG n)) changes size */
} reg_info;
extern reg_info *reg_n_info;
extern varray_type reg_n_info;
extern unsigned int reg_n_max;
/* Check for REG_N_xxx macros being in bound, return N for use as an
index. */
#ifdef ENABLE_CHECKING
#define REG_N_CHECK(N) \
((((unsigned)(N) < (unsigned)reg_n_max) \
? 0 : (fatal ("Register %d out of bounds", (N)), 0)), (N))
#else
#define REG_N_CHECK(N) (N)
#endif
/* Indexed by n, gives number of times (REG n) is used or set.
References within loops may be counted more times. */
#define REG_N_REFS(N) (reg_n_info[REG_N_CHECK (N)].refs)
#define REG_N_REFS(N) (VARRAY_REG (reg_n_info, N)->refs)
/* Indexed by n, gives number of times (REG n) is set.
??? both regscan and flow allocate space for this. We should settle
on just copy. */
#define REG_N_SETS(N) (reg_n_info[REG_N_CHECK (N)].sets)
#define REG_N_SETS(N) (VARRAY_REG (reg_n_info, N)->sets)
/* Indexed by N, gives number of insns in which register N dies.
Note that if register N is live around loops, it can die
@ -91,13 +82,13 @@ extern unsigned int reg_n_max;
So this is only a reliable indicator of how many regions of life there are
for registers that are contained in one basic block. */
#define REG_N_DEATHS(N) (reg_n_info[REG_N_CHECK (N)].deaths)
#define REG_N_DEATHS(N) (VARRAY_REG (reg_n_info, N)->deaths)
/* Indexed by N; says whether a pseudo register N was ever used
within a SUBREG that changes the size of the reg. Some machines prohibit
such objects to be in certain (usually floating-point) registers. */
#define REG_CHANGES_SIZE(N) (reg_n_info[REG_N_CHECK (N)].changes_size)
#define REG_CHANGES_SIZE(N) (VARRAY_REG (reg_n_info, N)->changes_size)
/* Get the number of consecutive words required to hold pseudo-reg N. */
@ -116,7 +107,7 @@ extern unsigned int reg_n_max;
/* Indexed by N, gives number of CALL_INSNS across which (REG n) is live. */
#define REG_N_CALLS_CROSSED(N) (reg_n_info[REG_N_CHECK (N)].calls_crossed)
#define REG_N_CALLS_CROSSED(N) (VARRAY_REG (reg_n_info, N)->calls_crossed)
/* Total number of instructions at which (REG n) is live.
The larger this is, the less priority (REG n) gets for
@ -133,7 +124,7 @@ extern unsigned int reg_n_max;
is not required. global.c makes an allocno for this but does
not try to assign a hard register to it. */
#define REG_LIVE_LENGTH(N) (reg_n_info[REG_N_CHECK (N)].live_length)
#define REG_LIVE_LENGTH(N) (VARRAY_REG (reg_n_info, N)->live_length)
/* Vector of substitutions of register numbers,
used to map pseudo regs into hardware regs.
@ -165,7 +156,7 @@ extern enum machine_mode reg_raw_mode[FIRST_PSEUDO_REGISTER];
It is sometimes adjusted for subsequent changes during loop,
but not adjusted by cse even if cse invalidates it. */
#define REGNO_FIRST_UID(N) (reg_n_info[REG_N_CHECK (N)].first_uid)
#define REGNO_FIRST_UID(N) (VARRAY_REG (reg_n_info, N)->first_uid)
/* Vector indexed by regno; gives uid of last insn using that reg.
This is computed by reg_scan for use by cse and loop.
@ -173,11 +164,11 @@ extern enum machine_mode reg_raw_mode[FIRST_PSEUDO_REGISTER];
but not adjusted by cse even if cse invalidates it.
This is harmless since cse won't scan through a loop end. */
#define REGNO_LAST_UID(N) (reg_n_info[REG_N_CHECK (N)].last_uid)
#define REGNO_LAST_UID(N) (VARRAY_REG (reg_n_info, N)->last_uid)
/* Similar, but includes insns that mention the reg in their notes. */
#define REGNO_LAST_NOTE_UID(N) (reg_n_info[REG_N_CHECK (N)].last_note_uid)
#define REGNO_LAST_NOTE_UID(N) (VARRAY_REG (reg_n_info, N)->last_note_uid)
/* This is reset to LAST_VIRTUAL_REGISTER + 1 at the start of each function.
After rtl generation, it is 1 plus the largest register number used. */
@ -230,4 +221,4 @@ extern int *scratch_block;
extern int scratch_list_length;
/* Allocate reg_n_info tables */
extern void allocate_reg_info PROTO((int, int, int));
extern void allocate_reg_info PROTO((size_t, int, int));