+2006-03-14 Kazu Hirata <kazu@codesourcery.com>
+
+ * Makefile.in (reg-stack.o): Don't depend on gt-reg-stack.h.
+ * reg-stack.c (stack_regs_mentioned_data): Change the type to
+ VEC(char,heap) *.
+ (stack_regs_mentioned): Update the uses of
+ stack_regs_mentioned_data. Don't access the array beyond its
+ end.
+ (reg_to_stack): Update the uses of stack_regs_mentioned_data.
+ Don't include gt-reg-stack.h.
+
2006-03-14 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* pa/pa32-linux.h (CRT_CALL_STATIC_FUNCTION): Fix typo.
reg-stack.o : reg-stack.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(RTL_H) $(TREE_H) $(RECOG_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) \
insn-config.h toplev.h reload.h $(FUNCTION_H) $(TM_P_H) $(GGC_H) \
- gt-reg-stack.h $(BASIC_BLOCK_H) output.h $(VARRAY_H) timevar.h tree-pass.h \
+ $(BASIC_BLOCK_H) output.h $(VARRAY_H) timevar.h tree-pass.h \
target.h
sreal.o: sreal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) sreal.h
predict.o: predict.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
gt-emit-rtl.h gt-explow.h gt-stor-layout.h gt-regclass.h \
gt-lists.h gt-alias.h gt-cselib.h gt-gcse.h \
gt-expr.h gt-sdbout.h gt-optabs.h gt-bitmap.h gt-dojump.h \
-gt-dwarf2out.h gt-reg-stack.h gt-dwarf2asm.h \
+gt-dwarf2out.h gt-dwarf2asm.h \
gt-dbxout.h \
gtype-c.h gt-cfglayout.h \
gt-tree-mudflap.h gt-tree-vect-generic.h \
#include "tree-pass.h"
#include "target.h"
+DEF_VEC_I(char);
+DEF_VEC_ALLOC_I(char,heap);
+
/* We use this array to cache info about insns, because otherwise we
spend too much time in stack_regs_mentioned_p.
Indexed by insn UIDs. A value of zero is uninitialized, one indicates
the insn uses stack registers, two indicates the insn does not use
stack registers. */
-static GTY(()) varray_type stack_regs_mentioned_data;
+static VEC(char,heap) *stack_regs_mentioned_data;
#ifdef STACK_REGS
return 0;
uid = INSN_UID (insn);
- max = VARRAY_SIZE (stack_regs_mentioned_data);
+ max = VEC_length (char, stack_regs_mentioned_data);
if (uid >= max)
{
+ char *p;
+ unsigned int old_max = max;
+
/* Allocate some extra size to avoid too many reallocs, but
do not grow too quickly. */
- max = uid + uid / 20;
- VARRAY_GROW (stack_regs_mentioned_data, max);
+ max = uid + uid / 20 + 1;
+ VEC_safe_grow (char, heap, stack_regs_mentioned_data, max);
+ p = VEC_address (char, stack_regs_mentioned_data);
+ memset (&p[old_max], 0,
+ sizeof (char) * (max - old_max));
}
- test = VARRAY_CHAR (stack_regs_mentioned_data, uid);
+ test = VEC_index (char, stack_regs_mentioned_data, uid);
if (test == 0)
{
/* This insn has yet to be examined. Do so now. */
test = stack_regs_mentioned_p (PATTERN (insn)) ? 1 : 2;
- VARRAY_CHAR (stack_regs_mentioned_data, uid) = test;
+ VEC_replace (char, stack_regs_mentioned_data, uid, test);
}
return test == 1;
int max_uid;
/* Clean up previous run. */
- stack_regs_mentioned_data = 0;
+ if (stack_regs_mentioned_data != NULL)
+ VEC_free (char, heap, stack_regs_mentioned_data);
/* See if there is something to do. Flow analysis is quite
expensive so we might save some compilation time. */
/* Allocate a cache for stack_regs_mentioned. */
max_uid = get_max_uid ();
- VARRAY_CHAR_INIT (stack_regs_mentioned_data, max_uid + 1,
- "stack_regs_mentioned cache");
+ stack_regs_mentioned_data = VEC_alloc (char, heap, max_uid + 1);
+ memset (VEC_address (char, stack_regs_mentioned_data),
+ 0, sizeof (char) * max_uid + 1);
convert_regs ();
TODO_ggc_collect, /* todo_flags_finish */
'k' /* letter */
};
-
-#include "gt-reg-stack.h"