From 9dd648e2991b29c1a2aa7aabffa4f083e87639af Mon Sep 17 00:00:00 2001 From: jakub Date: Fri, 12 Mar 2010 13:27:43 +0000 Subject: [PATCH] * cselib.c (LONG_TERM_PRESERVED_VALUE_P): Remove. (cselib_preserve_definitely, cselib_clear_preserve): Remove. (cselib_preserve_only_values): Remove retain argument, don't traverse hash table with cselib_{preserve_definitely,clear_preserve}. * cselib.h (cselib_preserve_only_values): Remove retain argument. * var-tracking.c (micro_operation): Move insn field before union. Add DEF_VEC_O and DEF_VEC_ALLOC_O for this type. (struct variable_tracking_info_def): Remove n_mos field, change mos into a vector of micro_operations. (count_uses, count_uses_1, count_stores, count_with_sets): Remove. (bb_stack_adjust_offset, log_op_type, add_uses, add_stores, compute_bb_dataflow, emit_notes_in_bb): Adjust for VTI (bb)->mos changing into a vector. (add_with_sets): Likewise. Ensure MO_VAL_USE uops from add_stores come before all other uops generated by add_stores. (vt_add_function_parameters): Adjust for cselib_preserve_only_values argument removal. (vt_initialize): Likewise. Adjust for VTI (bb)->mos changing into a vector. Run just one pass over the bbs instead of separate counting and computation phase. (vt_finalize): Free VTI (bb)->mos vector instead of array. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157403 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 22 +++++++++++++++++++++ gcc/cselib.c | 12 ------------ gcc/cselib.h | 1 - gcc/var-tracking.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 75 insertions(+), 17 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 19eb672bb68..97fb00622e7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,27 @@ 2010-03-12 Jakub Jelinek + * cselib.c (LONG_TERM_PRESERVED_VALUE_P): Remove. + (cselib_preserve_definitely, cselib_clear_preserve): Remove. + (cselib_preserve_only_values): Remove retain argument, don't + traverse hash table with cselib_{preserve_definitely,clear_preserve}. + * cselib.h (cselib_preserve_only_values): Remove retain argument. + * var-tracking.c (micro_operation): Move insn field before union. + Add DEF_VEC_O and DEF_VEC_ALLOC_O for this type. + (struct variable_tracking_info_def): Remove n_mos field, change + mos into a vector of micro_operations. + (count_uses, count_uses_1, count_stores, count_with_sets): Remove. + (bb_stack_adjust_offset, log_op_type, add_uses, add_stores, + compute_bb_dataflow, emit_notes_in_bb): Adjust for VTI (bb)->mos + changing into a vector. + (add_with_sets): Likewise. Ensure MO_VAL_USE uops from add_stores + come before all other uops generated by add_stores. + (vt_add_function_parameters): Adjust for cselib_preserve_only_values + argument removal. + (vt_initialize): Likewise. Adjust for VTI (bb)->mos changing into + a vector. Run just one pass over the bbs instead of separate counting + and computation phase. + (vt_finalize): Free VTI (bb)->mos vector instead of array. + PR debug/43329 * tree-inline.c (remap_decls): Put old_var rather than origin_var into *nonlocalized_list vector. diff --git a/gcc/cselib.c b/gcc/cselib.c index f46c5ecb29b..b5750a0f5c0 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -567,18 +567,6 @@ cselib_preserved_value_p (cselib_val *v) return PRESERVED_VALUE_P (v->val_rtx); } -/* Arrange for a REG value to be assumed constant through the whole function, - never invalidated and preserved across cselib_reset_table calls. */ - -void -cselib_preserve_cfa_base_value (cselib_val *v) -{ - if (cselib_preserve_constants - && v->locs - && REG_P (v->locs->loc)) - cfa_base_preserved_val = v; -} - /* Clean all non-constant expressions in the hash table, but retain their values. */ diff --git a/gcc/cselib.h b/gcc/cselib.h index 90d963888c6..ce0bd2bf27a 100644 --- a/gcc/cselib.h +++ b/gcc/cselib.h @@ -99,6 +99,5 @@ extern unsigned int cselib_get_next_uid (void); extern void cselib_preserve_value (cselib_val *); extern bool cselib_preserved_value_p (cselib_val *); extern void cselib_preserve_only_values (void); -extern void cselib_preserve_cfa_base_value (cselib_val *); extern void dump_cselib_table (FILE *); diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 0c413123264..5e261d67edd 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -614,6 +614,29 @@ insn_stack_adjust_offset_pre_post (rtx insn, HOST_WIDE_INT *pre, } } +/* Compute stack adjustment in basic block BB. */ + +static void +bb_stack_adjust_offset (basic_block bb) +{ + HOST_WIDE_INT offset; + unsigned int i; + micro_operation *mo; + + offset = VTI (bb)->in.stack_adjust; + for (i = 0; VEC_iterate (micro_operation, VTI (bb)->mos, i, mo); i++) + { + if (mo->type == MO_ADJUST) + offset += mo->u.adjust; + else if (mo->type != MO_CALL) + { + if (MEM_P (mo->u.loc)) + mo->u.loc = adjust_stack_reference (mo->u.loc, -offset); + } + } + VTI (bb)->out.stack_adjust = offset; +} + /* Compute stack adjustments for all blocks by traversing DFS tree. Return true when the adjustments on all incoming edges are consistent. Heavily borrowed from pre_and_rev_post_order_compute. */ @@ -4851,6 +4874,30 @@ log_op_type (rtx x, basic_block bb, rtx insn, fputc ('\n', out); } +/* Adjust sets if needed. Currently this optimizes read-only MEM loads + if REG_EQUAL/REG_EQUIV note is present. */ + +static void +adjust_sets (rtx insn, struct cselib_set *sets, int n_sets) +{ + if (n_sets == 1 && MEM_P (sets[0].src) && MEM_READONLY_P (sets[0].src)) + { + /* For read-only MEMs containing some constant, prefer those + constants. */ + rtx note = find_reg_equal_equiv_note (insn), src; + + if (note && CONSTANT_P (XEXP (note, 0))) + { + sets[0].src = src = XEXP (note, 0); + if (GET_CODE (PATTERN (insn)) == COND_EXEC) + src = gen_rtx_IF_THEN_ELSE (GET_MODE (sets[0].dest), + COND_EXEC_TEST (PATTERN (insn)), + src, sets[0].dest); + sets[0].src_elt = cselib_lookup (src, GET_MODE (sets[0].dest), 1); + } + } +} + /* Tell whether the CONCAT used to holds a VALUE and its location needs value resolution, i.e., an attempt of mapping the location back to other incoming values. */ @@ -5213,7 +5260,6 @@ add_stores (rtx loc, const_rtx expr, void *cuip) if (REG_P (loc)) { - gcc_assert (loc != cfa_base_rtx); if ((GET_CODE (expr) == CLOBBER && type != MO_VAL_SET) || !(track_p = use_type (loc, NULL, &mode2) == MO_USE) || GET_CODE (expr) == CLOBBER) @@ -8252,8 +8298,6 @@ vt_initialize (void) /* Add the micro-operations to the vector. */ FOR_BB_BETWEEN (bb, first_bb, last_bb->next_bb, next_bb) { - HOST_WIDE_INT offset = VTI (bb)->out.stack_adjust; - VTI (bb)->out.stack_adjust = VTI (bb)->in.stack_adjust; for (insn = BB_HEAD (bb); insn != NEXT_INSN (BB_END (bb)); insn = NEXT_INSN (insn)) { @@ -8268,6 +8312,9 @@ vt_initialize (void) mo.type = MO_ADJUST; mo.u.adjust = pre; mo.insn = insn; + VEC_safe_push (micro_operation, heap, VTI (bb)->mos, + &mo); + if (dump_file && (dump_flags & TDF_DETAILS)) log_op_type (PATTERN (insn), bb, insn, MO_ADJUST, dump_file); @@ -8298,6 +8345,9 @@ vt_initialize (void) mo.type = MO_ADJUST; mo.u.adjust = post; mo.insn = insn; + VEC_safe_push (micro_operation, heap, VTI (bb)->mos, + &mo); + if (dump_file && (dump_flags & TDF_DETAILS)) log_op_type (PATTERN (insn), bb, insn, MO_ADJUST, dump_file); @@ -8316,7 +8366,6 @@ vt_initialize (void) } } } - gcc_assert (offset == VTI (bb)->out.stack_adjust); } bb = last_bb; -- 2.11.0