X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fcse.c;h=0904ee688b6c918f21bb1f7d6502af4b0cf96633;hb=7d2188e888651f20602de3f7b08f6c101957b89b;hp=ae676851632fe6604209ff40fee4c12692de26e8;hpb=20d892d1b5bad381d02001ab7beef9b34b2223e6;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/cse.c b/gcc/cse.c index ae676851632..0904ee688b6 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -573,7 +573,6 @@ static struct table_elt *insert (rtx, struct table_elt *, unsigned, enum machine_mode); static void merge_equiv_classes (struct table_elt *, struct table_elt *); static void invalidate (rtx, enum machine_mode); -static bool cse_rtx_varies_p (const_rtx, bool); static void remove_invalid_refs (unsigned int); static void remove_invalid_subreg_refs (unsigned int, unsigned int, enum machine_mode); @@ -1846,8 +1845,7 @@ check_dependence (rtx *x, void *data) { struct check_dependence_data *d = (struct check_dependence_data *) data; if (*x && MEM_P (*x)) - return canon_true_dependence (d->exp, d->mode, d->addr, *x, NULL_RTX, - cse_rtx_varies_p); + return canon_true_dependence (d->exp, d->mode, d->addr, *x, NULL_RTX); else return 0; } @@ -2557,7 +2555,7 @@ hash_rtx_cb (const_rtx x, enum machine_mode mode, Store 1 in DO_NOT_RECORD_P if any subexpression is volatile. If HASH_ARG_IN_MEMORY_P is not NULL, store 1 in it if X contains - a MEM rtx which does not have the RTX_UNCHANGING_P bit set. + a MEM rtx which does not have the MEM_READONLY_P flag set. Note that cse_insn knows that the hash code of a MEM expression is just (int) MEM plus the hash code of the address. */ @@ -2573,7 +2571,7 @@ hash_rtx (const_rtx x, enum machine_mode mode, int *do_not_record_p, /* Hash an rtx X for cse via hash_rtx. Stores 1 in do_not_record if any subexpression is volatile. Stores 1 in hash_arg_in_memory if X contains a mem rtx which - does not have the RTX_UNCHANGING_P bit set. */ + does not have the MEM_READONLY_P flag set. */ static inline unsigned canon_hash (rtx x, enum machine_mode mode) @@ -2794,67 +2792,6 @@ exp_equiv_p (const_rtx x, const_rtx y, int validate, bool for_gcse) return 1; } -/* Return 1 if X has a value that can vary even between two - executions of the program. 0 means X can be compared reliably - against certain constants or near-constants. */ - -static bool -cse_rtx_varies_p (const_rtx x, bool from_alias) -{ - /* We need not check for X and the equivalence class being of the same - mode because if X is equivalent to a constant in some mode, it - doesn't vary in any mode. */ - - if (REG_P (x) - && REGNO_QTY_VALID_P (REGNO (x))) - { - int x_q = REG_QTY (REGNO (x)); - struct qty_table_elem *x_ent = &qty_table[x_q]; - - if (GET_MODE (x) == x_ent->mode - && x_ent->const_rtx != NULL_RTX) - return 0; - } - - if (GET_CODE (x) == PLUS - && CONST_INT_P (XEXP (x, 1)) - && REG_P (XEXP (x, 0)) - && REGNO_QTY_VALID_P (REGNO (XEXP (x, 0)))) - { - int x0_q = REG_QTY (REGNO (XEXP (x, 0))); - struct qty_table_elem *x0_ent = &qty_table[x0_q]; - - if ((GET_MODE (XEXP (x, 0)) == x0_ent->mode) - && x0_ent->const_rtx != NULL_RTX) - return 0; - } - - /* This can happen as the result of virtual register instantiation, if - the initial constant is too large to be a valid address. This gives - us a three instruction sequence, load large offset into a register, - load fp minus a constant into a register, then a MEM which is the - sum of the two `constant' registers. */ - if (GET_CODE (x) == PLUS - && REG_P (XEXP (x, 0)) - && REG_P (XEXP (x, 1)) - && REGNO_QTY_VALID_P (REGNO (XEXP (x, 0))) - && REGNO_QTY_VALID_P (REGNO (XEXP (x, 1)))) - { - int x0_q = REG_QTY (REGNO (XEXP (x, 0))); - int x1_q = REG_QTY (REGNO (XEXP (x, 1))); - struct qty_table_elem *x0_ent = &qty_table[x0_q]; - struct qty_table_elem *x1_ent = &qty_table[x1_q]; - - if ((GET_MODE (XEXP (x, 0)) == x0_ent->mode) - && x0_ent->const_rtx != NULL_RTX - && (GET_MODE (XEXP (x, 1)) == x1_ent->mode) - && x1_ent->const_rtx != NULL_RTX) - return 0; - } - - return rtx_varies_p (x, from_alias); -} - /* Subroutine of canon_reg. Pass *XLOC through canon_reg, and validate the result if necessary. INSN is as for canon_reg. */ @@ -3055,6 +2992,12 @@ find_comparison_args (enum rtx_code code, rtx *parg1, rtx *parg2, if (! exp_equiv_p (p->exp, p->exp, 1, false)) continue; + /* If it's the same comparison we're already looking at, skip it. */ + if (COMPARISON_P (p->exp) + && XEXP (p->exp, 0) == arg1 + && XEXP (p->exp, 1) == arg2) + continue; + if (GET_CODE (p->exp) == COMPARE /* Another possibility is that this machine has a compare insn that includes the comparison code. In that case, ARG1 would