From f32682ca2516e009432be7f0dc0e4e4bfab9a944 Mon Sep 17 00:00:00 2001 From: Diego Novillo Date: Mon, 10 Sep 2012 20:04:13 -0400 Subject: Remove unnecessary VEC function overloads. Several VEC member functions that accept an element 'T' used to have two overloads: one taking 'T', the second taking 'T *'. This used to be needed because of the interface dichotomy between vectors of objects and vectors of pointers. In the past, vectors of pointers would use pass-by-value semantics, but vectors of objects would use pass-by-reference semantics. This is no longer necessary, but the distinction had remained. The main side-effect of this change is some code reduction in code that manipulates vectors of objects. For instance, - struct iterator_use *iuse; - - iuse = VEC_safe_push (iterator_use, heap, iterator_uses, NULL); - iuse->iterator = iterator; - iuse->ptr = ptr; + struct iterator_use iuse = {iterator, ptr}; + VEC_safe_push (iterator_use, heap, iterator_uses, iuse); Compile time performance was not affected. Tested on x86_64 and ppc64. Also built all-gcc on all targets using VEC routines: arm, bfin, c6x, epiphany, ia64, mips, sh, spu, and vms. 2012-09-10 Diego Novillo * vec.h (vec_t::quick_push): Remove overload that accepts 'T *'. Update all users. (vec_t::safe_push): Likewise. (vec_t::quick_insert): Likewise. (vec_t::lower_bound): Likewise. (vec_t::safe_insert): Likewise. (vec_t::replace): Change second argument to 'T &'. From-SVN: r191165 --- gcc/ipa-prop.c | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) (limited to 'gcc/ipa-prop.c') diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 8ee871c..9729145 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -1342,11 +1342,10 @@ determine_known_aggregate_parts (gimple call, tree arg, { if (list->constant) { - struct ipa_agg_jf_item *item; - item = VEC_quick_push (ipa_agg_jf_item_t, - jfunc->agg.items, NULL); - item->offset = list->offset - arg_offset; - item->value = list->constant; + struct ipa_agg_jf_item item; + item.offset = list->offset - arg_offset; + item.value = list->constant; + VEC_quick_push (ipa_agg_jf_item_t, jfunc->agg.items, item); } list = list->next; } @@ -3023,45 +3022,44 @@ ipa_combine_adjustments (ipa_parm_adjustment_vec inner, if (n->remove_param) removals++; else - VEC_quick_push (ipa_parm_adjustment_t, tmp, n); + VEC_quick_push (ipa_parm_adjustment_t, tmp, *n); } adjustments = VEC_alloc (ipa_parm_adjustment_t, heap, outlen + removals); for (i = 0; i < outlen; i++) { - struct ipa_parm_adjustment *r; + struct ipa_parm_adjustment r; struct ipa_parm_adjustment *out = &VEC_index (ipa_parm_adjustment_t, outer, i); struct ipa_parm_adjustment *in = &VEC_index (ipa_parm_adjustment_t, tmp, out->base_index); + memset (&r, 0, sizeof (r)); gcc_assert (!in->remove_param); if (out->remove_param) { if (!index_in_adjustments_multiple_times_p (in->base_index, tmp)) { - r = VEC_quick_push (ipa_parm_adjustment_t, adjustments, NULL); - memset (r, 0, sizeof (*r)); - r->remove_param = true; + r.remove_param = true; + VEC_quick_push (ipa_parm_adjustment_t, adjustments, r); } continue; } - r = VEC_quick_push (ipa_parm_adjustment_t, adjustments, NULL); - memset (r, 0, sizeof (*r)); - r->base_index = in->base_index; - r->type = out->type; + r.base_index = in->base_index; + r.type = out->type; /* FIXME: Create nonlocal value too. */ if (in->copy_param && out->copy_param) - r->copy_param = true; + r.copy_param = true; else if (in->copy_param) - r->offset = out->offset; + r.offset = out->offset; else if (out->copy_param) - r->offset = in->offset; + r.offset = in->offset; else - r->offset = in->offset + out->offset; + r.offset = in->offset + out->offset; + VEC_quick_push (ipa_parm_adjustment_t, adjustments, r); } for (i = 0; i < inlen; i++) @@ -3070,7 +3068,7 @@ ipa_combine_adjustments (ipa_parm_adjustment_vec inner, inner, i); if (n->remove_param) - VEC_quick_push (ipa_parm_adjustment_t, adjustments, n); + VEC_quick_push (ipa_parm_adjustment_t, adjustments, *n); } VEC_free (ipa_parm_adjustment_t, heap, tmp); @@ -3238,11 +3236,10 @@ ipa_read_jump_function (struct lto_input_block *ib, } for (i = 0; i < count; i++) { - struct ipa_agg_jf_item *item = VEC_quick_push (ipa_agg_jf_item_t, - jump_func->agg.items, NULL); - - item->offset = streamer_read_uhwi (ib); - item->value = stream_read_tree (ib, data_in); + struct ipa_agg_jf_item item; + item.offset = streamer_read_uhwi (ib); + item.value = stream_read_tree (ib, data_in); + VEC_quick_push (ipa_agg_jf_item_t, jump_func->agg.items, item); } } -- cgit v1.1