From e97f62233f326cae658d7f9b42d2f944c616bb91 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Wed, 6 Jul 2016 23:53:20 +0000 Subject: [PATCH] make side_effects a vec gcc/ChangeLog: 2016-07-06 Trevor Saunders * var-tracking.c (struct adjust_mem_data): Make side_effects a vector. (adjust_mems): Adjust. (adjust_insn): Likewise. (prepare_call_arguments): Likewise. From-SVN: r238066 --- gcc/ChangeLog | 7 +++++++ gcc/var-tracking.c | 33 ++++++++++++++------------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4a35420b85c..48edbc59810 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-07-06 Trevor Saunders + + * var-tracking.c (struct adjust_mem_data): Make side_effects a vector. + (adjust_mems): Adjust. + (adjust_insn): Likewise. + (prepare_call_arguments): Likewise. + 2016-07-06 Trevor Saunders * gcse.c (struct ls_expr): Make stores field a vector. diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 9f09d30b1f9..5d09879bccd 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -926,7 +926,7 @@ struct adjust_mem_data bool store; machine_mode mem_mode; HOST_WIDE_INT stack_adjust; - rtx_expr_list *side_effects; + auto_vec side_effects; }; /* Helper for adjust_mems. Return true if X is suitable for @@ -1072,9 +1072,7 @@ adjust_mems (rtx loc, const_rtx old_rtx, void *data) amd->store = false; tem = simplify_replace_fn_rtx (tem, old_rtx, adjust_mems, data); amd->store = store_save; - amd->side_effects = alloc_EXPR_LIST (0, - gen_rtx_SET (XEXP (loc, 0), tem), - amd->side_effects); + amd->side_effects.safe_push (gen_rtx_SET (XEXP (loc, 0), tem)); return addr; case PRE_MODIFY: addr = XEXP (loc, 1); @@ -1088,9 +1086,7 @@ adjust_mems (rtx loc, const_rtx old_rtx, void *data) tem = simplify_replace_fn_rtx (XEXP (loc, 1), old_rtx, adjust_mems, data); amd->store = store_save; - amd->side_effects = alloc_EXPR_LIST (0, - gen_rtx_SET (XEXP (loc, 0), tem), - amd->side_effects); + amd->side_effects.safe_push (gen_rtx_SET (XEXP (loc, 0), tem)); return addr; case SUBREG: /* First try without delegitimization of whole MEMs and @@ -1184,7 +1180,6 @@ adjust_mem_stores (rtx loc, const_rtx expr, void *data) static void adjust_insn (basic_block bb, rtx_insn *insn) { - struct adjust_mem_data amd; rtx set; #ifdef HAVE_window_save @@ -1213,9 +1208,9 @@ adjust_insn (basic_block bb, rtx_insn *insn) } #endif + adjust_mem_data amd; amd.mem_mode = VOIDmode; amd.stack_adjust = -VTI (bb)->out.stack_adjust; - amd.side_effects = NULL; amd.store = true; note_stores (PATTERN (insn), adjust_mem_stores, &amd); @@ -1281,10 +1276,10 @@ adjust_insn (basic_block bb, rtx_insn *insn) validate_change (NULL_RTX, &SET_SRC (set), XEXP (note, 0), true); } - if (amd.side_effects) + if (!amd.side_effects.is_empty ()) { - rtx *pat, new_pat, s; - int i, oldn, newn; + rtx *pat, new_pat; + int i, oldn; pat = &PATTERN (insn); if (GET_CODE (*pat) == COND_EXEC) @@ -1293,17 +1288,18 @@ adjust_insn (basic_block bb, rtx_insn *insn) oldn = XVECLEN (*pat, 0); else oldn = 1; - for (s = amd.side_effects, newn = 0; s; newn++) - s = XEXP (s, 1); + unsigned int newn = amd.side_effects.length (); new_pat = gen_rtx_PARALLEL (VOIDmode, rtvec_alloc (oldn + newn)); if (GET_CODE (*pat) == PARALLEL) for (i = 0; i < oldn; i++) XVECEXP (new_pat, 0, i) = XVECEXP (*pat, 0, i); else XVECEXP (new_pat, 0, 0) = *pat; - for (s = amd.side_effects, i = oldn; i < oldn + newn; i++, s = XEXP (s, 1)) - XVECEXP (new_pat, 0, i) = XEXP (s, 0); - free_EXPR_LIST_list (&amd.side_effects); + + rtx effect; + unsigned int j; + FOR_EACH_VEC_ELT_REVERSE (amd.side_effects, j, effect) + XVECEXP (new_pat, 0, j + oldn) = effect; validate_change (NULL_RTX, pat, new_pat, true); } } @@ -6335,11 +6331,10 @@ prepare_call_arguments (basic_block bb, rtx_insn *insn) struct adjust_mem_data amd; amd.mem_mode = VOIDmode; amd.stack_adjust = -VTI (bb)->out.stack_adjust; - amd.side_effects = NULL; amd.store = true; mem = simplify_replace_fn_rtx (mem, NULL_RTX, adjust_mems, &amd); - gcc_assert (amd.side_effects == NULL_RTX); + gcc_assert (amd.side_effects.is_empty ()); } val = cselib_lookup (mem, GET_MODE (mem), 0, VOIDmode); if (val && cselib_preserved_value_p (val)) -- 2.30.2