diff options
author | Kazu Hirata <kazu@codesourcery.com> | 2006-04-18 12:32:11 +0000 |
---|---|---|
committer | Kazu Hirata <kazu@gcc.gnu.org> | 2006-04-18 12:32:11 +0000 |
commit | 6370682af493743331f75d3d5baddff3ffbe1234 (patch) | |
tree | cad6dcd18e053b0942232163fd9d1917b95533ef /gcc/function.c | |
parent | 13a41b42ed2e0f70716f810d3a4d10cadb02dcb2 (diff) | |
download | gcc-6370682af493743331f75d3d5baddff3ffbe1234.zip gcc-6370682af493743331f75d3d5baddff3ffbe1234.tar.gz gcc-6370682af493743331f75d3d5baddff3ffbe1234.tar.bz2 |
function.c (temp_slots_at_level, [...]): Use VEC instead of VARRAY.
* function.c (temp_slots_at_level, max_slot_level): Use VEC
instead of VARRAY.
* function.h (temp_slot_p): New.
(function): Change the type of x_used_temp_slots to
VEC(temp_slot_p,gc) *.
From-SVN: r113029
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/gcc/function.c b/gcc/function.c index 26c99fa..cc50f50 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -546,14 +546,18 @@ insert_slot_to_list (struct temp_slot *temp, struct temp_slot **list) static struct temp_slot ** temp_slots_at_level (int level) { + if (level >= (int) VEC_length (temp_slot_p, used_temp_slots)) + { + size_t old_length = VEC_length (temp_slot_p, used_temp_slots); + temp_slot_p *p; - if (!used_temp_slots) - VARRAY_GENERIC_PTR_INIT (used_temp_slots, 3, "used_temp_slots"); - - while (level >= (int) VARRAY_ACTIVE_SIZE (used_temp_slots)) - VARRAY_PUSH_GENERIC_PTR (used_temp_slots, NULL); + VEC_safe_grow (temp_slot_p, gc, used_temp_slots, level + 1); + p = VEC_address (temp_slot_p, used_temp_slots); + memset (&p[old_length], 0, + sizeof (temp_slot_p) * (level + 1 - old_length)); + } - return (struct temp_slot **) &VARRAY_GENERIC_PTR (used_temp_slots, level); + return &(VEC_address (temp_slot_p, used_temp_slots)[level]); } /* Returns the maximal temporary slot level. */ @@ -564,7 +568,7 @@ max_slot_level (void) if (!used_temp_slots) return -1; - return VARRAY_ACTIVE_SIZE (used_temp_slots) - 1; + return VEC_length (temp_slot_p, used_temp_slots) - 1; } /* Moves temporary slot TEMP to LEVEL. */ |