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/var-tracking.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'gcc/var-tracking.c') diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 818fb24..8c9ec48 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -5510,7 +5510,7 @@ add_uses (rtx *ploc, void *data) if (dump_file && (dump_flags & TDF_DETAILS)) log_op_type (mo.u.loc, cui->bb, cui->insn, mo.type, dump_file); - VEC_safe_push (micro_operation, heap, VTI (bb)->mos, &mo); + VEC_safe_push (micro_operation, heap, VTI (bb)->mos, mo); } return 0; @@ -5794,7 +5794,7 @@ add_stores (rtx loc, const_rtx expr, void *cuip) if (dump_file && (dump_flags & TDF_DETAILS)) log_op_type (moa.u.loc, cui->bb, cui->insn, moa.type, dump_file); - VEC_safe_push (micro_operation, heap, VTI (bb)->mos, &moa); + VEC_safe_push (micro_operation, heap, VTI (bb)->mos, moa); } resolve = false; @@ -5881,7 +5881,7 @@ add_stores (rtx loc, const_rtx expr, void *cuip) log_and_return: if (dump_file && (dump_flags & TDF_DETAILS)) log_op_type (mo.u.loc, cui->bb, cui->insn, mo.type, dump_file); - VEC_safe_push (micro_operation, heap, VTI (bb)->mos, &mo); + VEC_safe_push (micro_operation, heap, VTI (bb)->mos, mo); } /* Arguments to the call. */ @@ -6300,7 +6300,7 @@ add_with_sets (rtx insn, struct cselib_set *sets, int n_sets) if (dump_file && (dump_flags & TDF_DETAILS)) log_op_type (PATTERN (insn), bb, insn, mo.type, dump_file); - VEC_safe_push (micro_operation, heap, VTI (bb)->mos, &mo); + VEC_safe_push (micro_operation, heap, VTI (bb)->mos, mo); } n1 = VEC_length (micro_operation, VTI (bb)->mos); @@ -7864,7 +7864,9 @@ loc_exp_insert_dep (variable var, rtx x, htab_t vars) led = (loc_exp_dep *) pool_alloc (loc_exp_dep_pool); else { - VEC_quick_push (loc_exp_dep, VAR_LOC_DEP_VEC (var), NULL); + loc_exp_dep empty; + memset (&empty, 0, sizeof (empty)); + VEC_quick_push (loc_exp_dep, VAR_LOC_DEP_VEC (var), empty); led = &VEC_last (loc_exp_dep, VAR_LOC_DEP_VEC (var)); } led->dv = var->dv; @@ -9815,7 +9817,7 @@ vt_initialize (void) log_op_type (PATTERN (insn), bb, insn, MO_ADJUST, dump_file); VEC_safe_push (micro_operation, heap, VTI (bb)->mos, - &mo); + mo); VTI (bb)->out.stack_adjust += pre; } } @@ -9847,7 +9849,7 @@ vt_initialize (void) log_op_type (PATTERN (insn), bb, insn, MO_ADJUST, dump_file); VEC_safe_push (micro_operation, heap, VTI (bb)->mos, - &mo); + mo); VTI (bb)->out.stack_adjust += post; } -- cgit v1.1