aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto-streamer-in.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/lto-streamer-in.c')
-rw-r--r--gcc/lto-streamer-in.c72
1 files changed, 35 insertions, 37 deletions
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 15905f8..2c5a760 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -203,7 +203,7 @@ lto_input_tree_ref (struct lto_input_block *ib, struct data_in *data_in,
case LTO_ssa_name_ref:
ix_u = streamer_read_uhwi (ib);
- result = VEC_index (tree, SSANAMES (fn), ix_u);
+ result = (*SSANAMES (fn))[ix_u];
break;
case LTO_field_decl_ref:
@@ -403,24 +403,22 @@ static void
fixup_eh_region_pointers (struct function *fn, HOST_WIDE_INT root_region)
{
unsigned i;
- VEC(eh_region,gc) *eh_array = fn->eh->region_array;
- VEC(eh_landing_pad,gc) *lp_array = fn->eh->lp_array;
+ vec<eh_region, va_gc> *eh_array = fn->eh->region_array;
+ vec<eh_landing_pad, va_gc> *lp_array = fn->eh->lp_array;
eh_region r;
eh_landing_pad lp;
gcc_assert (eh_array && lp_array);
gcc_assert (root_region >= 0);
- fn->eh->region_tree = VEC_index (eh_region, eh_array, root_region);
+ fn->eh->region_tree = (*eh_array)[root_region];
-#define FIXUP_EH_REGION(r) (r) = VEC_index (eh_region, eh_array, \
- (HOST_WIDE_INT) (intptr_t) (r))
-#define FIXUP_EH_LP(p) (p) = VEC_index (eh_landing_pad, lp_array, \
- (HOST_WIDE_INT) (intptr_t) (p))
+#define FIXUP_EH_REGION(r) (r) = (*eh_array)[(HOST_WIDE_INT) (intptr_t) (r)]
+#define FIXUP_EH_LP(p) (p) = (*lp_array)[(HOST_WIDE_INT) (intptr_t) (p)]
/* Convert all the index numbers stored in pointer fields into
pointers to the corresponding slots in the EH region array. */
- FOR_EACH_VEC_ELT (eh_region, eh_array, i, r)
+ FOR_EACH_VEC_ELT (*eh_array, i, r)
{
/* The array may contain NULL regions. */
if (r == NULL)
@@ -435,7 +433,7 @@ fixup_eh_region_pointers (struct function *fn, HOST_WIDE_INT root_region)
/* Convert all the index numbers stored in pointer fields into
pointers to the corresponding slots in the EH landing pad array. */
- FOR_EACH_VEC_ELT (eh_landing_pad, lp_array, i, lp)
+ FOR_EACH_VEC_ELT (*lp_array, i, lp)
{
/* The array may contain NULL landing pads. */
if (lp == NULL)
@@ -504,11 +502,11 @@ input_eh_regions (struct lto_input_block *ib, struct data_in *data_in,
gcc_assert (len == (int) len);
if (len > 0)
{
- VEC_safe_grow (eh_region, gc, fn->eh->region_array, len);
+ vec_safe_grow_cleared (fn->eh->region_array, len);
for (i = 0; i < len; i++)
{
eh_region r = input_eh_region (ib, data_in, i);
- VEC_replace (eh_region, fn->eh->region_array, i, r);
+ (*fn->eh->region_array)[i] = r;
}
}
@@ -517,11 +515,11 @@ input_eh_regions (struct lto_input_block *ib, struct data_in *data_in,
gcc_assert (len == (int) len);
if (len > 0)
{
- VEC_safe_grow (eh_landing_pad, gc, fn->eh->lp_array, len);
+ vec_safe_grow_cleared (fn->eh->lp_array, len);
for (i = 0; i < len; i++)
{
eh_landing_pad lp = input_eh_lp (ib, data_in, i);
- VEC_replace (eh_landing_pad, fn->eh->lp_array, i, lp);
+ (*fn->eh->lp_array)[i] = lp;
}
}
@@ -530,11 +528,11 @@ input_eh_regions (struct lto_input_block *ib, struct data_in *data_in,
gcc_assert (len == (int) len);
if (len > 0)
{
- VEC_safe_grow (tree, gc, fn->eh->ttype_data, len);
+ vec_safe_grow_cleared (fn->eh->ttype_data, len);
for (i = 0; i < len; i++)
{
tree ttype = stream_read_tree (ib, data_in);
- VEC_replace (tree, fn->eh->ttype_data, i, ttype);
+ (*fn->eh->ttype_data)[i] = ttype;
}
}
@@ -545,20 +543,20 @@ input_eh_regions (struct lto_input_block *ib, struct data_in *data_in,
{
if (targetm.arm_eabi_unwinder)
{
- VEC_safe_grow (tree, gc, fn->eh->ehspec_data.arm_eabi, len);
+ vec_safe_grow_cleared (fn->eh->ehspec_data.arm_eabi, len);
for (i = 0; i < len; i++)
{
tree t = stream_read_tree (ib, data_in);
- VEC_replace (tree, fn->eh->ehspec_data.arm_eabi, i, t);
+ (*fn->eh->ehspec_data.arm_eabi)[i] = t;
}
}
else
{
- VEC_safe_grow (uchar, gc, fn->eh->ehspec_data.other, len);
+ vec_safe_grow_cleared (fn->eh->ehspec_data.other, len);
for (i = 0; i < len; i++)
{
uchar c = streamer_read_uchar (ib);
- VEC_replace (uchar, fn->eh->ehspec_data.other, i, c);
+ (*fn->eh->ehspec_data.other)[i] = c;
}
}
}
@@ -605,13 +603,11 @@ input_cfg (struct lto_input_block *ib, struct function *fn,
bb_count = streamer_read_uhwi (ib);
last_basic_block_for_function (fn) = bb_count;
- if (bb_count > VEC_length (basic_block, basic_block_info_for_function (fn)))
- VEC_safe_grow_cleared (basic_block, gc,
- basic_block_info_for_function (fn), bb_count);
+ if (bb_count > basic_block_info_for_function (fn)->length ())
+ vec_safe_grow_cleared (basic_block_info_for_function (fn), bb_count);
- if (bb_count > VEC_length (basic_block, label_to_block_map_for_function (fn)))
- VEC_safe_grow_cleared (basic_block, gc,
- label_to_block_map_for_function (fn), bb_count);
+ if (bb_count > label_to_block_map_for_function (fn)->length ())
+ vec_safe_grow_cleared (label_to_block_map_for_function (fn), bb_count);
index = streamer_read_hwi (ib);
while (index != -1)
@@ -685,8 +681,8 @@ input_ssa_names (struct lto_input_block *ib, struct data_in *data_in,
bool is_default_def;
/* Skip over the elements that had been freed. */
- while (VEC_length (tree, SSANAMES (fn)) < i)
- VEC_quick_push (tree, SSANAMES (fn), NULL_TREE);
+ while (SSANAMES (fn)->length () < i)
+ SSANAMES (fn)->quick_push (NULL_TREE);
is_default_def = (streamer_read_uchar (ib) != 0);
name = stream_read_tree (ib, data_in);
@@ -762,11 +758,11 @@ input_struct_function_base (struct function *fn, struct data_in *data_in,
if (len > 0)
{
int i;
- VEC_safe_grow (tree, gc, fn->local_decls, len);
+ vec_safe_grow_cleared (fn->local_decls, len);
for (i = 0; i < len; i++)
{
tree t = stream_read_tree (ib, data_in);
- VEC_replace (tree, fn->local_decls, i, t);
+ (*fn->local_decls)[i] = t;
}
}
@@ -929,7 +925,8 @@ lto_read_body (struct lto_file_decl_data *file_data, tree fn_decl,
header->main_size);
data_in = lto_data_in_create (file_data, data + string_offset,
- header->string_size, NULL);
+ header->string_size,
+ vec<ld_plugin_symbol_resolution_t>());
/* Make sure the file was generated by the exact same compiler. */
lto_check_version (header->lto_header.major_version,
@@ -957,16 +954,16 @@ lto_read_body (struct lto_file_decl_data *file_data, tree fn_decl,
input_cfg (&ib_cfg, fn, node->count_materialization_scale);
/* Set up the struct function. */
- from = VEC_length (tree, data_in->reader_cache->nodes);
+ from = data_in->reader_cache->nodes.length ();
input_function (fn_decl, data_in, &ib_main);
/* And fixup types we streamed locally. */
{
struct streamer_tree_cache_d *cache = data_in->reader_cache;
- unsigned len = VEC_length (tree, cache->nodes);
+ unsigned len = cache->nodes.length ();
unsigned i;
for (i = len; i-- > from;)
{
- tree t = VEC_index (tree, cache->nodes, i);
+ tree t = cache->nodes[i];
if (t == NULL_TREE)
continue;
@@ -1127,7 +1124,8 @@ lto_input_toplevel_asms (struct lto_file_decl_data *file_data, int order_base)
header->main_size);
data_in = lto_data_in_create (file_data, data + string_offset,
- header->string_size, NULL);
+ header->string_size,
+ vec<ld_plugin_symbol_resolution_t>());
/* Make sure the file was generated by the exact same compiler. */
lto_check_version (header->lto_header.major_version,
@@ -1166,7 +1164,7 @@ lto_reader_init (void)
struct data_in *
lto_data_in_create (struct lto_file_decl_data *file_data, const char *strings,
unsigned len,
- VEC(ld_plugin_symbol_resolution_t,heap) *resolutions)
+ vec<ld_plugin_symbol_resolution_t> resolutions)
{
struct data_in *data_in = XCNEW (struct data_in);
data_in->file_data = file_data;
@@ -1184,7 +1182,7 @@ lto_data_in_create (struct lto_file_decl_data *file_data, const char *strings,
void
lto_data_in_delete (struct data_in *data_in)
{
- VEC_free (ld_plugin_symbol_resolution_t, heap, data_in->globals_resolution);
+ data_in->globals_resolution.release ();
streamer_tree_cache_delete (data_in->reader_cache);
free (data_in->labels);
free (data_in);