From c8f5fc7032940ad6633f932ac40cade82ec4d0cc Mon Sep 17 00:00:00 2001 From: obrien Date: Thu, 9 May 2002 20:02:13 +0000 Subject: Gcc 3.1.0 pre-release from the FSF anoncvs repo on 9-May-2002 15:57:15 EDT. --- contrib/gcc/rtlanal.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 76 insertions(+), 8 deletions(-) (limited to 'contrib/gcc/rtlanal.c') diff --git a/contrib/gcc/rtlanal.c b/contrib/gcc/rtlanal.c index f185c61..d6efc74 100644 --- a/contrib/gcc/rtlanal.c +++ b/contrib/gcc/rtlanal.c @@ -64,6 +64,7 @@ rtx_unstable_p (x) case CONST: case CONST_INT: case CONST_DOUBLE: + case CONST_VECTOR: case SYMBOL_REF: case LABEL_REF: return 0; @@ -139,6 +140,7 @@ rtx_varies_p (x, for_alias) case CONST: case CONST_INT: case CONST_DOUBLE: + case CONST_VECTOR: case SYMBOL_REF: case LABEL_REF: return 0; @@ -502,6 +504,7 @@ count_occurrences (x, find, count_dest) case REG: case CONST_INT: case CONST_DOUBLE: + case CONST_VECTOR: case SYMBOL_REF: case CODE_LABEL: case PC: @@ -580,7 +583,8 @@ reg_mentioned_p (reg, in) case CONST_INT: return GET_CODE (reg) == CONST_INT && INTVAL (in) == INTVAL (reg); - + + case CONST_VECTOR: case CONST_DOUBLE: /* These are kept unique for a given value. */ return 0; @@ -829,6 +833,7 @@ regs_set_between_p (x, start, end) { case CONST_INT: case CONST_DOUBLE: + case CONST_VECTOR: case CONST: case SYMBOL_REF: case LABEL_REF: @@ -875,6 +880,7 @@ modified_between_p (x, start, end) { case CONST_INT: case CONST_DOUBLE: + case CONST_VECTOR: case CONST: case SYMBOL_REF: case LABEL_REF: @@ -930,6 +936,7 @@ modified_in_p (x, insn) { case CONST_INT: case CONST_DOUBLE: + case CONST_VECTOR: case CONST: case SYMBOL_REF: case LABEL_REF: @@ -1535,17 +1542,12 @@ note_stores (x, fun, data) dest = XEXP (dest, 0); /* If we have a PARALLEL, SET_DEST is a list of EXPR_LIST expressions, - each of whose first operand is a register. We can't know what - precisely is being set in these cases, so make up a CLOBBER to pass - to the function. */ + each of whose first operand is a register. */ if (GET_CODE (dest) == PARALLEL) { for (i = XVECLEN (dest, 0) - 1; i >= 0; i--) if (XEXP (XVECEXP (dest, 0, i), 0) != 0) - (*fun) (XEXP (XVECEXP (dest, 0, i), 0), - gen_rtx_CLOBBER (VOIDmode, - XEXP (XVECEXP (dest, 0, i), 0)), - data); + (*fun) (XEXP (XVECEXP (dest, 0, i), 0), x, data); } else (*fun) (dest, x, data); @@ -1924,6 +1926,31 @@ find_regno_fusage (insn, code, regno) return 0; } + +/* Return true if INSN is a call to a pure function. */ + +int +pure_call_p (insn) + rtx insn; +{ + rtx link; + + if (GET_CODE (insn) != CALL_INSN || ! CONST_OR_PURE_CALL_P (insn)) + return 0; + + /* Look for the note that differentiates const and pure functions. */ + for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1)) + { + rtx u, m; + + if (GET_CODE (u = XEXP (link, 0)) == USE + && GET_CODE (m = XEXP (u, 0)) == MEM && GET_MODE (m) == BLKmode + && GET_CODE (XEXP (m, 0)) == SCRATCH) + return 1; + } + + return 0; +} /* Remove register note NOTE from the REG_NOTES of INSN. */ @@ -2021,6 +2048,7 @@ volatile_insn_p (x) case CONST_INT: case CONST: case CONST_DOUBLE: + case CONST_VECTOR: case CC0: case PC: case REG: @@ -2087,6 +2115,7 @@ volatile_refs_p (x) case CONST_INT: case CONST: case CONST_DOUBLE: + case CONST_VECTOR: case CC0: case PC: case REG: @@ -2153,6 +2182,7 @@ side_effects_p (x) case CONST_INT: case CONST: case CONST_DOUBLE: + case CONST_VECTOR: case CC0: case PC: case REG: @@ -2231,6 +2261,7 @@ may_trap_p (x) /* Handle these cases quickly. */ case CONST_INT: case CONST_DOUBLE: + case CONST_VECTOR: case SYMBOL_REF: case LABEL_REF: case CONST: @@ -2339,6 +2370,7 @@ inequality_comparisons_p (x) case CC0: case CONST_INT: case CONST_DOUBLE: + case CONST_VECTOR: case CONST: case LABEL_REF: case SYMBOL_REF: @@ -2405,6 +2437,40 @@ replace_rtx (x, from, to) if (x == 0) return 0; + if (GET_CODE (x) == SUBREG) + { + rtx new = replace_rtx (SUBREG_REG (x), from, to); + + if (GET_CODE (new) == CONST_INT) + { + x = simplify_subreg (GET_MODE (x), new, + GET_MODE (SUBREG_REG (x)), + SUBREG_BYTE (x)); + if (! x) + abort (); + } + else + SUBREG_REG (x) = new; + + return x; + } + else if (GET_CODE (x) == ZERO_EXTEND) + { + rtx new = replace_rtx (XEXP (x, 0), from, to); + + if (GET_CODE (new) == CONST_INT) + { + x = simplify_unary_operation (ZERO_EXTEND, GET_MODE (x), + new, GET_MODE (XEXP (x, 0))); + if (! x) + abort (); + } + else + XEXP (x, 0) = new; + + return x; + } + fmt = GET_RTX_FORMAT (GET_CODE (x)); for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--) { @@ -2452,6 +2518,7 @@ replace_regs (x, reg_map, nregs, replace_dest) case CC0: case CONST_INT: case CONST_DOUBLE: + case CONST_VECTOR: case CONST: case SYMBOL_REF: case LABEL_REF: @@ -2542,6 +2609,7 @@ computed_jump_p_1 (x) case CONST: case CONST_INT: case CONST_DOUBLE: + case CONST_VECTOR: case SYMBOL_REF: case REG: return 1; -- cgit v1.1