On Mon, Apr 25, 2016 at 02:56:07PM +0200, Bernd Schmidt wrote: > On 04/20/2016 08:22 AM, tbsaunde+...@tbsaunde.org wrote: > > > >-static rtx_expr_list * > >+static vec<rtx> > > extract_mentioned_regs (rtx x) > > { > >- rtx_expr_list *mentioned_regs = NULL; > >+ vec<rtx> mentioned_regs = vNULL; > > subrtx_var_iterator::array_type array; > > FOR_EACH_SUBRTX_VAR (iter, array, x, NONCONST) > > { > > rtx x = *iter; > > if (REG_P (x)) > >- mentioned_regs = alloc_EXPR_LIST (0, x, mentioned_regs); > >+ mentioned_regs.safe_push (x); > > } > > return mentioned_regs; > > } > > Is it really such a great idea to return a vec by value? I'd rather pass a > pointer to it into the function and operate on that.
Well, at the moment its harmless since vec is POD and so you just copy the pointer to the data (note there are other places that do this). However I agree it would be nice to stop returning vec<>. Trev > > > Bernd