aboutsummaryrefslogtreecommitdiff
path: root/gcc/regclass.c
diff options
context:
space:
mode:
authorKazu Hirata <kazu@codesourcery.com>2006-04-14 02:28:46 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2006-04-14 02:28:46 +0000
commit1935e8a86d3141a0d28263330fd428be06c5ecfa (patch)
tree17efbc0a6f42d3bc2e77211baecf71bc557f15d4 /gcc/regclass.c
parent062e124a4c940665698d4d596d1327c741854f83 (diff)
downloadgcc-1935e8a86d3141a0d28263330fd428be06c5ecfa.zip
gcc-1935e8a86d3141a0d28263330fd428be06c5ecfa.tar.gz
gcc-1935e8a86d3141a0d28263330fd428be06c5ecfa.tar.bz2
basic-block.h (REG_BASIC_BLOCK): Use VEC instead of VARRAY.
* basic-block.h (REG_BASIC_BLOCK): Use VEC instead of VARRAY. * flow.c (reg_n_info): Change the type to VEC(reg_info_p,heap) *. * regclass.c (allocate_reg_info, free_reg_info): Use VEC instead of VARRAY. * regs.h (reg_info_p): New. (REG_N_REFS, REG_FREQ, REG_N_SETS, REG_N_DEATHS, REG_N_CALLS_CROSSED, REG_N_THROWING_CALLS_CROSSED, REG_LIVE_LENGTH, REGNO_FIRST_UID, REGNO_LAST_UID): Use VEC instead of VARRAY. From-SVN: r112942
Diffstat (limited to 'gcc/regclass.c')
-rw-r--r--gcc/regclass.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/gcc/regclass.c b/gcc/regclass.c
index 1f1e6c2..8a0bab1 100644
--- a/gcc/regclass.c
+++ b/gcc/regclass.c
@@ -2176,13 +2176,28 @@ allocate_reg_info (size_t num_regs, int new_p, int renumber_p)
if (!reg_n_info)
{
- VARRAY_REG_INIT (reg_n_info, regno_allocated, "reg_n_info");
+ reg_n_info = VEC_alloc (reg_info_p, heap, regno_allocated);
+ VEC_safe_grow (reg_info_p, heap, reg_n_info, regno_allocated);
+ memset (VEC_address (reg_info_p, reg_n_info), 0,
+ sizeof (reg_info_p) * regno_allocated);
renumber = xmalloc (size_renumber);
reg_pref_buffer = XNEWVEC (struct reg_pref, regno_allocated);
}
else
{
- VARRAY_GROW (reg_n_info, regno_allocated);
+ size_t old_length = VEC_length (reg_info_p, reg_n_info);
+ if (old_length < regno_allocated)
+ {
+ reg_info_p *addr;
+ VEC_safe_grow (reg_info_p, heap, reg_n_info, regno_allocated);
+ addr = VEC_address (reg_info_p, reg_n_info);
+ memset (&addr[old_length], 0,
+ sizeof (reg_info_p) * (regno_allocated - old_length));
+ }
+ else if (regno_allocated < old_length)
+ {
+ VEC_truncate (reg_info_p, reg_n_info, regno_allocated);
+ }
if (new_p) /* If we're zapping everything, no need to realloc. */
{
@@ -2238,7 +2253,8 @@ allocate_reg_info (size_t num_regs, int new_p, int renumber_p)
for (i = min_index+local_min; i <= max; i++)
{
- VARRAY_REG (reg_n_info, i) = &reg_data->data[i-min_index];
+ VEC_replace (reg_info_p, reg_n_info, i,
+ &reg_data->data[i-min_index]);
REG_BASIC_BLOCK (i) = REG_BLOCK_UNKNOWN;
renumber[i] = -1;
reg_pref_buffer[i].prefclass = (char) NO_REGS;
@@ -2265,7 +2281,7 @@ free_reg_info (void)
struct reg_info_data *reg_data;
struct reg_info_data *reg_next;
- VARRAY_FREE (reg_n_info);
+ VEC_free (reg_info_p, heap, reg_n_info);
for (reg_data = reg_info_head; reg_data; reg_data = reg_next)
{
reg_next = reg_data->next;