From 3f03d2db0ee6cc97fc21009b2be574c445bb4e1b Mon Sep 17 00:00:00 2001 From: nemet Date: Wed, 1 Jul 2009 21:34:58 +0000 Subject: * combine.c (force_to_mode): Handle TRUNCATE. Factor out truncation from operands in binary operations. testsuite/ * gcc.target/mips/truncate-4.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149154 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index b8c080c3057..a4f0d66c731 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -7358,6 +7358,10 @@ force_to_mode (rtx x, enum machine_mode mode, unsigned HOST_WIDE_INT mask, return force_to_mode (SUBREG_REG (x), mode, mask, next_select); break; + case TRUNCATE: + /* Similarly for a truncate. */ + return force_to_mode (XEXP (x, 0), mode, mask, next_select); + case AND: /* If this is an AND with a constant, convert it into an AND whose constant is the AND of that constant with MASK. If it @@ -7502,12 +7506,20 @@ force_to_mode (rtx x, enum machine_mode mode, unsigned HOST_WIDE_INT mask, /* For most binary operations, just propagate into the operation and change the mode if we have an operation of that mode. */ - op0 = gen_lowpart_or_truncate (op_mode, - force_to_mode (XEXP (x, 0), mode, mask, - next_select)); - op1 = gen_lowpart_or_truncate (op_mode, - force_to_mode (XEXP (x, 1), mode, mask, - next_select)); + op0 = force_to_mode (XEXP (x, 0), mode, mask, next_select); + op1 = force_to_mode (XEXP (x, 1), mode, mask, next_select); + + /* If we ended up truncating both operands, truncate the result of the + operation instead. */ + if (GET_CODE (op0) == TRUNCATE + && GET_CODE (op1) == TRUNCATE) + { + op0 = XEXP (op0, 0); + op1 = XEXP (op1, 0); + } + + op0 = gen_lowpart_or_truncate (op_mode, op0); + op1 = gen_lowpart_or_truncate (op_mode, op1); if (op_mode != GET_MODE (x) || op0 != XEXP (x, 0) || op1 != XEXP (x, 1)) x = simplify_gen_binary (code, op_mode, op0, op1); -- cgit v1.2.1 From 658e15232bc46902b731b3249ec79781fb43f2f3 Mon Sep 17 00:00:00 2001 From: nemet Date: Thu, 9 Jul 2009 05:32:21 +0000 Subject: * combine.c (make_extraction): Check TRULY_NOOP_TRUNCATION before creating LHS paradoxical subregs. Fix surrounding returns to use NULL_RTX rather than 0. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149401 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index a4f0d66c731..a781484b764 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -6692,18 +6692,25 @@ make_extraction (enum machine_mode mode, rtx inner, HOST_WIDE_INT pos, inner = adjust_address_nv (inner, wanted_inner_mode, offset); } - /* If INNER is not memory, we can always get it into the proper mode. If we - are changing its mode, POS must be a constant and smaller than the size - of the new mode. */ + /* If INNER is not memory, get it into the proper mode. If we are changing + its mode, POS must be a constant and smaller than the size of the new + mode. */ else if (!MEM_P (inner)) { + /* On the LHS, don't create paradoxical subregs implicitely truncating + the register unless TRULY_NOOP_TRUNCATION. */ + if (in_dest + && !TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (GET_MODE (inner)), + GET_MODE_BITSIZE (wanted_inner_mode))) + return NULL_RTX; + if (GET_MODE (inner) != wanted_inner_mode && (pos_rtx != 0 || orig_pos + len > GET_MODE_BITSIZE (wanted_inner_mode))) - return 0; + return NULL_RTX; if (orig_pos < 0) - return 0; + return NULL_RTX; inner = force_to_mode (inner, wanted_inner_mode, pos_rtx -- cgit v1.2.1 From 5b46cc62ce28f594560412cc42a87db3a9e8795a Mon Sep 17 00:00:00 2001 From: nemet Date: Sat, 18 Jul 2009 21:46:01 +0000 Subject: * combine.c (simplify_shift_const_1): Split code to determine shift_mode into ... (try_widen_shift_mode): ... here. Allow widening for ASHIFTRT if the new bits shifted in are identical to the old sign bit. testsuite/ * gcc.target/mips/octeon-exts-7.c: New test. * gcc.target/mips/octeon-exts-2.c: Revert previous change. * gcc.target/mips/octeon-exts-5.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149778 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 53 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 15 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index a781484b764..a0157df7140 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -8982,6 +8982,42 @@ merge_outer_ops (enum rtx_code *pop0, HOST_WIDE_INT *pconst0, enum rtx_code op1, return 1; } +/* A helper to simplify_shift_const_1 to determine the mode we can perform + the shift in. The original shift operation CODE is performed on OP in + ORIG_MODE. Return the wider mode MODE if we can perform the operation + in that mode. Return ORIG_MODE otherwise. */ + +static enum machine_mode +try_widen_shift_mode (enum rtx_code code, rtx op, + enum machine_mode orig_mode, enum machine_mode mode) +{ + if (orig_mode == mode) + return mode; + gcc_assert (GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (orig_mode)); + + /* In general we can't perform in wider mode for right shift and rotate. */ + switch (code) + { + case ASHIFTRT: + /* We can still widen if the bits brought in from the left are identical + to the sign bit of ORIG_MODE. */ + if (num_sign_bit_copies (op, mode) + > (unsigned) (GET_MODE_BITSIZE (mode) + - GET_MODE_BITSIZE (orig_mode))) + return mode; + /* fall through */ + case LSHIFTRT: + case ROTATE: + return orig_mode; + + case ROTATERT: + gcc_unreachable (); + + default: + return mode; + } +} + /* Simplify a shift of VAROP by COUNT bits. CODE says what kind of shift. The result of the shift is RESULT_MODE. Return NULL_RTX if we cannot simplify it. Otherwise, return a simplified value. @@ -9041,13 +9077,7 @@ simplify_shift_const_1 (enum rtx_code code, enum machine_mode result_mode, count = bitsize - count; } - /* We need to determine what mode we will do the shift in. If the - shift is a right shift or a ROTATE, we must always do it in the mode - it was originally done in. Otherwise, we can do it in MODE, the - widest mode encountered. */ - shift_mode - = (code == ASHIFTRT || code == LSHIFTRT || code == ROTATE - ? result_mode : mode); + shift_mode = try_widen_shift_mode (code, varop, result_mode, mode); /* Handle cases where the count is greater than the size of the mode minus 1. For ASHIFT, use the size minus one as the count (this can @@ -9645,14 +9675,7 @@ simplify_shift_const_1 (enum rtx_code code, enum machine_mode result_mode, break; } - /* We need to determine what mode to do the shift in. If the shift is - a right shift or ROTATE, we must always do it in the mode it was - originally done in. Otherwise, we can do it in MODE, the widest mode - encountered. The code we care about is that of the shift that will - actually be done, not the shift that was originally requested. */ - shift_mode - = (code == ASHIFTRT || code == LSHIFTRT || code == ROTATE - ? result_mode : mode); + shift_mode = try_widen_shift_mode (code, varop, result_mode, mode); /* We have now finished analyzing the shift. The result should be a shift of type CODE with SHIFT_MODE shifting VAROP COUNT places. If -- cgit v1.2.1 From be26a489c8236e12a8e37277e33854e002814f83 Mon Sep 17 00:00:00 2001 From: nemet Date: Sat, 18 Jul 2009 21:48:19 +0000 Subject: * combine.c (try_widen_shift_mode) : Allow widening if the high-order bits are zero. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149779 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index a0157df7140..12f0ed8223f 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -9005,8 +9005,15 @@ try_widen_shift_mode (enum rtx_code code, rtx op, > (unsigned) (GET_MODE_BITSIZE (mode) - GET_MODE_BITSIZE (orig_mode))) return mode; - /* fall through */ + return orig_mode; + case LSHIFTRT: + /* Similarly here but with zero bits. */ + if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT + && (nonzero_bits (op, mode) & ~GET_MODE_MASK (orig_mode)) == 0) + return mode; + /* fall through */ + case ROTATE: return orig_mode; -- cgit v1.2.1 From 4e0ce2fb023ffff84834a540673e63bcb1e40998 Mon Sep 17 00:00:00 2001 From: nemet Date: Sat, 18 Jul 2009 21:52:48 +0000 Subject: * combine.c (try_widen_shift_mode): Add COUNT, OUTER_CODE and OUTER_CONST arguments. : Use them to allow widening if the bits shifted in from the new wider mode will be masked off. (simplify_shift_const_1): Adjust calls to try_widen_shift_mode. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149780 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 12f0ed8223f..39daf2881d4 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -8985,11 +8985,14 @@ merge_outer_ops (enum rtx_code *pop0, HOST_WIDE_INT *pconst0, enum rtx_code op1, /* A helper to simplify_shift_const_1 to determine the mode we can perform the shift in. The original shift operation CODE is performed on OP in ORIG_MODE. Return the wider mode MODE if we can perform the operation - in that mode. Return ORIG_MODE otherwise. */ + in that mode. Return ORIG_MODE otherwise. We can also assume that the + result of the shift is subject to operation OUTER_CODE with operand + OUTER_CONST. */ static enum machine_mode -try_widen_shift_mode (enum rtx_code code, rtx op, - enum machine_mode orig_mode, enum machine_mode mode) +try_widen_shift_mode (enum rtx_code code, rtx op, int count, + enum machine_mode orig_mode, enum machine_mode mode, + enum rtx_code outer_code, HOST_WIDE_INT outer_const) { if (orig_mode == mode) return mode; @@ -9012,6 +9015,21 @@ try_widen_shift_mode (enum rtx_code code, rtx op, if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT && (nonzero_bits (op, mode) & ~GET_MODE_MASK (orig_mode)) == 0) return mode; + + /* We can also widen if the bits brought in will be masked off. This + operation is performed in ORIG_MODE. */ + if (outer_code == AND + && GET_MODE_BITSIZE (orig_mode) <= HOST_BITS_PER_WIDE_INT) + { + int care_bits; + + outer_const &= GET_MODE_MASK (orig_mode); + care_bits = exact_log2 (outer_const + 1); + + if (care_bits >= 0 + && GET_MODE_BITSIZE (orig_mode) - care_bits >= count) + return mode; + } /* fall through */ case ROTATE: @@ -9084,7 +9102,8 @@ simplify_shift_const_1 (enum rtx_code code, enum machine_mode result_mode, count = bitsize - count; } - shift_mode = try_widen_shift_mode (code, varop, result_mode, mode); + shift_mode = try_widen_shift_mode (code, varop, count, result_mode, + mode, outer_op, outer_const); /* Handle cases where the count is greater than the size of the mode minus 1. For ASHIFT, use the size minus one as the count (this can @@ -9682,7 +9701,8 @@ simplify_shift_const_1 (enum rtx_code code, enum machine_mode result_mode, break; } - shift_mode = try_widen_shift_mode (code, varop, result_mode, mode); + shift_mode = try_widen_shift_mode (code, varop, count, result_mode, mode, + outer_op, outer_const); /* We have now finished analyzing the shift. The result should be a shift of type CODE with SHIFT_MODE shifting VAROP COUNT places. If -- cgit v1.2.1 From dce31f4655bb5e9e592c8d925850f28b089c5c74 Mon Sep 17 00:00:00 2001 From: nemet Date: Sat, 18 Jul 2009 21:55:40 +0000 Subject: * combine.c (make_compound_operation) : If force_to_mode re-expanded the compound use gen_lowpart instead to convert to the desired mode. testsuite/ * gcc.target/mips/ext-2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149781 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 39daf2881d4..3f39bc3b286 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -7061,6 +7061,12 @@ make_compound_operation (rtx x, enum rtx_code in_code) if (GET_CODE (newer) != SUBREG) newer = make_compound_operation (newer, in_code); + /* force_to_mode can expand compounds. If it just re-expanded the + compound use gen_lowpart instead to convert to the desired + mode. */ + if (rtx_equal_p (newer, x)) + return gen_lowpart (GET_MODE (x), tem); + return newer; } -- cgit v1.2.1 From 3b2411a88d1a0a07e7c93da834ec7719792d351f Mon Sep 17 00:00:00 2001 From: bonzini Date: Sat, 1 Aug 2009 22:03:34 +0000 Subject: 2009-04-17 Paolo Bonzini * expr.c (store_constructor): Use promote_decl_mode. Remove now write-only variable unsignedp. (expand_expr_real_1): Use promote_decl_mode. * expr.h (promote_function_mode, promote_decl_mode): New. (promote_mode): Remove last argument. * function.c (assign_temp): Drop last argument of promote_mode. (assign_parm_find_data_types): Use promote_function_mode. (assign_parm_setup_reg): Likewise. (expand_function_end): Use promote_function_mode. * calls.c (initialize_argument_information): Use promote_function_mode. (precompute_arguments): Use promote_mode instead of checking if only PROMOTE_FUNCTION_MODE is defined. (expand_call): When making sibcall decisions, use promote_function_mode. Below, remove an if for targetm.calls.promote_function_return and and use promote_function_mode. (emit_library_call_value_1): Use promote_function_mode, fix bug where promote_mode was passed FOR_CALL == 0 for a return value in an assertion. * cfgexpand.c (expand_one_register_var): Use promote_decl_mode. * explow.c (promote_function_mode, promote_decl_mode): New. (promote_mode): Keep only the FOR_CALL == 0 case. * combine.c (setup_incoming_promotion): Remove test of promote_function_args. Use promote_function_mode. * stmt.c (expand_value_return): Use promote_decl_mode. (expand_decl): Use promote_decl_mode. * expr.c (store_constructor): Use promote_decl_mode. Remove now write-only variable unsignedp. (expand_expr_real_1): Use promote_decl_mode. * expr.h (promote_function_mode, promote_decl_mode): New. (promote_mode): Remove last argument. * function.c (assign_temp): Drop last argument of promote_mode. (assign_parm_find_data_types): Use promote_function_mode. (assign_parm_setup_reg): Likewise. (expand_function_end): Use promote_function_mode. * calls.c (initialize_argument_information): Use promote_function_mode. (precompute_arguments): Use promote_mode instead of checking if only PROMOTE_FUNCTION_MODE is defined. (expand_call): When making sibcall decisions, use promote_function_mode. Below, remove an if for targetm.calls.promote_function_return and and use promote_function_mode. (emit_library_call_value_1): Use promote_function_mode, fix bug where promote_mode was passed FOR_CALL == 0 for a return value in an assertion. * cfgexpand.c (expand_one_register_var): Use promote_decl_mode. * explow.c (promote_function_mode, promote_decl_mode): New. (promote_mode): Keep only the FOR_CALL == 0 case. * combine.c (setup_incoming_promotion): Remove test of promote_function_args. Use promote_function_mode. * stmt.c (expand_value_return): Use promote_decl_mode. (expand_decl): Use promote_decl_mode. * explow.c (promote_function_mode): Just call the target hook. * targhooks.c (default_promote_function_mode, default_promote_function_mode_always_promote): New. * targhooks.h (default_promote_function_mode, default_promote_function_mode_always_promote): Declare. * target.h (promote_function_args, promote_function_return): Remove. (promote_function_mode): New. * target-def.h (TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN): Remove. (TARGET_PROMOTE_FUNCTION_MODE): New. (TARGET_CALLS): Adjust. * system.h (TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN, PROMOTE_FUNCTION_MODE): Poison. * config/s390/s390.h (PROMOTE_FUNCTION_MODE): Move... * config/s390/s390.c (s390_promote_function_mode): ... here, with pointer handling. (TARGET_PROMOTE_FUNCTION_MODE): Define. (TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN): Remove. * config/sparc/sparc.h (PROMOTE_FUNCTION_MODE): Move... * config/sparc/sparc.c (sparc_promote_function_mode): ... here, with pointer handling. (TARGET_PROMOTE_FUNCTION_MODE): Define. (TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN): Remove. * config/sh/sh-protos.h (sh_promote_function_mode): New. * config/sh/sh.c (sh_promote_function_mode): New. (TARGET_PROMOTE_FUNCTION_MODE): Define. (TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN): Remove. * config/cris/cris.h (PROMOTE_FUNCTION_MODE): Move... * config/cris/cris.c (cris_promote_function_mode): ... here. (TARGET_PROMOTE_FUNCTION_MODE): Define. (TARGET_PROMOTE_FUNCTION_ARGS): Remove. * config/mmix/mmix.h (PROMOTE_FUNCTION_MODE): Move... * config/mmix/mmix.c (mmix_promote_function_mode): ... here. (TARGET_PROMOTE_FUNCTION_MODE): Define. (TARGET_PROMOTE_FUNCTION_ARGS): Remove. * config/arm/arm.h (PROMOTE_FUNCTION_MODE): Move... * config/arm/arm.c (arm_promote_function_mode): ... here, without complex type handling. (TARGET_PROMOTE_FUNCTION_MODE): Define. (TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN): Remove. * config/pa/pa.c (pa_promote_function_mode): New. (TARGET_PROMOTE_FUNCTION_MODE): Define. (TARGET_PROMOTE_FUNCTION_RETURN): Remove. * config/alpha/alpha.c (TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN): Remove. (TARGET_PROMOTE_FUNCTION_MODE): Define equivalently. * config/xtensa/xtensa.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/picochip/picochip.c: Likewise. * config/arc/arc.c: Likewise. * config/mcore/mcore.c: Likewise. * config/score/score.c: Likewise. * config/mips/mips.c: Likewise. * config/bfin/bfin.c: Likewise. * config/ia64/ia64.c: Likewise (disabled though). * config/frv/frv.h: Remove pointless remark. * doc/tm.texi (PROMOTE_FUNCTION_MODE, TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN): Consolidate into... (TARGET_PROMOTE_FUNCTION_MODE): ... this. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150336 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 3f39bc3b286..6a0e6ec5c93 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -1333,9 +1333,6 @@ setup_incoming_promotions (rtx first) tree arg; bool strictly_local = false; - if (!targetm.calls.promote_function_args (TREE_TYPE (cfun->decl))) - return; - for (arg = DECL_ARGUMENTS (current_function_decl); arg; arg = TREE_CHAIN (arg)) { @@ -1365,7 +1362,8 @@ setup_incoming_promotions (rtx first) /* The mode and signedness of the argument as it is actually passed, after any TARGET_PROMOTE_FUNCTION_ARGS-driven ABI promotions. */ - mode3 = promote_mode (DECL_ARG_TYPE (arg), mode2, &uns3, 1); + mode3 = promote_function_mode (DECL_ARG_TYPE (arg), mode2, &uns3, + TREE_TYPE (cfun->decl), 0); /* The mode of the register in which the argument is being passed. */ mode4 = GET_MODE (reg); -- cgit v1.2.1 From ef9384f3e0317cc7938526c93237a39df6767e0b Mon Sep 17 00:00:00 2001 From: rsandifo Date: Sat, 8 Aug 2009 08:32:24 +0000 Subject: gcc/ * combine.c (gen_lowpart_or_truncate): Exclude CONST_INTs from mode check. Do truncations in an integer mode. (force_to_mode): Handle subregs for all mode types. Only do arithmetic simplifications on integer modes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150578 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 51 ++++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 6a0e6ec5c93..3a2c41205e5 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -7243,13 +7243,20 @@ canon_reg_for_combine (rtx x, rtx reg) static rtx gen_lowpart_or_truncate (enum machine_mode mode, rtx x) { - if (GET_MODE_SIZE (GET_MODE (x)) <= GET_MODE_SIZE (mode) - || TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode), - GET_MODE_BITSIZE (GET_MODE (x))) - || (REG_P (x) && reg_truncated_to_mode (mode, x))) - return gen_lowpart (mode, x); - else - return simplify_gen_unary (TRUNCATE, mode, x, GET_MODE (x)); + if (!CONST_INT_P (x) + && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (x)) + && !TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (mode), + GET_MODE_BITSIZE (GET_MODE (x))) + && !(REG_P (x) && reg_truncated_to_mode (mode, x))) + { + /* Bit-cast X into an integer mode. */ + if (!SCALAR_INT_MODE_P (GET_MODE (x))) + x = gen_lowpart (int_mode_for_mode (GET_MODE (x)), x); + x = simplify_gen_unary (TRUNCATE, int_mode_for_mode (mode), + x, GET_MODE (x)); + } + + return gen_lowpart (mode, x); } /* See if X can be simplified knowing that we will only refer to it in @@ -7336,9 +7343,20 @@ force_to_mode (rtx x, enum machine_mode mode, unsigned HOST_WIDE_INT mask, && (GET_MODE_MASK (GET_MODE (x)) & ~mask) == 0) return gen_lowpart (mode, x); - /* The arithmetic simplifications here do the wrong thing on vector modes. */ - if (VECTOR_MODE_P (mode) || VECTOR_MODE_P (GET_MODE (x))) - return gen_lowpart (mode, x); + /* We can ignore the effect of a SUBREG if it narrows the mode or + if the constant masks to zero all the bits the mode doesn't have. */ + if (GET_CODE (x) == SUBREG + && subreg_lowpart_p (x) + && ((GET_MODE_SIZE (GET_MODE (x)) + < GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))) + || (0 == (mask + & GET_MODE_MASK (GET_MODE (x)) + & ~GET_MODE_MASK (GET_MODE (SUBREG_REG (x))))))) + return force_to_mode (SUBREG_REG (x), mode, mask, next_select); + + /* The arithmetic simplifications here only work for scalar integer modes. */ + if (!SCALAR_INT_MODE_P (mode) || !SCALAR_INT_MODE_P (GET_MODE (x))) + return gen_lowpart_or_truncate (mode, x); switch (code) { @@ -7356,19 +7374,6 @@ force_to_mode (rtx x, enum machine_mode mode, unsigned HOST_WIDE_INT mask, return force_to_mode (x, mode, mask, next_select); break; - case SUBREG: - if (subreg_lowpart_p (x) - /* We can ignore the effect of this SUBREG if it narrows the mode or - if the constant masks to zero all the bits the mode doesn't - have. */ - && ((GET_MODE_SIZE (GET_MODE (x)) - < GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))) - || (0 == (mask - & GET_MODE_MASK (GET_MODE (x)) - & ~GET_MODE_MASK (GET_MODE (SUBREG_REG (x))))))) - return force_to_mode (SUBREG_REG (x), mode, mask, next_select); - break; - case TRUNCATE: /* Similarly for a truncate. */ return force_to_mode (XEXP (x, 0), mode, mask, next_select); -- cgit v1.2.1 From d16b48d51064e73ea2141a4eaec1c56c3a6c307c Mon Sep 17 00:00:00 2001 From: nemet Date: Tue, 11 Aug 2009 17:31:09 +0000 Subject: * combine.c (try_widen_shift_mode): Factor out code to check if an integer constant is a low-order bitmask from here ... * rtlanal.c (low_bitmask_len): ... to here. * rtl.h (low_bitmask_len): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150656 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 3a2c41205e5..faa7e0dc038 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -9027,13 +9027,9 @@ try_widen_shift_mode (enum rtx_code code, rtx op, int count, /* We can also widen if the bits brought in will be masked off. This operation is performed in ORIG_MODE. */ - if (outer_code == AND - && GET_MODE_BITSIZE (orig_mode) <= HOST_BITS_PER_WIDE_INT) + if (outer_code == AND) { - int care_bits; - - outer_const &= GET_MODE_MASK (orig_mode); - care_bits = exact_log2 (outer_const + 1); + int care_bits = low_bitmask_len (orig_mode, outer_const); if (care_bits >= 0 && GET_MODE_BITSIZE (orig_mode) - care_bits >= count) -- cgit v1.2.1 From 9845d1202fec65574ca05d780859eb8c25489566 Mon Sep 17 00:00:00 2001 From: aoliva Date: Wed, 2 Sep 2009 02:42:21 +0000 Subject: gcc/ChangeLog: * doc/invoke.texi (-fvar-tracking-assignments): New. (-fvar-tracking-assignments-toggle): New. (-fdump-final-insns=file): Mark filename as optional. (--param min-nondebug-insn-uid): New. (-gdwarf-@{version}): Mention version 4. * opts.c (common_handle_option): Accept it. * tree-vrp.c (find_assert_locations_1): Skip debug stmts. * regrename.c (regrename_optimize): Drop last. Don't count debug insns as uses. Don't reject change because of debug insn. (do_replace): Reject DEBUG_INSN as chain starter. Take base_regno from the chain starter, and check for inexact matches in DEBUG_INSNS. (scan_rtx_reg): Accept inexact matches in DEBUG_INSNs. (build_def_use): Simplify and fix the marking of DEBUG_INSNs. * sched-ebb.c (schedule_ebbs): Skip boundary debug insns. * fwprop.c (forward_propagate_and_simplify): ...into debug insns. * doc/gimple.texi (is_gimple_debug): New. (gimple_debug_bind_p): New. (is_gimple_call, gimple_assign_cast_p): End sentence with period. * doc/install.texi (bootstrap-debug): More details. (bootstrap-debug-big, bootstrap-debug-lean): Document. (bootstrap-debug-lib): More details. (bootstrap-debug-ckovw): Update. (bootstrap-time): New. * tree-into-ssa.c (mark_def_sites): Skip debug stmts. (insert_phi_nodes_for): Insert debug stmts. (rewrite_stmt): Take iterator. Insert debug stmts. (rewrite_enter_block): Adjust. (maybe_replace_use_in_debug_stmt): New. (rewrite_update_stmt): Use it. (mark_use_interesting): Return early for debug stmts. * tree-ssa-loop-im.c (rewrite_bittest): Propagate DEFs into debug stmts before replacing stmt. (move_computations_stmt): Likewise. * ira-conflicts.c (add_copies): Skip debug insns. * regstat.c (regstat_init_n_sets_and_refs): Discount debug insns. (regstat_bb_compute_ri): Skip debug insns. * tree-ssa-threadupdate.c (redirection_block_p): Skip debug stmts. * tree-ssa-loop-manip.c (find_uses_to_rename_stmt, check_loop_closed_ssa_stmt): Skip debug stmts. * tree-tailcall.c (find_tail_calls): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Likewise. * tree.h (MAY_HAVE_DEBUG_STMTS): New. (build_var_debug_value_stat): Declare. (build_var_debug_value): Define. (target_for_debug_bind): Declare. * reload.c (find_equiv_reg): Skip debug insns. * rtlanal.c (reg_used_between_p): Skip debug insns. (side_effects_p): Likewise. (canonicalize_condition): Likewise. * ddg.c (create_ddg_dep_from_intra_loop_link): Check that non-debug insns never depend on debug insns. (create_ddg_dep_no_link): Likewise. (add_cross_iteration_register_deps): Use ANTI_DEP for debug insns. Don't add inter-loop dependencies for debug insns. (build_intra_loop_deps): Likewise. (create_ddg): Count debug insns. * ddg.h (struct ddg::num_debug): New. (num_backargs): Pair up with previous int field. * diagnostic.c (diagnostic_report_diagnostic): Skip notes on -fcompare-debug-second. * final.c (get_attr_length_1): Skip debug insns. (rest_of_clean-state): Don't dump CFA_RESTORE_STATE. * gcc.c (invoke_as): Call compare-debug-dump-opt. (driver_self_specs): Map -fdump-final-insns to -fdump-final-insns=.. (get_local_tick): New. (compare_debug_dump_opt_spec_function): Test for . argument and compute output name. Compute temp output spec without flag name. Compute -frandom-seed. (OPT): Undef after use. * cfgloopanal.c (num_loop_insns): Skip debug insns. (average_num_loop_insns): Likewise. * params.h (MIN_NONDEBUG_INSN_UID): New. * gimple.def (GIMPLE_DEBUG): New. * ipa-reference.c (scan_stmt_for_static_refs): Skip debug stmts. * auto-inc-dec.c (merge_in_block): Skip debug insns. (merge_in_block): Fix whitespace. * toplev.c (flag_var_tracking): Update comment. (flag_var_tracking_assignments): New. (flag_var_tracking_assignments_toggle): New. (process_options): Don't open final insns dump file if we're not going to write to it. Compute defaults for var_tracking. * df-scan.c (df_insn_rescan_debug_internal): New. (df_uses_record): Handle debug insns. * haifa-sched.c (ready): Initialize n_debug. (contributes_to_priority): Skip debug insns. (dep_list_size): New. (priority): Use it. (rank_for_schedule): Likewise. Schedule debug insns as soon as they're ready. Disregard previous debug insns to make decisions. (queue_insn): Never queue debug insns. (ready_add, ready_remove_first, ready_remove): Count debug insns. (schedule_insn): Don't reject debug insns because of issue rate. (get_ebb_head_tail, no_real_insns_p): Skip boundary debug insns. (queue_to_ready): Skip and discount debug insns. (choose_ready): Let debug insns through. (schedule_block): Check boundary debug insns. Discount debug insns, schedule them early. Adjust whitespace. (set_priorities): Check for boundary debug insns. (add_jump_dependencies): Use dep_list_size. (prev_non_location_insn): New. (check_cfg): Use it. * tree-ssa-loop-ivopts.c (find-interesting_users): Skip debug stmts. (remove_unused_ivs): Reset debug stmts. * modulo-sched.c (const_iteration_count): Skip debug insns. (res_MII): Discount debug insns. (loop_single_full_bb_p): Skip debug insns. (sms_schedule): Likewise. (sms_schedule_by_order): Likewise. (ps_has_conflicts): Likewise. * caller-save.c (refmarker_fn): New. (save_call_clobbered_regs): Replace regs with saved mem in debug insns. (mark_referenced_regs): Take pointer, mark and arg. Adjust. Call refmarker_fn mark for hardregnos. (mark_reg_as_referenced): New. (replace_reg_with_saved_mem): New. * ipa-pure-const.c (check_stmt): Skip debug stmts. * cse.c (cse_insn): Canonicalize debug insns. Skip them when searching back. (cse_extended_basic_block): Skip debug insns. (count_reg_usage): Likewise. (is_dead_reg): New, split out of... (set_live_p): ... here. (insn_live_p): Use it for debug insns. * tree-stdarg.c (check_all_va_list_escapes): Skip debug stmts. (execute_optimize_stdarg): Likewise. * tree-ssa-dom.c (propagate_rhs_into_lhs): Likewise. * tree-ssa-propagate.c (substitute_and_fold): Don't regard changes in debug stmts as changes. * sel-sched.c (moving_insn_creates_bookkeeping_block_p): New. (moveup_expr): Don't move across debug insns. Don't move debug insn if it would create a bookkeeping block. (moveup_expr_cached): Don't use cache for debug insns that are heads of blocks. (compute_av_set_inside_bb): Skip debug insns. (sel_rank_for_schedule): Schedule debug insns first. Remove dead code. (block_valid_for_bookkeeping_p); Support lax searches. (create_block_for_bookkeeping): Adjust block numbers when encountering debug-only blocks. (find_place_for_bookkeeping): Deal with debug-only blocks. (generate_bookkeeping_insn): Accept no place to insert. (remove_temp_moveop_nops): New argument full_tidying. (prepare_place_to_insert): Deal with debug insns. (advance_state_on_fence): Debug insns don't start cycles. (update_boundaries): Take fence as argument. Deal with debug insns. (schedule_expr_on_boundary): No full_tidying on debug insns. (fill_insns): Deal with debug insns. (track_scheduled_insns_and_blocks): Don't count debug insns. (need_nop_to_preserve_insn_bb): New, split out of... (remove_insn_from_stream): ... this. (fur_orig_expr_not_found): Skip debug insns. * rtl.def (VALUE): Move up. (DEBUG_INSN): New. * tree-ssa-sink.c (all_immediate_uses_same_place): Skip debug stmts. (nearest_common_dominator_of_uses): Take debug_stmts argument. Set it if debug stmts are found. (statement_sink_location): Skip debug stmts. Propagate moving defs into debug stmts. * ifcvt.c (first_active_insn): Skip debug insns. (last_active_insns): Likewise. (cond_exec_process_insns): Likewise. (noce_process_if_block): Likewise. (check_cond_move_block): Likewise. (cond_move_convert_if_block): Likewise. (block_jumps_and_fallthru_p): Likewise. (dead_or_predicable): Likewise. * dwarf2out.c (debug_str_hash_forced): New. (find_AT_string): Add comment. (gen_label_for_indirect_string): New. (get_debug_string_label): New. (AT_string_form): Use it. (mem_loc_descriptor): Handle non-TLS symbols. Handle MINUS , DIV, MOD, AND, IOR, XOR, NOT, ABS, NEG, and CONST_STRING. Accept but discard COMPARE, IF_THEN_ELSE, ROTATE, ROTATERT, TRUNCATE and several operations that cannot be represented with DWARF opcodes. (loc_descriptor): Ignore SIGN_EXTEND and ZERO_EXTEND. Require dwarf_version 4 for DW_OP_implicit_value and DW_OP_stack_value. (dwarf2out_var_location): Take during-call mark into account. (output_indirect_string): Update comment. Output if there are label and references. (prune_indirect_string): New. (prune_unused_types): Call it if debug_str_hash_forced. More in dwarf2out.c, from Jakub Jelinek : (dw_long_long_const): Remove. (struct dw_val_struct): Change val_long_long type to rtx. (print_die, attr_checksum, same_dw_val_p, loc_descriptor): Adjust for val_long_long change to CONST_DOUBLE rtx from a long hi/lo pair. (output_die): Likewise. Use HOST_BITS_PER_WIDE_INT size of each component instead of HOST_BITS_PER_LONG. (output_loc_operands): Likewise. For const8* assert HOST_BITS_PER_WIDE_INT rather than HOST_BITS_PER_LONG is >= 64. (output_loc_operands_raw): For const8* assert HOST_BITS_PER_WIDE_INT rather than HOST_BITS_PER_LONG is >= 64. (add_AT_long_long): Remove val_hi and val_lo arguments, add val_const_double. (size_of_die): Use HOST_BITS_PER_WIDE_INT size multiplier instead of HOST_BITS_PER_LONG for dw_val_class_long_long. (add_const_value_attribute): Adjust add_AT_long_long caller. Don't handle TLS SYMBOL_REFs. If CONST wraps a constant, tail recurse. (dwarf_stack_op_name): Handle DW_OP_implicit_value and DW_OP_stack_value. (size_of_loc_descr, output_loc_operands, output_loc_operands_raw): Handle DW_OP_implicit_value. (extract_int): Move prototype earlier. (mem_loc_descriptor): For SUBREG punt if inner mode size is wider than DWARF2_ADDR_SIZE. Handle SIGN_EXTEND and ZERO_EXTEND by DW_OP_shl and DW_OP_shr{a,}. Handle EQ, NE, GT, GE, LT, LE, GTU, GEU, LTU, LEU, SMIN, SMAX, UMIN, UMAX, SIGN_EXTRACT, ZERO_EXTRACT. (loc_descriptor): Compare mode size with DWARF2_ADDR_SIZE instead of Pmode size. (loc_descriptor): Add MODE argument. Handle CONST_INT, CONST_DOUBLE, CONST_VECTOR, CONST, LABEL_REF and SYMBOL_REF if mode != VOIDmode, attempt to handle other expressions. Don't handle TLS SYMBOL_REFs. (concat_loc_descriptor, concatn_loc_descriptor, loc_descriptor_from_tree_1): Adjust loc_descriptor callers. (add_location_or_const_value_attribute): Likewise. For single location loc_lists attempt to use add_const_value_attribute for constant decls. Add DW_AT_const_value even if NOTE_VAR_LOCATION is VAR_LOCATION with CONSTANT_P or CONST_STRING in its expression. * cfgbuild.c (inside_basic_block_p): Handle debug insns. (control_flow_insn_p): Likewise. * tree-parloops.c (eliminate_local_variables_stmt): Handle debug stmt. (separate_decls_in_region_debug_bind): New. (separate_decls_in_region): Process debug bind stmts afterwards. * recog.c (verify_changes): Handle debug insns. (extract_insn): Likewise. (peephole2_optimize): Skip debug insns. * dse.c (scan_insn): Skip debug insns. * sel-sched-ir.c (return_nop_to_pool): Take full_tidying argument. Pass it on. (setup_id_for_insn): Handle debug insns. (maybe_tidy_empty_bb): Adjust whitespace. (tidy_control_flow): Skip debug insns. (sel_remove_insn): Adjust for debug insns. (sel_estimate_number_of_insns): Skip debug insns. (create_insn_rtx_from_pattern): Handle debug insns. (create_copy_of_insn_rtx): Likewise. * sel-sched-.h (sel_bb_end): Declare. (sel_bb_empty_or_nop_p): New. (get_all_loop_exits): Use it. (_eligible_successor_edge_p): Likewise. (return_nop_to_pool): Adjust. * tree-eh.c (tre_empty_eh_handler_p): Skip debug stmts. * ira-lives.c (process_bb_node_lives): Skip debug insns. * gimple-pretty-print.c (dump_gimple_debug): New. (dump_gimple_stmt): Use it. (dump_bb_header): Skip gimple debug stmts. * regmove.c (optimize_reg_copy_1): Discount debug insns. (fixup_match_2): Likewise. (regmove_backward_pass): Likewise. Simplify combined replacement. Handle debug insns. * function.c (instantiate_virtual_regs): Handle debug insns. * function.h (struct emit_status): Add x_cur_debug_insn_uid. * print-rtl.h: Include cselib.h. (print_rtx): Print VALUEs. Split out and recurse for VAR_LOCATIONs. * df.h (df_inns_rescan_debug_internal): Declare. * gcse.c (alloc_hash_table): Estimate n_insns. (cprop_insn): Don't regard debug insns as changes. (bypass_conditional_jumps): Skip debug insns. (one_pre_gcse_pass): Adjust. (one_code_hoisting_pass): Likewise. (compute_ld_motion_mems): Skip debug insns. (one_cprop_pass): Adjust. * tree-if-conv.c (tree_if_convert_stmt): Reset debug stmts. (if_convertible_stmt_p): Handle debug stmts. * init-regs.c (initialize_uninitialized_regs): Skip debug insns. * tree-vect-loop.c (vect_is_simple_reduction): Skip debug stmts. * ira-build.c (create_bb_allocnos): Skip debug insns. * tree-flow-inline.h (has_zero_uses): Discount debug stmts. (has_single_use): Likewise. (single_imm_use): Likewise. (num_imm_uses): Likewise. * tree-ssa-phiopt.c (empty_block_p): Skip debug stmts. * tree-ssa-coalesce.c (build_ssa_conflict_graph): Skip debug stmts. (create_outofssa_var_map): Likewise. * lower-subreg.c (adjust_decomposed_uses): New. (resolve_debug): New. (decompose_multiword_subregs): Use it. * tree-dfa.c (find_referenced_vars): Skip debug stmts. * emit-rtl.c: Include params.h. (cur_debug_insn_uid): Define. (set_new_first_and_last_insn): Set cur_debug_insn_uid too. (copy_rtx_if_shared_1): Handle debug insns. (reset_used_flags): Likewise. (set_used_flags): LIkewise. (get_max_insn_count): New. (next_nondebug_insn): New. (prev_nondebug_insn): New. (make_debug_insn_raw): New. (emit_insn_before_noloc): Handle debug insns. (emit_jump_insn_before_noloc): Likewise. (emit_call_insn_before_noloc): Likewise. (emit_debug_insn_before_noloc): New. (emit_insn_after_noloc): Handle debug insns. (emit_jump_insn_after_noloc): Likewise. (emit_call_insn_after_noloc): Likewise. (emit_debug_insn_after_noloc): Likewise. (emit_insn_after): Take loc from earlier non-debug insn. (emit_jump_insn_after): Likewise. (emit_call_insn_after): Likewise. (emit_debug_insn_after_setloc): New. (emit_debug_insn_after): New. (emit_insn_before): Take loc from later non-debug insn. (emit_jump_insn_before): Likewise. (emit_call_insn_before): Likewise. (emit_debug_insn_before_setloc): New. (emit_debug_insn_before): New. (emit_insn): Handle debug insns. (emit_debug_insn): New. (emit_jump_insn): Handle debug insns. (emit_call_insn): Likewise. (emit): Likewise. (init_emit): Take min-nondebug-insn-uid into account. Initialize cur_debug_insn_uid. (emit_copy_of_insn_after): Handle debug insns. * cfgexpand.c (gimple_assign_rhs_to_tree): Do not overwrite location of single rhs in place. (maybe_dump_rtl_for_gimple_stmt): Dump lineno. (floor_sdiv_adjust): New. (cell_sdiv_adjust): New. (cell_udiv_adjust): New. (round_sdiv_adjust): New. (round_udiv_adjust): New. (wrap_constant): Moved from cselib. (unwrap_constant): New. (expand_debug_expr): New. (expand_debug_locations): New. (expand_gimple_basic_block): Drop hiding redeclaration. Expand debug bind stmts. (gimple_expand_cfg): Expand debug locations. * cselib.c: Include tree-pass.h. (struct expand_value_data): New. (cselib_record_sets_hook): New. (PRESERVED_VALUE_P, LONG_TERM_PRESERVED_VALUE_P): New. (cselib_clear_table): Move, and implemnet in terms of... (cselib_reset_table_with_next_value): ... this. (cselib_get_next_unknown_value): New. (discard_useless_locs): Don't discard preserved values. (cselib_preserve_value): New. (cselib_preserved_value_p): New. (cselib_preserve_definitely): New. (cselib_clear_preserve): New. (cselib_preserve_only_values): New. (new_cselib_val): Take rtx argument. Dump it in details. (cselib_lookup_mem): Adjust. (expand_loc): Take regs_active in struct. Adjust. Silence dumps unless details are requested. (cselib_expand_value_rtx_cb): New. (cselib_expand_value_rtx): Rename and reimplment in terms of... (cselib_expand_value_rtx_1): ... this. Adjust. Silence dumps without details. Copy more subregs. Try to resolve values using a callback. Wrap constants. (cselib_subst_to_values): Adjust. (cselib_log_lookup): New. (cselib_lookup): Call it. (cselib_invalidate_regno): Don't count preserved values as useless. (cselib_invalidate_mem): Likewise. (cselib_record_set): Likewise. (struct set): Renamed to cselib_set, moved to cselib.h. (cselib_record_sets): Adjust. Call hook. (cselib_process_insn): Reset table when it would be cleared. (dump_cselib_val): New. (dump_cselib_table): New. * tree-cfgcleanup.c (tree_forwarded_block_p): Skip debug stmts. (remove_forwarder_block): Support moving debug stmts. * cselib.h (cselib_record_sets_hook): Declare. (cselib_expand_callback): New type. (cselib_expand_value_rtx_cb): Declare. (cselib_reset_table_with_next_value): Declare. (cselib_get_next_unknown_value): Declare. (cselib_preserve_value): Declare. (cselib_preserved_value_p): Declare. (cselib_preserve_only_values): Declare. (dump_cselib_table): Declare. * cfgcleanup.c (flow_find_cross_jump): Skip debug insns. (try_crossjump_to_edge): Likewise. (delete_unreachable_blocks): Remove dominant GIMPLE blocks after dominated blocks when debug stmts are present. * simplify-rtx.c (delegitimize_mem_from_attrs): New. * tree-ssa-live.c (remove_unused_locals): Skip debug stmts. (set_var_live_on_entry): Likewise. * loop-invariant.c (find_invariants_bb): Skip debug insns. * cfglayout.c (curr_location, last_location): Make static. (set_curr_insn_source_location): Don't avoid bouncing. (get_curr_insn_source_location): New. (get_curr_insn_block): New. (duplicate_insn_chain): Handle debug insns. * tree-ssa-forwprop.c (forward_propagate_addr_expr): Propagate into debug stmts. * common.opt (fcompare-debug): Move to sort order. (fdump-unnumbered-links): Likewise. (fvar-tracking-assignments): New. (fvar-tracking-assignments-toggle): New. * tree-ssa-dce.c (mark_stmt_necessary): Don't mark blocks because of debug stmts. (mark_stmt_if_obviously_necessary): Mark debug stmts. (eliminate_unnecessary_stmts): Walk dominated blocks before dominators. * tree-ssa-ter.c (find_replaceable_in_bb): Skip debug stmts. * ira.c (memref_used_between_p): Skip debug insns. (update_equiv_regs): Likewise. * sched-deps.c (sd_lists_size): Accept empty list. (sd_init_insn): Mark debug insns. (sd_finish_insn): Unmark them. (sd_add_dep): Reject non-debug deps on debug insns. (fixup_sched_groups): Give debug insns group treatment. Skip debug insns. (sched_analyze_reg): Don't mark debug insns for sched before call. (sched_analyze_2): Handle debug insns. (sched_analyze_insn): Compute next non-debug insn. Handle debug insns. (deps_analyze_insn): Handle debug insns. (deps_start_bb): Skip debug insns. (init_deps): Initialize last_debug_insn. * tree-ssa.c (target_for_debug_bind): New. (find_released_ssa_name): New. (propagate_var_def_into_debug_stmts): New. (propagate_defs_into_debug_stmts): New. (verify_ssa): Skip debug bind stmts without values. (warn_uninialized_vars): Skip debug stmts. * target-def.h (TARGET_DELEGITIMIZE_ADDRESS): Set default. * rtl.c (rtx_equal_p_cb): Handle VALUEs. (rtx_equal_p): Likewise. * ira-costs.c (scan_one_insn): Skip debug insns. (process_bb_node_for_hard_reg_moves): Likewise. * rtl.h (DEBUG_INSN_P): New. (NONDEBUG_INSN_P): New. (MAY_HAVE_DEBUG_INSNS): New. (INSN_P): Accept debug insns. (RTX_FRAME_RELATED_P): Likewise. (INSN_DELETED_P): Likewise (PAT_VAR_LOCATION_DECL): New. (PAT_VAR_LOCATION_LOC): New. (PAT_VAR_OCATION_STATUS): New. (NOTE_VAR_LOCATION_DECL): Reimplement. (NOTE_VAR_LOCATION_LOC): Likewise. (NOTE_VAR_LOCATION_STATUS): Likewise. (INSN_VAR_LOCATION): New. (INSN_VAR_LOCATION_DECL): New. (INSN_VAR_LOCATION_LOC): New. (INSN_VAR_LOCATION_STATUS): New. (gen_rtx_UNKNOWN_VAR_LOC): New. (VAR_LOC_UNKNOWN_P): New. (NOTE_DURING_CALL_P): New. (SCHED_GROUP_P): Accept debug insns. (emit_debug_insn_before): Declare. (emit_debug_insn_before_noloc): Declare. (emit_debug_insn_beore_setloc): Declare. (emit_debug_insn_after): Declare. (emit_debug_insn_after_noloc): Declare. (emit_debug_insn_after_setloc): Declare. (emit_debug_insn): Declare. (make_debug_insn_raw): Declare. (prev_nondebug_insn): Declare. (next_nondebug_insn): Declare. (delegitimize_mem_from_attrs): Declare. (get_max_insn_count): Declare. (wrap_constant): Declare. (unwrap_constant): Declare. (get_curr_insn_source_location): Declare. (get_curr_insn_block): Declare. * tree-inline.c (insert_debug_decl_map): New. (processing_debug_stmt): New. (remap_decl): Don't create new mappings in debug stmts. (remap_gimple_op_r): Don't add references in debug stmts. (copy_tree_body_r): Likewise. (remap_gimple_stmt): Handle debug bind stmts. (copy_bb): Skip debug stmts. (copy_edges_for_bb): Likewise. (copy_debug_stmt): New. (copy_debug_stmts): New. (copy_body): Copy debug stmts at the end. (insert_init_debug_bind): New. (insert_init_stmt): Take id. Skip and emit debug stmts. (setup_one_parameter): Remap variable earlier, register debug mapping. (estimate_num_insns): Skip debug stmts. (expand_call_inline): Preserve debug_map. (optimize_inline_calls): Check for no debug_stmts left-overs. (unsave_expr_now): Preserve debug_map. (copy_gimple_seq_and_replace_locals): Likewise. (tree_function_versioning): Check for no debug_stmts left-overs. Init and destroy debug_map as needed. Split edges unconditionally. (build_duplicate_type): Init and destroy debug_map as needed. * tree-inline.h: Include gimple.h instead of pointer-set.h. (struct copy_body_data): Add debug_stmts and debug_map. * sched-int.h (struct ready_list): Add n_debug. (struct deps): Add last_debug_insn. (DEBUG_INSN_SCHED_P): New. (BOUNDARY_DEBUG_INSN_P): New. (SCHEDULE_DEBUG_INSN_P): New. (sd_iterator_cond): Accept empty list. * combine.c (create_log_links): Skip debug insns. (combine_instructions): Likewise. (cleanup_auto_inc_dec): New. From Jakub Jelinek: Make sure the return value is always unshared. (struct rtx_subst_pair): New. (auto_adjust_pair): New. (propagate_for_debug_subst): New. (propagate_for_debug): New. (try_combine): Skip debug insns. Propagate removed defs into debug insns. (next_nonnote_nondebug_insn): New. (distribute_notes): Use it. Skip debug insns. (distribute_links): Skip debug insns. * tree-outof-ssa.c (set_location_for_edge): Likewise. * resource.c (mark_target_live_regs): Likewise. * var-tracking.c: Include cselib.h and target.h. (enum micro_operation_type): Add MO_VAL_USE, MO_VAL_LOC, and MO_VAL_SET. (micro_operation_type_name): New. (enum emit_note_where): Add EMIT_NOTE_AFTER_CALL_INSN. (struct micro_operation_def): Update comments. (decl_or_value): New type. Use instead of decls. (struct emit_note_data_def): Add vars. (struct attrs_def): Use decl_or_value. (struct variable_tracking_info_def): Add permp, flooded. (struct location_chain_def): Update comment. (struct variable_part_def): Use decl_or_value. (struct variable_def): Make var_part a variable length array. (valvar_pool): New. (scratch_regs): New. (cselib_hook_called): New. (dv_is_decl_p): New. (dv_is_value_p): New. (dv_as_decl): New. (dv_as_value): New. (dv_as_opaque): New. (dv_onepart_p): New. (dv_pool): New. (IS_DECL_CODE): New. (check_value_is_not_decl): New. (dv_from_decl): New. (dv_from_value): New. (dv_htab_hash): New. (variable_htab_hash): Use it. (variable_htab_eq): Support values. (variable_htab_free): Free from the right pool. (attrs_list_member, attrs_list_insert): Use decl_or_value. (attrs_list_union): Adjust. (attrs_list_mpdv_union): New. (tie_break_pointers): New. (canon_value_cmp): New. (unshare_variable): Return possibly-modified slot. (vars_copy_1): Adjust. (var_reg_decl_set): Adjust. Split out of... (var_reg_set): ... this. (get_init_value): Adjust. (var_reg_delete_and_set): Adjust. (var_reg_delete): Adjust. (var_regno_delete): Adjust. (var_mem_decl_set): Split out of... (var_mem_set): ... this. (var_mem_delete_and_set): Adjust. (var_mem_delete): Adjust. (val_store): New. (val_reset): New. (val_resolve): New. (variable_union): Adjust. Speed up merge of 1-part vars. (variable_canonicalize): Use unshared slot. (VALUED_RECURSED_INTO): New. (find_loc_in_1pdv): New. (struct dfset_merge): New. (insert_into_intersection): New. (intersect_loc_chains): New. (loc_cmp): New. (canonicalize_loc_order_check): New. (canonicalize_values_mark): New. (canonicalize_values_star): New. (variable_merge_over_cur): New. (variable_merge_over_src): New. (dataflow_set_merge): New. (dataflow_set_equiv_regs): New. (remove_duplicate_values): New. (struct dfset_post_merge): New. (variable_post_merge_new_vals): New. (variable_post_merge_perm_vals): New. (dataflow_post_merge_adjust): New. (find_mem_expr_in_1pdv): New. (dataflow_set_preserve_mem_locs): New. (dataflow_set_remove_mem_locs): New. (dataflow_set_clear_at_call): New. (onepart_variable_different_p): New. (variable_different_p): Use it. (dataflow_set_different_1): Adjust. Make detailed dump more verbose. (track_expr_p): Add need_rtl parameter. Don't generate rtl if not needed. (track_loc_p): Pass it true. (struct count_use_info): New. (find_use_val): New. (replace_expr_with_values): New. (log_op_type): New. (use_type): New, partially split out of... (count_uses): ... this. Count new micro-ops. (count_uses_1): Adjust. (count_stores): Adjust. (count_with_sets): New. (VAL_NEEDS_RESOLUTION): New. (VAL_HOLDS_TRACK_EXPR): New. (VAL_EXPR_IS_COPIED): New. (VAL_EXPR_IS_CLOBBERED): New. (add_uses): Adjust. Generate new micro-ops. (add_uses_1): Adjust. (add_stores): Generate new micro-ops. (add_with_sets): New. (find_src_status): Adjust. (find_src_set_src): Adjust. (compute_bb_dataflow): Use dataflow_set_clear_at_call. Handle new micro-ops. Canonicalize value equivalances. (vt_find_locations): Compute total size of hash tables for dumping. Perform merge for var-tracking-assignments. Don't disregard single-block loops. (dump_attrs_list): Handle decl_or_value. (dump_variable): Take variable. Deal with decl_or_value. (dump_variable_slot): New. (dump_vars): Use it. (dump_dataflow_sets): Adjust. (set_slot_part): New, extended to support one-part variables after splitting out of... (set_variable_part): ... this. (clobber_slot_part): New, split out of... (clobber_variable_part): ... this. (delete_slot_part): New, split out of... (delete_variable_part): .... this. (check_wrap_constant): New. (vt_expand_loc_callback): New. (vt_expand_loc): New. (emit_note_insn_var_location): Adjust. Handle values. Handle EMIT_NOTE_AFTER_CALL_INSN. (emit_notes_for_differences_1): Adjust. Handle values. (emit_notes_for_differences_2): Likewise. (emit_notes_for_differences): Adjust. (emit_notes_in_bb): Take pointer to set. Emit AFTER_CALL_INSN notes. Adjust. Handle new micro-ops. (vt_add_function_parameters): Adjust. Create and bind values. (vt_initialize): Adjust. Initialize scratch_regs and valvar_pool, flooded and perm.. Initialize and use cselib. Log operations. Move some code to count_with_sets and add_with_sets. (delete_debug_insns): New. (vt_debug_insns_local): New. (vt_finalize): Release permp, valvar_pool, scratch_regs. Finish cselib. (var_tracking_main): If var-tracking-assignments is enabled but var-tracking isn't, delete debug insns and leave. Likewise if we exceed limits or fail the stack adjustments tests, and after all var-tracking processing. More in var-tracking, from Jakub Jelinek : (dataflow_set): Add traversed_vars. (value_chain, const_value_chain): New typedefs. (value_chain_pool, value_chains): New variables. (value_chain_htab_hash, value_chain_htab_eq, add_value_chain, add_value_chains, add_cselib_value_chains, remove_value_chain, remove_value_chains, remove_cselib_value_chains): New functions. (shared_hash_find_slot_unshare_1, shared_hash_find_slot_1, shared_hash_find_slot_noinsert_1, shared_hash_find_1): New static inlines. (shared_hash_find_slot_unshare, shared_hash_find_slot, shared_hash_find_slot_noinsert, shared_hash_find): Update. (dst_can_be_shared): New variable. (unshare_variable): Unshare set->vars if shared, use shared_hash_*. Clear dst_can_be_shared. If set->traversed_vars is non-NULL and different from set->vars, look up slot again instead of using the passed in slot. (dataflow_set_init): Initialize traversed_vars. (variable_union): Use shared_hash_*. Use initially NO_INSERT lookup if set->vars is shared. Don't keep slot cleared before calling unshare_variable. Unshare set->vars if needed. Adjust unshare_variable callers. Clear dst_can_be_shared if needed. Even ->refcount == 1 vars must be unshared if set->vars is shared and var needs to be modified. (dataflow_set_union): Set traversed_vars during canonicalization. (VALUE_CHANGED, DECL_CHANGED): Define. (set_dv_changed, dv_changed_p): New static inlines. (track_expr_p): Clear DECL_CHANGED. (dump_dataflow_sets): Set it. (variable_was_changed): Call set_dv_changed. (emit_note_insn_var_location): Likewise. (changed_variables_stack): New variable. (check_changed_vars_1, check_changed_vars_2): New functions. (emit_notes_for_changes): Do nothing if changed_variables is empty. Traverse changed_variables with check_changed_vars_1, call check_changed_vars_2 on each changed_variables_stack entry. (emit_notes_in_bb): Add SET argument. Just clear it at the beginning, use it instead of local &set, don't destroy it at the end. (vt_emit_notes): Call dataflow_set_clear early on all VTI(bb)->out sets, never use them, instead use emit_notes_in_bb computed set, dataflow_set_clear also VTI(bb)->in when we are done with the basic block. Initialize changed_variables_stack, free it afterwards. If ENABLE_CHECKING verify that after noting differences to an empty set value_chains hash table is empty. (vt_initialize): Initialize value_chains and value_chain_pool. (vt_finalize): Delete value_chains htab, free value_chain_pool. (variable_tracking_main): Call dump_dataflow_sets before calling vt_emit_notes, not after it. * tree-flow.h (propagate_defs_into_debug_stmts): Declare. (propagate_var_def_into_debug_stmts): Declare. * df-problems.c (df_lr_bb_local_compute): Skip debug insns. (df_set_note): Reject debug insns. (df_whole_mw_reg_dead_p): Take added_notes_p argument. Don't add notes to debug insns. (df_note_bb_compute): Adjust. Likewise. (df_simulate_uses): Skip debug insns. (df_simulate_initialize_backwards): Likewise. * reg-stack.c (subst_stack_regs_in_debug_insn): New. (subst_stack_regs_pat): Reject debug insns. (convert_regs_1): Handle debug insns. * Makefile.in (TREE_INLINE_H): Take pointer-set.h from GIMPLE_H. (print-rtl.o): Depend on cselib.h. (cselib.o): Depend on TREE_PASS_H. (var-tracking.o): Depend on cselib.h and TARGET_H. * sched-rgn.c (rgn_estimate_number_of_insns): Discount debug insns. (init_ready_list): Skip boundary debug insns. (add_branch_dependences): Skip debug insns. (free_block_dependencies): Check for blocks with only debug insns. (compute_priorities): Likewise. * gimple.c (gss_for_code): Handle GIMPLE_DEBUG. (gimple_build_with_ops_stat): Take subcode as unsigned. Adjust all callers. (gimple_build_debug_bind_stat): New. (empty_body_p): Skip debug stmts. (gimple_has_side_effects): Likewise. (gimple_rhs_has_side_effects): Likewise. * gimple.h (enum gimple_debug_subcode, GIMPLE_DEBUG_BIND): New. (gimple_build_debug_bind_stat): Declare. (gimple_build_debug_bind): Define. (is_gimple_debug): New. (gimple_debug_bind_p): New. (gimple_debug_bind_get_var): New. (gimple_debug_bind_get_value): New. (gimple_debug_bind_get_value_ptr): New. (gimple_debug_bind_set_var): New. (gimple_debug_bind_set_value): New. (GIMPLE_DEBUG_BIND_NOVALUE): New internal temporary macro. (gimple_debug_bind_reset_value): New. (gimple_debug_bind_has_value_p): New. (gsi_next_nondebug): New. (gsi_prev_nondebug): New. (gsi_start_nondebug_bb): New. (gsi_last_nondebug_bb): New. * sched-vis.c (print_pattern): Handle VAR_LOCATION. (print_insn): Handle DEBUG_INSN. * tree-cfg.c (remove_bb): Walk stmts backwards. Let loc of first insn prevail. (first_stmt): Skip debug stmts. (first_non_label_stmt): Likewise. (last_stmt): Likewise. (has_zero_uses_1): New. (single_imm_use_1): New. (verify_gimple_debug): New. (verify_types_in_gimple_stmt): Handle debug stmts. (verify_stmt): Likewise. (debug_loop_num): Skip debug stmts. (remove_edge_and_dominated_blocks): Remove dominators last. * tree-ssa-reasssoc.c (rewrite_expr_tree): Propagate into debug stmts. (linearize_expr): Likewise. * config/i386/i386.c (ix86_delegitimize_address): Call default implementation. * config/ia64/ia64.c (ia64_safe_itanium_class): Handle debug insns. (group_barrier_needed): Skip debug insns. (emit_insn_group_barriers): Likewise. (emit_all_insn_group_barriers): Likewise. (ia64_variable_issue): Handle debug insns. (ia64_dfa_new_cycle): Likewise. (final_emit_insn_group_barriers): Skip debug insns. (ia64_dwarf2out_def_steady_cfa): Take frame argument. Don't def cfa without frame. (process_set): Likewise. (process_for_unwind_directive): Pass frame on. * config/rs6000/rs6000.c (TARGET_DELEGITIMIZE_ADDRESS): Define. (rs6000_delegitimize_address): New. (rs6000_debug_adjust_cost): Handle debug insns. (is_microcoded_insn): Likewise. (is_cracked_insn): Likewise. (is_nonpipeline_insn): Likewise. (insn_must_be_first_in_group): Likewise. (insn_must_be_last_in_group): Likewise. (force_new_group): Likewise. * cfgrtl.c (rtl_split_block): Emit INSN_DELETED note if block contains only debug insns. (rtl_merge_blocks): Skip debug insns. (purge_dead_edges): Likewise. (rtl_block_ends_with_call_p): Skip debug insns. * dce.c (deletable_insn_p): Handle VAR_LOCATION. (mark_reg_dependencies): Skip debug insns. * params.def (PARAM_MIN_NONDEBUG_INSN_UID): New. * tree-ssanames.c (release_ssa_name): Propagate def into debug stmts. * tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts): Skip debug stmts. * regcprop.c (replace_oldest_value_addr): Skip debug insns. (replace_oldest_value_mem): Use ALL_REGS for debug insns. (copyprop_hardreg_forward_1): Handle debug insns. * reload1.c (reload): Skip debug insns. Replace unassigned pseudos in debug insns with their equivalences. (eliminate_regs_in_insn): Skip debug insns. (emit_input_reload_insns): Skip debug insns at first, adjust them later. * tree-ssa-operands.c (add_virtual_operand): Reject debug stmts. (get_indirect_ref_operands): Pass opf_no_vops on. (get_expr_operands): Likewise. Skip debug stmts. (parse_ssa_operands): Scan debug insns with opf_no_vops. gcc/testsuite/ChangeLog: * gcc.dg/guality/guality.c: New. * gcc.dg/guality/guality.h: New. * gcc.dg/guality/guality.exp: New. * gcc.dg/guality/example.c: New. * lib/gcc-dg.exp (cleanup-dump): Remove .gk files. (cleanup-saved-temps): Likewise, .gkd files too. gcc/cp/ChangeLog: * cp-tree.h (TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS): New. * cp-lang.c (cxx_dwarf_name): Pass it. * error.c (count_non_default_template_args): Take flags as argument. Adjust all callers. Skip counting of default arguments if the new flag is given. ChangeLog: * Makefile.tpl (BUILD_CONFIG): Default to bootstrap-debug. * Makefile.in: Rebuilt. contrib/ChangeLog: * compare-debug: Look for .gkd files and compare them. config/ChangeLog: * bootstrap-debug.mk: Add comments. * bootstrap-debug-big.mk: New. * bootstrap-debug-lean.mk: New. * bootstrap-debug-ckovw.mk: Add comments. * bootstrap-debug-lib.mk: Drop CFLAGS for stages. Use -g0 for TFLAGS in stage1. Drop -fvar-tracking-assignments-toggle. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151312 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 322 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 313 insertions(+), 9 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index faa7e0dc038..bc61fbedcf4 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -921,7 +921,7 @@ create_log_links (void) { FOR_BB_INSNS_REVERSE (bb, insn) { - if (!INSN_P (insn)) + if (!NONDEBUG_INSN_P (insn)) continue; /* Log links are created only once. */ @@ -1129,7 +1129,7 @@ combine_instructions (rtx f, unsigned int nregs) insn = next ? next : NEXT_INSN (insn)) { next = 0; - if (INSN_P (insn)) + if (NONDEBUG_INSN_P (insn)) { /* See if we know about function return values before this insn based upon SUBREG flags. */ @@ -2161,6 +2161,209 @@ reg_subword_p (rtx x, rtx reg) && GET_MODE_CLASS (GET_MODE (x)) == MODE_INT; } +#ifdef AUTO_INC_DEC +/* Replace auto-increment addressing modes with explicit operations to + access the same addresses without modifying the corresponding + registers. If AFTER holds, SRC is meant to be reused after the + side effect, otherwise it is to be reused before that. */ + +static rtx +cleanup_auto_inc_dec (rtx src, bool after, enum machine_mode mem_mode) +{ + rtx x = src; + const RTX_CODE code = GET_CODE (x); + int i; + const char *fmt; + + switch (code) + { + case REG: + case CONST_INT: + case CONST_DOUBLE: + case CONST_FIXED: + case CONST_VECTOR: + case SYMBOL_REF: + case CODE_LABEL: + case PC: + case CC0: + case SCRATCH: + /* SCRATCH must be shared because they represent distinct values. */ + return x; + case CLOBBER: + if (REG_P (XEXP (x, 0)) && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER) + return x; + break; + + case CONST: + if (shared_const_p (x)) + return x; + break; + + case MEM: + mem_mode = GET_MODE (x); + break; + + case PRE_INC: + case PRE_DEC: + case POST_INC: + case POST_DEC: + gcc_assert (mem_mode != VOIDmode && mem_mode != BLKmode); + if (after == (code == PRE_INC || code == PRE_DEC)) + x = cleanup_auto_inc_dec (XEXP (x, 0), after, mem_mode); + else + x = gen_rtx_PLUS (GET_MODE (x), + cleanup_auto_inc_dec (XEXP (x, 0), after, mem_mode), + GEN_INT ((code == PRE_INC || code == POST_INC) + ? GET_MODE_SIZE (mem_mode) + : -GET_MODE_SIZE (mem_mode))); + return x; + + case PRE_MODIFY: + case POST_MODIFY: + if (after == (code == PRE_MODIFY)) + x = XEXP (x, 0); + else + x = XEXP (x, 1); + return cleanup_auto_inc_dec (x, after, mem_mode); + + default: + break; + } + + /* Copy the various flags, fields, and other information. We assume + that all fields need copying, and then clear the fields that should + not be copied. That is the sensible default behavior, and forces + us to explicitly document why we are *not* copying a flag. */ + x = shallow_copy_rtx (x); + + /* We do not copy the USED flag, which is used as a mark bit during + walks over the RTL. */ + RTX_FLAG (x, used) = 0; + + /* We do not copy FRAME_RELATED for INSNs. */ + if (INSN_P (x)) + RTX_FLAG (x, frame_related) = 0; + + fmt = GET_RTX_FORMAT (code); + for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--) + if (fmt[i] == 'e') + XEXP (x, i) = cleanup_auto_inc_dec (XEXP (x, i), after, mem_mode); + else if (fmt[i] == 'E' || fmt[i] == 'V') + { + int j; + XVEC (x, i) = rtvec_alloc (XVECLEN (x, i)); + for (j = 0; j < XVECLEN (x, i); j++) + XVECEXP (x, i, j) + = cleanup_auto_inc_dec (XVECEXP (src, i, j), after, mem_mode); + } + + return x; +} +#endif + +/* Auxiliary data structure for propagate_for_debug_stmt. */ + +struct rtx_subst_pair +{ + rtx from, to; + bool changed; +#ifdef AUTO_INC_DEC + bool adjusted; + bool after; +#endif +}; + +/* Clean up any auto-updates in PAIR->to the first time it is called + for a PAIR. PAIR->adjusted is used to tell whether we've cleaned + up before. */ + +static void +auto_adjust_pair (struct rtx_subst_pair *pair ATTRIBUTE_UNUSED) +{ +#ifdef AUTO_INC_DEC + if (!pair->adjusted) + { + pair->adjusted = true; + pair->to = cleanup_auto_inc_dec (pair->to, pair->after, VOIDmode); + } +#endif +} + +/* If *LOC is the same as FROM in the struct rtx_subst_pair passed as + DATA, replace it with a copy of TO. Handle SUBREGs of *LOC as + well. */ + +static int +propagate_for_debug_subst (rtx *loc, void *data) +{ + struct rtx_subst_pair *pair = (struct rtx_subst_pair *)data; + rtx from = pair->from, to = pair->to; + rtx x = *loc, s = x; + + if (rtx_equal_p (x, from) + || (GET_CODE (x) == SUBREG && rtx_equal_p ((s = SUBREG_REG (x)), from))) + { + auto_adjust_pair (pair); + if (pair->to != to) + to = pair->to; + else + to = copy_rtx (to); + if (s != x) + { + gcc_assert (GET_CODE (x) == SUBREG && SUBREG_REG (x) == s); + to = simplify_gen_subreg (GET_MODE (x), to, + GET_MODE (from), SUBREG_BYTE (x)); + } + *loc = to; + pair->changed = true; + return -1; + } + + return 0; +} + +/* Replace occurrences of DEST with SRC in DEBUG_INSNs between INSN + and LAST. If MOVE holds, debug insns must also be moved past + LAST. */ + +static void +propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src, bool move) +{ + struct rtx_subst_pair p; + rtx next, move_pos = move ? last : NULL_RTX; + + p.from = dest; + p.to = src; + p.changed = false; + +#ifdef AUTO_INC_DEC + p.adjusted = false; + p.after = move; +#endif + + next = NEXT_INSN (insn); + while (next != last) + { + insn = next; + next = NEXT_INSN (insn); + if (DEBUG_INSN_P (insn)) + { + for_each_rtx (&INSN_VAR_LOCATION_LOC (insn), + propagate_for_debug_subst, &p); + if (!p.changed) + continue; + p.changed = false; + if (move_pos) + { + remove_insn (insn); + PREV_INSN (insn) = NEXT_INSN (insn) = NULL_RTX; + move_pos = emit_debug_insn_after (insn, move_pos); + } + else + df_insn_rescan (insn); + } + } +} /* Delete the conditional jump INSN and adjust the CFG correspondingly. Note that the INSN should be deleted *after* removing dead edges, so @@ -2217,7 +2420,9 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) I2 and not in I3, a REG_DEAD note must be made. */ rtx i3dest_killed = 0; /* SET_DEST and SET_SRC of I2 and I1. */ - rtx i2dest, i2src, i1dest = 0, i1src = 0; + rtx i2dest = 0, i2src = 0, i1dest = 0, i1src = 0; + /* Set if I2DEST was reused as a scratch register. */ + bool i2scratch = false; /* PATTERN (I1) and PATTERN (I2), or a copy of it in certain cases. */ rtx i1pat = 0, i2pat = 0; /* Indicates if I2DEST or I1DEST is in I2SRC or I1_SRC. */ @@ -2301,7 +2506,7 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) && GET_CODE (SET_DEST (PATTERN (i3))) != STRICT_LOW_PART && ! reg_overlap_mentioned_p (SET_SRC (PATTERN (i3)), SET_DEST (PATTERN (i3))) - && next_real_insn (i2) == i3) + && next_active_insn (i2) == i3) { rtx p2 = PATTERN (i2); @@ -2334,6 +2539,7 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) subst_low_luid = DF_INSN_LUID (i2); added_sets_2 = added_sets_1 = 0; + i2src = SET_DEST (PATTERN (i3)); i2dest = SET_SRC (PATTERN (i3)); i2dest_killed = dead_or_set_p (i2, i2dest); @@ -3006,6 +3212,8 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) undobuf.frees = buf; } } + + i2scratch = m_split != 0; } /* If recog_for_combine has discarded clobbers, try to use them @@ -3100,6 +3308,8 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) bool subst_done = false; newi2pat = NULL_RTX; + i2scratch = true; + /* Get NEWDEST as a register in the proper mode. We have already validated that we can do this. */ if (GET_MODE (i2dest) != split_mode && split_mode != VOIDmode) @@ -3402,6 +3612,67 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) return 0; } + if (MAY_HAVE_DEBUG_INSNS) + { + struct undo *undo; + + for (undo = undobuf.undos; undo; undo = undo->next) + if (undo->kind == UNDO_MODE) + { + rtx reg = *undo->where.r; + enum machine_mode new_mode = GET_MODE (reg); + enum machine_mode old_mode = undo->old_contents.m; + + /* Temporarily revert mode back. */ + adjust_reg_mode (reg, old_mode); + + if (reg == i2dest && i2scratch) + { + /* If we used i2dest as a scratch register with a + different mode, substitute it for the original + i2src while its original mode is temporarily + restored, and then clear i2scratch so that we don't + do it again later. */ + propagate_for_debug (i2, i3, reg, i2src, false); + i2scratch = false; + /* Put back the new mode. */ + adjust_reg_mode (reg, new_mode); + } + else + { + rtx tempreg = gen_raw_REG (old_mode, REGNO (reg)); + rtx first, last; + + if (reg == i2dest) + { + first = i2; + last = i3; + } + else + { + first = i3; + last = undobuf.other_insn; + gcc_assert (last); + } + + /* We're dealing with a reg that changed mode but not + meaning, so we want to turn it into a subreg for + the new mode. However, because of REG sharing and + because its mode had already changed, we have to do + it in two steps. First, replace any debug uses of + reg, with its original mode temporarily restored, + with this copy we have created; then, replace the + copy with the SUBREG of the original shared reg, + once again changed to the new mode. */ + propagate_for_debug (first, last, reg, tempreg, false); + adjust_reg_mode (reg, new_mode); + propagate_for_debug (first, last, tempreg, + lowpart_subreg (old_mode, reg, new_mode), + false); + } + } + } + /* If we will be able to accept this, we have made a change to the destination of I3. This requires us to do a few adjustments. */ @@ -3592,16 +3863,24 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) if (newi2pat) { + if (MAY_HAVE_DEBUG_INSNS && i2scratch) + propagate_for_debug (i2, i3, i2dest, i2src, false); INSN_CODE (i2) = i2_code_number; PATTERN (i2) = newi2pat; } else - SET_INSN_DELETED (i2); + { + if (MAY_HAVE_DEBUG_INSNS && i2src) + propagate_for_debug (i2, i3, i2dest, i2src, i3_subst_into_i2); + SET_INSN_DELETED (i2); + } if (i1) { LOG_LINKS (i1) = 0; REG_NOTES (i1) = 0; + if (MAY_HAVE_DEBUG_INSNS) + propagate_for_debug (i1, i3, i1dest, i1src, false); SET_INSN_DELETED (i1); } @@ -12396,6 +12675,29 @@ reg_bitfield_target_p (rtx x, rtx body) return 0; } + +/* Return the next insn after INSN that is neither a NOTE nor a + DEBUG_INSN. This routine does not look inside SEQUENCEs. */ + +static rtx +next_nonnote_nondebug_insn (rtx insn) +{ + while (insn) + { + insn = NEXT_INSN (insn); + if (insn == 0) + break; + if (NOTE_P (insn)) + continue; + if (DEBUG_INSN_P (insn)) + continue; + break; + } + + return insn; +} + + /* Given a chain of REG_NOTES originally from FROM_INSN, try to place them as appropriate. I3 and I2 are the insns resulting from the combination @@ -12649,7 +12951,7 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2, place = from_insn; else if (reg_referenced_p (XEXP (note, 0), PATTERN (i3))) place = i3; - else if (i2 != 0 && next_nonnote_insn (i2) == i3 + else if (i2 != 0 && next_nonnote_nondebug_insn (i2) == i3 && reg_referenced_p (XEXP (note, 0), PATTERN (i2))) place = i2; else if ((rtx_equal_p (XEXP (note, 0), elim_i2) @@ -12667,7 +12969,7 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2, for (tem = PREV_INSN (tem); place == 0; tem = PREV_INSN (tem)) { - if (! INSN_P (tem)) + if (!NONDEBUG_INSN_P (tem)) { if (tem == BB_HEAD (bb)) break; @@ -12868,7 +13170,7 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2, for (tem = PREV_INSN (place); ; tem = PREV_INSN (tem)) { - if (! INSN_P (tem)) + if (!NONDEBUG_INSN_P (tem)) { if (tem == BB_HEAD (bb)) break; @@ -12958,7 +13260,9 @@ distribute_links (rtx links) (insn && (this_basic_block->next_bb == EXIT_BLOCK_PTR || BB_HEAD (this_basic_block->next_bb) != insn)); insn = NEXT_INSN (insn)) - if (INSN_P (insn) && reg_overlap_mentioned_p (reg, PATTERN (insn))) + if (DEBUG_INSN_P (insn)) + continue; + else if (INSN_P (insn) && reg_overlap_mentioned_p (reg, PATTERN (insn))) { if (reg_referenced_p (reg, PATTERN (insn))) place = insn; -- cgit v1.2.1 From 05955b297e795a0aec601aee2e02989a380bc881 Mon Sep 17 00:00:00 2001 From: jakub Date: Fri, 11 Sep 2009 19:40:00 +0000 Subject: * combine.c (propagate_for_debug_subst): Call wrap_constant on top. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151644 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index bc61fbedcf4..3437216ed51 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2314,7 +2314,7 @@ propagate_for_debug_subst (rtx *loc, void *data) to = simplify_gen_subreg (GET_MODE (x), to, GET_MODE (from), SUBREG_BYTE (x)); } - *loc = to; + *loc = wrap_constant (GET_MODE (x), to); pair->changed = true; return -1; } -- cgit v1.2.1 From e38def9ca7953bb5611d08ce8617249516ba5a99 Mon Sep 17 00:00:00 2001 From: rth Date: Mon, 14 Sep 2009 19:18:58 +0000 Subject: Squash commit of EH in gimple git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151696 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 3437216ed51..6b507c2991d 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -1562,7 +1562,6 @@ can_combine_p (rtx insn, rtx i3, rtx pred ATTRIBUTE_UNUSED, rtx succ, for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++) { rtx elt = XVECEXP (PATTERN (insn), 0, i); - rtx note; switch (GET_CODE (elt)) { @@ -1613,9 +1612,8 @@ can_combine_p (rtx insn, rtx i3, rtx pred ATTRIBUTE_UNUSED, rtx succ, /* Ignore SETs whose result isn't used but not those that have side-effects. */ if (find_reg_note (insn, REG_UNUSED, SET_DEST (elt)) - && (!(note = find_reg_note (insn, REG_EH_REGION, NULL_RTX)) - || INTVAL (XEXP (note, 0)) <= 0) - && ! side_effects_p (elt)) + && insn_nothrow_p (insn) + && !side_effects_p (elt)) break; /* If we have already found a SET, this is a second one and @@ -3108,15 +3106,13 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) { rtx set0 = XVECEXP (newpat, 0, 0); rtx set1 = XVECEXP (newpat, 0, 1); - rtx note; if (((REG_P (SET_DEST (set1)) && find_reg_note (i3, REG_UNUSED, SET_DEST (set1))) || (GET_CODE (SET_DEST (set1)) == SUBREG && find_reg_note (i3, REG_UNUSED, SUBREG_REG (SET_DEST (set1))))) - && (!(note = find_reg_note (i3, REG_EH_REGION, NULL_RTX)) - || INTVAL (XEXP (note, 0)) <= 0) - && ! side_effects_p (SET_SRC (set1))) + && insn_nothrow_p (i3) + && !side_effects_p (SET_SRC (set1))) { newpat = set0; insn_code_number = recog_for_combine (&newpat, i3, &new_i3_notes); @@ -3127,9 +3123,8 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) || (GET_CODE (SET_DEST (set0)) == SUBREG && find_reg_note (i3, REG_UNUSED, SUBREG_REG (SET_DEST (set0))))) - && (!(note = find_reg_note (i3, REG_EH_REGION, NULL_RTX)) - || INTVAL (XEXP (note, 0)) <= 0) - && ! side_effects_p (SET_SRC (set0))) + && insn_nothrow_p (i3) + && !side_effects_p (SET_SRC (set0))) { newpat = set1; insn_code_number = recog_for_combine (&newpat, i3, &new_i3_notes); -- cgit v1.2.1 From 2f6eedc269e4d65ccb7b45ee430deb0f74f7e4aa Mon Sep 17 00:00:00 2001 From: ktietz Date: Sun, 20 Sep 2009 09:22:11 +0000 Subject: 2009-09-20 Paolo Bonzini PR/39886 * combine.c (update_cfg_for_uncondjump): Set EDGE_FALLTHRU just when insn is equal to BB_END (bb). 2009-09-20 Kai Tietz * gcc.c-tortue/compile/pr39886.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151895 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 6b507c2991d..35ab576d612 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2363,7 +2363,7 @@ propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src, bool move) } } -/* Delete the conditional jump INSN and adjust the CFG correspondingly. +/* Delete the unconditional jump INSN and adjust the CFG correspondingly. Note that the INSN should be deleted *after* removing dead edges, so that the kept edge is the fallthrough edge for a (set (pc) (pc)) but not for a (set (pc) (label_ref FOO)). */ @@ -2372,12 +2372,13 @@ static void update_cfg_for_uncondjump (rtx insn) { basic_block bb = BLOCK_FOR_INSN (insn); + bool at_end = (BB_END (bb) == insn); - if (BB_END (bb) == insn) + if (at_end) purge_dead_edges (bb); delete_insn (insn); - if (EDGE_COUNT (bb->succs) == 1) + if (at_end && EDGE_COUNT (bb->succs) == 1) single_succ_edge (bb)->flags |= EDGE_FALLTHRU; } -- cgit v1.2.1 From 359a1bd5dd6f78bfa5d870ea9103d96947d7496b Mon Sep 17 00:00:00 2001 From: dougkwan Date: Mon, 5 Oct 2009 09:08:46 +0000 Subject: 2009-10-05 Doug Kwan PR rtl-optimization/41574 Index: combine.c (distribute_and_simplify_rtx): Quit if RTX mode is floating point and we are not doing unsafe math optimizations. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152443 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 35ab576d612..64cf99272da 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -8811,6 +8811,12 @@ distribute_and_simplify_rtx (rtx x, int n) enum rtx_code outer_code, inner_code; rtx decomposed, distributed, inner_op0, inner_op1, new_op0, new_op1, tmp; + /* Distributivity is not true for floating point as it can change the + value. So we don't do it unless -funsafe-math-optimizations. */ + if (FLOAT_MODE_P (GET_MODE (x)) + && ! flag_unsafe_math_optimizations) + return NULL_RTX; + decomposed = XEXP (x, n); if (!ARITHMETIC_P (decomposed)) return NULL_RTX; -- cgit v1.2.1 From a8d7c2f9cff0f9432d8f94020077d04b31a9bc38 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Mon, 5 Oct 2009 17:48:09 +0000 Subject: PR rtl-optimization/41511 * combine.c (record_value_for_reg): Pass explicit values as argument to get_last_value_validate. (get_last_value_validate): Document INSN parameter. For non-readonly MEMs, assume they might have been modified if INSN was in another basic block. (get_last_value): Minor reformatting. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152459 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 64cf99272da..60c4059cecb 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -11758,12 +11758,10 @@ record_value_for_reg (rtx reg, rtx insn, rtx value) case, we must replace it with (clobber (const_int 0)) to prevent infinite loops. */ rsp = VEC_index (reg_stat_type, reg_stat, regno); - if (value && ! get_last_value_validate (&value, insn, - rsp->last_set_label, 0)) + if (value && !get_last_value_validate (&value, insn, label_tick, 0)) { value = copy_rtx (value); - if (! get_last_value_validate (&value, insn, - rsp->last_set_label, 1)) + if (!get_last_value_validate (&value, insn, label_tick, 1)) value = 0; } @@ -12055,15 +12053,14 @@ check_promoted_subreg (rtx insn, rtx x) } } -/* Utility routine for the following function. Verify that all the registers - mentioned in *LOC are valid when *LOC was part of a value set when - label_tick == TICK. Return 0 if some are not. - - If REPLACE is nonzero, replace the invalid reference with - (clobber (const_int 0)) and return 1. This replacement is useful because - we often can get useful information about the form of a value (e.g., if - it was produced by a shift that always produces -1 or 0) even though - we don't know exactly what registers it was produced from. */ +/* Verify that all the registers and memory references mentioned in *LOC are + still valid. *LOC was part of a value set in INSN when label_tick was + equal to TICK. Return 0 if some are not. If REPLACE is nonzero, replace + the invalid references with (clobber (const_int 0)) and return 1. This + replacement is useful because we often can get useful information about + the form of a value (e.g., if it was produced by a shift that always + produces -1 or 0) even though we don't know exactly what registers it + was produced from. */ static int get_last_value_validate (rtx *loc, rtx insn, int tick, int replace) @@ -12099,11 +12096,12 @@ get_last_value_validate (rtx *loc, rtx insn, int tick, int replace) return 1; } - /* If this is a memory reference, make sure that there were - no stores after it that might have clobbered the value. We don't - have alias info, so we assume any store invalidates it. */ + /* If this is a memory reference, make sure that there were no stores after + it that might have clobbered the value. We don't have alias info, so we + assume any store invalidates it. Moreover, we only have local UIDs, so + we also assume that there were stores in the intervening basic blocks. */ else if (MEM_P (x) && !MEM_READONLY_P (x) - && DF_INSN_LUID (insn) <= mem_last_set) + && (tick != label_tick || DF_INSN_LUID (insn) <= mem_last_set)) { if (replace) *loc = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx); @@ -12213,16 +12211,14 @@ get_last_value (const_rtx x) return 0; /* If the value has all its registers valid, return it. */ - if (get_last_value_validate (&value, rsp->last_set, - rsp->last_set_label, 0)) + if (get_last_value_validate (&value, rsp->last_set, rsp->last_set_label, 0)) return value; /* Otherwise, make a copy and replace any invalid register with (clobber (const_int 0)). If that fails for some reason, return 0. */ value = copy_rtx (value); - if (get_last_value_validate (&value, rsp->last_set, - rsp->last_set_label, 1)) + if (get_last_value_validate (&value, rsp->last_set, rsp->last_set_label, 1)) return value; return 0; -- cgit v1.2.1 From 096125f1074c9bc1f0941bd35b97e8832bea85fb Mon Sep 17 00:00:00 2001 From: nemet Date: Thu, 8 Oct 2009 17:54:24 +0000 Subject: * combine.c (label_tick_ebb_start): Fix comment. (combine_instructions): Set label_tick and label_tick_ebb_start before calling setup_incoming_promotions. Start them from 1. Increment label_tick instead of deriving it from the BB index. Rather than comparing ticks use the block from the previous iteration to decide whether to start a new EBB. Remove empty lines before function. testsuite/ * gcc.target/mips/truncate-6.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152567 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 60c4059cecb..af9cea2fe2a 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -321,7 +321,7 @@ static rtx *uid_log_links; static int label_tick; -/* Reset to label_tick for each label. */ +/* Reset to label_tick for each extended basic block in scanning order. */ static int label_tick_ebb_start; @@ -1010,9 +1010,6 @@ clear_log_links (void) if (INSN_P (insn)) free_INSN_LIST_list (&LOG_LINKS (insn)); } - - - /* Main entry point for combiner. F is the first insn of the function. NREGS is the first unused pseudo-reg number. @@ -1028,6 +1025,7 @@ combine_instructions (rtx f, unsigned int nregs) #endif rtx links, nextlinks; rtx first; + basic_block last_bb; int new_direct_jump_p = 0; @@ -1058,6 +1056,7 @@ combine_instructions (rtx f, unsigned int nregs) problems when, for example, we have j <<= 1 in a loop. */ nonzero_sign_valid = 0; + label_tick = label_tick_ebb_start = 1; /* Scan all SETs and see if we can deduce anything about what bits are known to be zero for some registers and how many copies @@ -1067,18 +1066,23 @@ combine_instructions (rtx f, unsigned int nregs) for what bits are known to be set. */ setup_incoming_promotions (first); + /* Allow the entry block and the first block to fall into the same EBB. + Conceptually the incoming promotions are assigned to the entry block. */ + last_bb = ENTRY_BLOCK_PTR; create_log_links (); - label_tick_ebb_start = ENTRY_BLOCK_PTR->index; FOR_EACH_BB (this_basic_block) { optimize_this_for_speed_p = optimize_bb_for_speed_p (this_basic_block); last_call_luid = 0; mem_last_set = -1; - label_tick = this_basic_block->index; + + label_tick++; if (!single_pred_p (this_basic_block) - || single_pred (this_basic_block)->index != label_tick - 1) + || single_pred (this_basic_block) != last_bb) label_tick_ebb_start = label_tick; + last_bb = this_basic_block; + FOR_BB_INSNS (this_basic_block, insn) if (INSN_P (insn) && BLOCK_FOR_INSN (insn)) { @@ -1109,20 +1113,23 @@ combine_instructions (rtx f, unsigned int nregs) nonzero_sign_valid = 1; /* Now scan all the insns in forward order. */ - - label_tick_ebb_start = ENTRY_BLOCK_PTR->index; + label_tick = label_tick_ebb_start = 1; init_reg_last (); setup_incoming_promotions (first); + last_bb = ENTRY_BLOCK_PTR; FOR_EACH_BB (this_basic_block) { optimize_this_for_speed_p = optimize_bb_for_speed_p (this_basic_block); last_call_luid = 0; mem_last_set = -1; - label_tick = this_basic_block->index; + + label_tick++; if (!single_pred_p (this_basic_block) - || single_pred (this_basic_block)->index != label_tick - 1) + || single_pred (this_basic_block) != last_bb) label_tick_ebb_start = label_tick; + last_bb = this_basic_block; + rtl_profile_for_bb (this_basic_block); for (insn = BB_HEAD (this_basic_block); insn != NEXT_INSN (BB_END (this_basic_block)); -- cgit v1.2.1 From bf4652ac2b3d27b528c7cf95a205f2be548c52c1 Mon Sep 17 00:00:00 2001 From: rsandifo Date: Tue, 20 Oct 2009 19:50:38 +0000 Subject: gcc/ * rtl.h (simplify_replace_fn_rtx): Declare. (wrap_constant, unwrap_constant): Delete. * cfgexpand.c (unwrap_constant, wrap_constant): Delete. (expand_debug_expr): Don't call wrap_constant. * combine.c (rtx_subst_pair): Only define for AUTO_INC_DEC. (auto_adjust_pair): Fold into... (propagate_for_debug_subst): ...here. Only define for AUTO_INC_DEC. Just return a new value. (propagate_for_debug): Use simplify_replace_fn_rtx for AUTO_INC_DEC, otherwise use simplify_replace_rtx. * cselib.c (wrap_constant): Reinstate old definition. (cselib_expand_value_rtx_1): Don't wrap constants. * gcse.c (try_replace_reg): Don't use copy_rtx in the call to simplify_replace_rtx. (bypass_block): Fix formatting in calls to simplify_replace_rtx. * reload1.c (reload): Skip all uses for an insn before adjusting it. Use simplify_replace_rtx. * simplify-rtx.c (simplify_replace_fn_rtx): New function, adapted from... (simplify_replace_rtx): ...here. Turn into a wrapper for simplify_replace_fn_rtx. (simplify_unary_operation): Don't unwrap CONSTs. * var-tracking.c (check_wrap_constant): Delete. (vt_expand_loc_callback): Don't call it. (vt_expand_loc): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153037 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 76 +++++++++++++++++------------------------------------------ 1 file changed, 21 insertions(+), 55 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index af9cea2fe2a..129cd4dff39 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2264,68 +2264,33 @@ cleanup_auto_inc_dec (rtx src, bool after, enum machine_mode mem_mode) return x; } -#endif /* Auxiliary data structure for propagate_for_debug_stmt. */ struct rtx_subst_pair { - rtx from, to; - bool changed; -#ifdef AUTO_INC_DEC + rtx to; bool adjusted; bool after; -#endif }; -/* Clean up any auto-updates in PAIR->to the first time it is called - for a PAIR. PAIR->adjusted is used to tell whether we've cleaned - up before. */ +/* DATA points to an rtx_subst_pair. Return the value that should be + substituted. */ -static void -auto_adjust_pair (struct rtx_subst_pair *pair ATTRIBUTE_UNUSED) +static rtx +propagate_for_debug_subst (rtx from ATTRIBUTE_UNUSED, void *data) { -#ifdef AUTO_INC_DEC + struct rtx_subst_pair *pair = (struct rtx_subst_pair *)data; + if (!pair->adjusted) { pair->adjusted = true; pair->to = cleanup_auto_inc_dec (pair->to, pair->after, VOIDmode); + return pair->to; } -#endif -} - -/* If *LOC is the same as FROM in the struct rtx_subst_pair passed as - DATA, replace it with a copy of TO. Handle SUBREGs of *LOC as - well. */ - -static int -propagate_for_debug_subst (rtx *loc, void *data) -{ - struct rtx_subst_pair *pair = (struct rtx_subst_pair *)data; - rtx from = pair->from, to = pair->to; - rtx x = *loc, s = x; - - if (rtx_equal_p (x, from) - || (GET_CODE (x) == SUBREG && rtx_equal_p ((s = SUBREG_REG (x)), from))) - { - auto_adjust_pair (pair); - if (pair->to != to) - to = pair->to; - else - to = copy_rtx (to); - if (s != x) - { - gcc_assert (GET_CODE (x) == SUBREG && SUBREG_REG (x) == s); - to = simplify_gen_subreg (GET_MODE (x), to, - GET_MODE (from), SUBREG_BYTE (x)); - } - *loc = wrap_constant (GET_MODE (x), to); - pair->changed = true; - return -1; - } - - return 0; + return copy_rtx (pair->to); } +#endif /* Replace occurrences of DEST with SRC in DEBUG_INSNs between INSN and LAST. If MOVE holds, debug insns must also be moved past @@ -2334,14 +2299,11 @@ propagate_for_debug_subst (rtx *loc, void *data) static void propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src, bool move) { - struct rtx_subst_pair p; - rtx next, move_pos = move ? last : NULL_RTX; - - p.from = dest; - p.to = src; - p.changed = false; + rtx next, move_pos = move ? last : NULL_RTX, loc; #ifdef AUTO_INC_DEC + struct rtx_subst_pair p; + p.to = src; p.adjusted = false; p.after = move; #endif @@ -2353,11 +2315,15 @@ propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src, bool move) next = NEXT_INSN (insn); if (DEBUG_INSN_P (insn)) { - for_each_rtx (&INSN_VAR_LOCATION_LOC (insn), - propagate_for_debug_subst, &p); - if (!p.changed) +#ifdef AUTO_INC_DEC + loc = simplify_replace_fn_rtx (INSN_VAR_LOCATION_LOC (insn), + dest, propagate_for_debug_subst, &p); +#else + loc = simplify_replace_rtx (INSN_VAR_LOCATION_LOC (insn), dest, src); +#endif + if (loc == INSN_VAR_LOCATION_LOC (insn)) continue; - p.changed = false; + INSN_VAR_LOCATION_LOC (insn) = loc; if (move_pos) { remove_insn (insn); -- cgit v1.2.1 From bd1a81f7e1665d2e33cc824dd05dd7988da9f1a8 Mon Sep 17 00:00:00 2001 From: uweigand Date: Mon, 26 Oct 2009 21:55:59 +0000 Subject: 2009-10-26 Ben Elliston Michael Meissner Ulrich Weigand * doc/extend.texi (Named Address Spaces): New section. * coretypes.h (addr_space_t): New type. (ADDR_SPACE_GENERIC): New define. (ADDR_SPACE_GENERIC_P): New macro. * doc/tm.texi (Named Address Spaces): New section. (TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P): Document. (TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS): Document. (TARGET_ADDR_SPACE_SUBSET_P): Document. (TARGET_ADDR_SPACE_CONVERT): Document. * target.h (struct gcc_target): Add addr_space substructure. * target-def.h (TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P): Define. (TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS): Likewise. (TARGET_ADDR_SPACE_SUBSET_P): Likewise. (TARGET_ADDR_SPACE_CONVERT): Likewise. (TARGET_ADDR_SPACE_HOOKS): Likewise. (TARGET_INITIALIZER): Initialize addr_space hooks. * targhooks.c (default_addr_space_legitimate_address_p): New function. (default_addr_space_legitimize_address): Likewise. (default_addr_space_subset_p): Likewise. (default_addr_space_convert): Likewise. * targhooks.h (default_addr_space_legitimate_address_p): Add prototype. (default_addr_space_legitimize_address): Likewise. (default_addr_space_subset_p): Likewise. (default_addr_space_convert): Likewise. * doc/rtl.texi (MEM_ADDR_SPACE): Document. * rtl.h (mem_attrs): Add ADDRSPACE memory attribute. (MEM_ADDR_SPACE): New macro. * emit-rtl.c (get_mem_attrs): Add ADDRSPACE argument and set address space memory attribute. (mem_attrs_htab_hash): Handle address space memory attribute. (mem_attrs_htab_eq): Likewise. (set_mem_attributes_minus_bitpos): Likewise. (set_mem_alias_set): Likewise. (set_mem_align): Likewise. (set_mem_expr): Likewise. (set_mem_offset): Likewise. (set_mem_size): Likewise. (adjust_address_1): Likewise. (offset_address): Likewise. (widen_memoy_address): Likewise. (get_spill_slot_decl): Likewise. (set_mem_attrs_for_spill): Likewise. (set_mem_addr_space): New function. * emit-rtl.h (set_mem_addr_space): Add prototype. * print-rtl.c (print_rtx): Print address space memory attribute. * expr.c (expand_assignment): Set address space memory attribute of generated MEM RTXes as appropriate. (expand_expr_real_1): Likewise. * cfgexpand.c (expand_debug_expr): Likewise. * tree-ssa-loop-ivopts.c (produce_memory_decl_rtl): Likewise. * tree.h (struct tree_base): Add address_space bitfield. Reduce size of "spare" bitfield. (TYPE_ADDR_SPACE): New macro. (ENCODE_QUAL_ADDR_SPACE): Likewise. (DECODE_QUAL_ADDR_SPACE): Likewise. (CLEAR_QUAL_ADDR_SPACE): Likewise. (KEEP_QUAL_ADDR_SPACE): Likewise. (TYPE_QUALS): Encode type address space. (TYPE_QUALS_NO_ADDR_SPACE): New macro. * tree.c (set_type_quals): Set type address space. (build_array_type): Inherit array address space from element type. * print-tree.c (print_node_brief): Print type address space. (print_node): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * explow.c (memory_address): Rename to ... (memory_address_addr_space): ... this. Add ADDRSPACE argument. Use address-space aware variants of memory address routines. * recog.c (memory_address_p): Rename to ... (memory_address_addr_space_p): ... this. Add ADDSPACE argument. Use address-space aware variants of memory address routines. (offsettable_address_p): Rename to ... (offsettable_address_addr_space_p): ... this. Add ADDRSPACE argument. Use address-space aware variants of memory address routines. * reload.c (strict_memory_address_p): Rename to ... (strict_memory_address_addr_space_p): ... this. Add ADDSPACE argument. Use address-space aware variants of memory address routines. (maybe_memory_address_p): Rename to ... (maybe_memory_address_addr_space_p): ... this. Add ADDSPACE argument. Use address-space aware variants of memory address routines. * expr.h (memory_address_addr_space): Add prototype. (memory_address): Define as macro. * recog.h (memory_address_addr_space_p): Add prototype. (memory_address_p): Define as macro. (offsettable_address_addr_space_p): Add prototype. (offsettable_address_p): Define as macro. (strict_memory_address_addr_space_p): Add prototype. (strict_memory_address_p): Define as macro. * combine.c (find_split_point): Use address-space aware variants of memory address routines. * emit-rtl.c (operand_subword): Likewise. (change_address_1): Likewise. (adjust_address_1): Likewise. (offset_address): Likewise. * expr.c (emit_move_insn): Likewise. (expand_assignment): Likewise. (expand_expr_real_1): Likewise. * recog.c (verify_changes): Likewise. (general_operand): Likewise. (offsettable_memref_p): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * reload.c (get_secondary_mem): Likewise. (find_reloads_toplev): Likewise. (find_reloads_address): Likewise. (find_reloads_subreg_address): Likewise. * reload1.c (reload): Likewise. * rtlhooks.c (gen_lowpart_if_possible): Likewise. * rtl.h (address_cost): Add ADDRSPACE argument. * rtlanal.c (address_cost): Add ADDRSPACE argument. Use address-space aware variant of memory address routines. * loop-invariant.c (create_new_invariant): Update address_cost call. * tree-ssa-loop-ivopts.c (computation_cost): Likewise. * fwprop.c (should_replace_address): Add ADDRSPACE argument. Use address-space aware variant of memory address routines. (propagate_rtx_1): Update call to should_replace_address. * tree-flow.h (multiplier_allowed_in_address_p): Add ADDRSPACE argument. * tree-ssa-loop-ivopts.c (multiplier_allowed_in_address_p): Add ADDRSPACE argument. Use per-address-space instead of global cache. Use address-space aware variant of memory address routines. (get_address_cost): Likewise. (get_computation_cost_at): Update calls. * tree-ssa-address.c (valid_mem_ref_p): Add ADDRSPACE argument. Use address-space aware variant of memory address routines. (create_mem_ref_raw): Update call to valid_mem_ref_p. (most_expensive_mult_to_index): Update call to multiplier_allowed_in_address_p. * dwarf2out.c (modified_type_die): Output DW_AT_address_class attribute to indicate named address spaces. * varasm.c (get_variable_section): DECLs in named address spaces cannot be "common". * reload.c (find_reloads_address): Do not use LEGITIMIZE_RELOAD_ADDRESS for addresses in a non-generic address space. * expr.c (emit_block_move_hints): Do not use libcalls for memory in non-generic address spaces. (clear_storage_hints): Likewise. (expand_assignment): Likewise. * fold-const.c (operand_equal_p): Expressions refering to different address spaces are not equivalent. * rtl.c (rtx_equal_p_cb): MEMs refering to different address spaces are not equivalent. (rtx_equal_p): Likewise. * cse.c (exp_equiv_p): Likewise. * jump.c (rtx_renumbered_equal_p): Likewise. * reload.c (operands_match_p): Likewise. * alias.c (nonoverlapping_memrefs_p): MEMs refering to different address spaces may alias. (true_dependence): Likewise. (canon_true_dependence): Likewise. (write_dependence_p): Likewise. * dse.c (canon_address): Handle named address spaces. * ifcvt.c (noce_try_cmove_arith): Likewise. * tree.def (ADDR_SPACE_CONVERT_EXPR): New tree code. * expr.c (expand_expr_real_2): Expand ADDR_SPACE_CONVERT_EXPR. * convert.c (convert_to_pointer): Generate ADDR_SPACE_CONVERT_EXPR to handle conversions between different address spaces. * fold-const.c (fold_convert_loc): Likewise. (fold_unary_loc): Handle ADDR_SPACE_CONVERT_EXPR. * tree-pretty-print.c (dump_generic_node): Likewise. * gimple-pretty-print.c (dump_unary_rhs): Likewise. * tree-cfg.c (verify_gimple_assign_unary): Likewise. * tree-inline.c (estimate_operator_cost): Likewise. * tree-ssa.c (useless_type_conversion_p): Conversions between pointers to different address spaces are not useless. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153572 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 129cd4dff39..89dc4154947 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -4174,7 +4174,8 @@ find_split_point (rtx *loc, rtx insn) it will not remain in the result. */ if (GET_CODE (XEXP (x, 0)) == PLUS && CONST_INT_P (XEXP (XEXP (x, 0), 1)) - && ! memory_address_p (GET_MODE (x), XEXP (x, 0))) + && ! memory_address_addr_space_p (GET_MODE (x), XEXP (x, 0), + MEM_ADDR_SPACE (x))) { rtx reg = regno_reg_rtx[FIRST_PSEUDO_REGISTER]; rtx seq = combine_split_insns (gen_rtx_SET (VOIDmode, reg, @@ -4197,8 +4198,9 @@ find_split_point (rtx *loc, rtx insn) && NONJUMP_INSN_P (NEXT_INSN (seq)) && GET_CODE (PATTERN (NEXT_INSN (seq))) == SET && SET_DEST (PATTERN (NEXT_INSN (seq))) == reg - && memory_address_p (GET_MODE (x), - SET_SRC (PATTERN (NEXT_INSN (seq))))) + && memory_address_addr_space_p + (GET_MODE (x), SET_SRC (PATTERN (NEXT_INSN (seq))), + MEM_ADDR_SPACE (x))) { rtx src1 = SET_SRC (PATTERN (seq)); rtx src2 = SET_SRC (PATTERN (NEXT_INSN (seq))); @@ -4237,7 +4239,8 @@ find_split_point (rtx *loc, rtx insn) /* If we have a PLUS whose first operand is complex, try computing it separately by making a split there. */ if (GET_CODE (XEXP (x, 0)) == PLUS - && ! memory_address_p (GET_MODE (x), XEXP (x, 0)) + && ! memory_address_addr_space_p (GET_MODE (x), XEXP (x, 0), + MEM_ADDR_SPACE (x)) && ! OBJECT_P (XEXP (XEXP (x, 0), 0)) && ! (GET_CODE (XEXP (XEXP (x, 0), 0)) == SUBREG && OBJECT_P (SUBREG_REG (XEXP (XEXP (x, 0), 0))))) -- cgit v1.2.1 From 98155838dbd82b97bb7bb16dfcbf98fa2ab27ca9 Mon Sep 17 00:00:00 2001 From: uweigand Date: Mon, 26 Oct 2009 21:57:10 +0000 Subject: 2009-10-26 Ben Elliston Michael Meissner Ulrich Weigand * doc/tm.texi (TARGET_ADDR_SPACE_POINTER_MODE): Document. (TARGET_ADDR_SPACE_ADDRESS_MODE): Likewise. (TARGET_ADDR_SPACE_VALID_POINTER_MODE): Likewise. * target.h (struct target_def): Add pointer_mode, address_mode, and valid_pointer_mode to addr_space substructure. * target-def.h (TARGET_ADDR_SPACE_POINTER_MODE): Define. (TARGET_ADDR_SPACE_ADDRESS_MODE): Likewise. (TARGET_ADDR_SPACE_VALID_POINTER_MODE): Likewise. (TARGET_ADDR_SPACE_HOOKS): Add them. * targhooks.c (target_default_pointer_address_modes_p): New function. * target.h (target_default_pointer_address_modes_p): Add prototype. * targhooks.c (default_addr_space_pointer_mode): New function. (default_addr_space_address_mode): Likewise. (default_addr_space_valid_pointer_mode): Likewise. * targhooks.h (default_addr_space_pointer_mode): Add prototype. (default_addr_space_address_mode): Likewise. (default_addr_space_valid_pointer_mode): Likewise. * output.h (default_valid_pointer_mode): Move to ... * targhooks.h (default_valid_pointer_mode): ... here. * varasm.c (default_valid_pointer_mode): Move to ... * targhooks.c (default_valid_pointer_mode): ... here. * varasm.c (output_constant): Use targetm.addr_space.valid_pointer_mode instead of targetm.valid_pointer_mode. * fold-const.c (fit_double_type): Use int_or_pointer_precision. * tree.c (integer_pow2p): Likewise. (tree_log2): Likewise. (tree_floor_log2): Likewise. (signed_or_unsigned_type_for): Support pointer type of different size. (int_or_pointer_precision): New function. * tree.h (int_or_pointer_precision): Add prototype. * stor-layout.c (layout_type): Set TYPE_PRECISION for offset types. * varasm.c (initializer_constant_valid_p): Use TYPE_PRECISION of incoming pointer type instead of POINTER_SIZE. * tree.c (build_pointer_type): Use appropriate pointer mode instead of ptr_mode. (build_reference_type): Likewise. * expr.c (store_expr): Likewise. (expand_expr_addr_expr): Likewise. * tree-vect-data-refs.c (vect_create_data_ref_ptr): Likewise. * cfgexpand.c (expand_debug_expr): Likewise. * auto-inc-dec.c: Include "target.h". (try_merge): Use appropriate address mode instead of Pmode. (find_inc): Likewise. * combine.c (find_split_point): Likewise. * cselib.c (cselib_record_sets): Likewise. * dse.c (replace_inc_dec): Likewise. (canon_address): Likewise. * var-tracking.c (replace_expr_with_values): Likewise. (count_uses): Likewise. (add_uses): Likewise. (add_stores): Likewise. * emit-rtl.c: Include "target.h". (adjust_address_1): Use appropriate address mode instead of Pmode. (offset_address): Likewise. * explow.c (break_out_memory_refs): Likewise. (memory_address_addr_space): Likewise. (promote_mode): Likewise. * expr.c (move_by_pieces): Likewise. (emit_block_move_via_loop): Likewise. (store_by_pieces): Likewise. (store_by_pieces_1): Likewise. (expand_assignment): Likewise. (store_constructor): Likewise. (expand_expr_addr_expr): Likewise. (expand_expr_real_1): Likewise. * cfgexpand.c (expand_debug_expr): Likewise. * ifcvt.c (noce_try_cmove_arith): Likewise. * regcprop.c (kill_autoinc_value): Likewise. * regmove.c (try_auto_increment): Likewise. * reload.c (find_reloads): Likewise. (find_reloads_address): Likewise. (find_reloads_address_1): Likewise. * sched-deps.c: Include "target.h". (sched_analyze_1): Use appropriate address mode instead of Pmode. (sched_analyze_2): Likewise. * sel-sched-dump.c: Include "target.h". (debug_mem_addr_value): Use appropriate address mode instead of Pmode. * stor-layout.c (layout_type): Likewise. * tree-ssa-loop-ivopts.c (produce_memory_decl_rtl): Likewise. (multiplier_allowed_in_address_p): Likewise. (get_address_cost): Likewise. * varasm.c (make_decl_rtl): Likewise. * expr.c (expand_assignment): Always convert offsets to appropriate address mode. (store_expr): Likewise. (store_constructor): Likewise. (expand_expr_real_1): Likewise. * reload.h (form_sum): Add MODE argument. * reload.c (form_sum): Add MODE argument, use it instead of Pmode. Update recursive calls. (subst_indexed_address): Update calls to form_sum. * tree-flow.h (addr_for_mem_ref): Add ADDRSPACE argument. * tree-ssa-address.c: Include "target.h". (templates): Replace by ... (mem_addr_template_list): ... this new vector. (TEMPL_IDX): Handle address space numbers. (gen_addr_rtx): Add address mode argument, use it instead of Pmode. (addr_for_mem_ref): Add ADDRSPACE argument. Use per-address-space instead of global cache. Update call to gen_addr_rtx. (valid_mem_ref_p): Update call to addr_for_mem_ref. * expr.c (expand_expr_real_1): Update call to addr_for_mem_ref. * rtl.h (convert_memory_address_addr_space): Add prototype. (convert_memory_address): Define as macro. * explow.c (convert_memory_address): Rename to ... (convert_memory_address_addr_space): ... this. Add ADDRSPACE argument. Use appropriate pointer and address modes instead of ptr_mode / Pmode. Update recursive calls. (memory_address_addr_space): Call convert_memory_address_addr_space. * expmed.c (make_tree): Likewise. * expr.c (expand_assignment): Likewise. (expand_expr_addr_expr_1): Likewise. Also, add ADDRSPACE argument. (expand_expr_addr_expr): Likewise. Also, update call. * alias.c (find_base_value): Guard pointer size optimizations. (find_base_term): Likewise. * rtlanal.c (nonzero_bits1): Likewise. (num_sign_bit_copies1): Likewise. * simplify-rtx.c (simplify_unary_operation_1): Likewise. * Makefile.in (tree-ssa-address.o): Add $(TARGET_H) dependency. (emit-rtl.o): Likewise. (auto-inc-dec.o): Likewise. (sched-deps.o): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153573 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 89dc4154947..2311755691c 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -4159,9 +4159,12 @@ find_split_point (rtx *loc, rtx insn) if (GET_CODE (XEXP (x, 0)) == CONST || GET_CODE (XEXP (x, 0)) == SYMBOL_REF) { + enum machine_mode address_mode + = targetm.addr_space.address_mode (MEM_ADDR_SPACE (x)); + SUBST (XEXP (x, 0), - gen_rtx_LO_SUM (Pmode, - gen_rtx_HIGH (Pmode, XEXP (x, 0)), + gen_rtx_LO_SUM (address_mode, + gen_rtx_HIGH (address_mode, XEXP (x, 0)), XEXP (x, 0))); return &XEXP (XEXP (x, 0), 0); } -- cgit v1.2.1 From 538fa3ee20fea8d19b6ea2f7927c6cea844bb61b Mon Sep 17 00:00:00 2001 From: bonzini Date: Wed, 28 Oct 2009 10:27:15 +0000 Subject: 2009-10-28 Paolo Bonzini PR rtl-optimization/39715 * combine.c (simplify_comparison): Use extensions to widen comparisons. Try an ANDing first. testsuite: 2009-10-28 Paolo Bonzini PR rtl-optimization/39715 * gcc.target/arm/thumb-bitfld1.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153651 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 51 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 2311755691c..80c538ec490 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -11467,6 +11467,22 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1) { int zero_extended; + /* If this is a test for negative, we can make an explicit + test of the sign bit. Test this first so we can use + a paradoxical subreg to extend OP0. */ + + if (op1 == const0_rtx && (code == LT || code == GE) + && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT) + { + op0 = simplify_gen_binary (AND, tmode, + gen_lowpart (tmode, op0), + GEN_INT ((HOST_WIDE_INT) 1 + << (GET_MODE_BITSIZE (mode) + - 1))); + code = (code == LT) ? NE : EQ; + break; + } + /* If the only nonzero bits in OP0 and OP1 are those in the narrower mode and this is an equality or unsigned comparison, we can use the wider mode. Similarly for sign-extended @@ -11497,27 +11513,20 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1) XEXP (op0, 0)), gen_lowpart (tmode, XEXP (op0, 1))); - - op0 = gen_lowpart (tmode, op0); - if (zero_extended && CONST_INT_P (op1)) - op1 = GEN_INT (INTVAL (op1) & GET_MODE_MASK (mode)); - op1 = gen_lowpart (tmode, op1); - break; - } - - /* If this is a test for negative, we can make an explicit - test of the sign bit. */ - - if (op1 == const0_rtx && (code == LT || code == GE) - && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT) - { - op0 = simplify_gen_binary (AND, tmode, - gen_lowpart (tmode, op0), - GEN_INT ((HOST_WIDE_INT) 1 - << (GET_MODE_BITSIZE (mode) - - 1))); - code = (code == LT) ? NE : EQ; - break; + else + { + if (zero_extended) + { + op0 = simplify_gen_unary (ZERO_EXTEND, tmode, op0, mode); + op1 = simplify_gen_unary (ZERO_EXTEND, tmode, op1, mode); + } + else + { + op0 = simplify_gen_unary (SIGN_EXTEND, tmode, op0, mode); + op1 = simplify_gen_unary (SIGN_EXTEND, tmode, op1, mode); + } + break; + } } } -- cgit v1.2.1 From 48e1416a24d50cacbb2a5e06a9ee61dd8cbee313 Mon Sep 17 00:00:00 2001 From: hjl Date: Wed, 25 Nov 2009 10:55:54 +0000 Subject: Remove trailing white spaces. 2009-11-25 H.J. Lu * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154645 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 80c538ec490..cdc677d17c7 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -767,7 +767,7 @@ do_SUBST_MODE (rtx *into, enum machine_mode newval) /* Subroutine of try_combine. Determine whether the combine replacement patterns NEWPAT, NEWI2PAT and NEWOTHERPAT are cheaper according to insn_rtx_cost that the original instruction sequence I1, I2, I3 and - undobuf.other_insn. Note that I1 and/or NEWI2PAT may be NULL_RTX. + undobuf.other_insn. Note that I1 and/or NEWI2PAT may be NULL_RTX. NEWOTHERPAT and undobuf.other_insn may also both be NULL_RTX. This function returns false, if the costs of all instructions can be estimated, and the replacements are more expensive than the original @@ -912,7 +912,7 @@ create_log_links (void) register and establishing log links when def is encountered. Note that we do not clear next_use array in order to save time, so we have to test whether the use is in the same basic block as def. - + There are a few cases below when we do not consider the definition or usage -- these are taken from original flow.c did. Don't ask me why it is done this way; I don't know and if it works, I don't want to know. */ @@ -1367,7 +1367,7 @@ setup_incoming_promotions (rtx first) mode2 = TYPE_MODE (DECL_ARG_TYPE (arg)); uns3 = TYPE_UNSIGNED (DECL_ARG_TYPE (arg)); - /* The mode and signedness of the argument as it is actually passed, + /* The mode and signedness of the argument as it is actually passed, after any TARGET_PROMOTE_FUNCTION_ARGS-driven ABI promotions. */ mode3 = promote_function_mode (DECL_ARG_TYPE (arg), mode2, &uns3, TREE_TYPE (cfun->decl), 0); @@ -3887,7 +3887,7 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) if (newi2pat && new_i2_notes) distribute_notes (new_i2_notes, i2, i2, NULL_RTX, NULL_RTX, NULL_RTX); - + if (new_i3_notes) distribute_notes (new_i3_notes, i3, i3, NULL_RTX, NULL_RTX, NULL_RTX); @@ -4033,7 +4033,7 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) } df_insn_rescan (i3); } - + /* Set new_direct_jump_p if a new return or simple jump instruction has been created. Adjust the CFG accordingly. */ @@ -4061,7 +4061,7 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) *new_direct_jump_p = 1; update_cfg_for_uncondjump (i3); } - + combine_successes++; undo_commit (); @@ -5272,7 +5272,7 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest) } /* Try simplify a*(b/c) as (a*b)/c. */ - if (FLOAT_MODE_P (mode) && flag_associative_math + if (FLOAT_MODE_P (mode) && flag_associative_math && GET_CODE (XEXP (x, 0)) == DIV) { rtx tem = simplify_binary_operation (MULT, mode, @@ -10175,7 +10175,7 @@ recog_for_combine (rtx *pnewpat, rtx insn, rtx *pnotes) if (REG_P (XEXP (XVECEXP (newpat, 0, i), 0)) && ! reg_dead_at_p (XEXP (XVECEXP (newpat, 0, i), 0), insn)) return -1; - if (GET_CODE (XEXP (XVECEXP (newpat, 0, i), 0)) != SCRATCH) + if (GET_CODE (XEXP (XVECEXP (newpat, 0, i), 0)) != SCRATCH) { gcc_assert (REG_P (XEXP (XVECEXP (newpat, 0, i), 0))); notes = alloc_reg_note (REG_UNUSED, -- cgit v1.2.1 From b572c3c961eadd3a7dc0fbdbf938d595816e61e2 Mon Sep 17 00:00:00 2001 From: daney Date: Fri, 4 Dec 2009 17:46:23 +0000 Subject: 2009-12-04 David Daney PR rtl-optimization/42164 * combine.c (combine_simplify_rtx): Handle truncation of integer constants. 2009-12-04 David Daney PR rtl-optimization/42164 * gcc.c-torture/compile/pr42164.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154987 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index cdc677d17c7..7f3f6da2cea 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -5156,6 +5156,10 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest) force_to_mode (XEXP (x, 0), GET_MODE (XEXP (x, 0)), GET_MODE_MASK (mode), 0)); + /* We can truncate a constant value and return it. */ + if (CONST_INT_P (XEXP (x, 0))) + return gen_int_mode (INTVAL (XEXP (x, 0)), mode); + /* Similarly to what we do in simplify-rtx.c, a truncate of a register whose value is a comparison can be replaced with a subreg if STORE_FLAG_VALUE permits. */ -- cgit v1.2.1 From 6bc22037d281047903ea5c187540b7469f4fc176 Mon Sep 17 00:00:00 2001 From: rth Date: Tue, 8 Dec 2009 00:44:28 +0000 Subject: PR rtl-opt/42269 * combine.c (setup_incoming_promotions): Improve the conditions under which we respect the promotions applied. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155071 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 7f3f6da2cea..f26b9e50abc 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -1377,19 +1377,23 @@ setup_incoming_promotions (rtx first) /* Eliminate sign extensions in the callee when possible. Only do this when: - (a) a mode promotion has occurred; - (b) the mode of the register is the same as the mode of + (a) A mode promotion has occurred; + (b) The mode of the register is the same as the mode of the argument as it is passed; and - (c) the signedness does not change across any of the promotions; and - (d) when no language-level promotions (which we cannot guarantee + (c) Either there's no language level extension, or the extension + from source to end result is valid. The later case is true + when the signedness of the extensions match, or when the + language level extension is unsigned. In the later case, + a zero extension followed by a sign extension is the same + as one big zero extension. + (d) When no language-level promotions (which we cannot guarantee will have been done by an external caller) are necessary, unless we know that this function is only ever called from the current compilation unit -- all of whose call sites will do the mode1 --> mode2 promotion. */ if (mode1 != mode3 && mode3 == mode4 - && uns1 == uns3 - && (mode1 == mode2 || strictly_local)) + && (mode1 == mode2 || ((uns1 || !uns3) && strictly_local))) { /* Record that the value was promoted from mode1 to mode3, so that any sign extension at the head of the current -- cgit v1.2.1 From 9b8af75b6ab1680c69df8fe34d5c51cdc5f713a7 Mon Sep 17 00:00:00 2001 From: rth Date: Tue, 8 Dec 2009 23:39:20 +0000 Subject: * combine.c (setup_incoming_promotions): Fix sign-extend of zero-extend case; tidy conditions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155095 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 62 +++++++++++++++++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 29 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index f26b9e50abc..2c60ae5640f 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -1343,7 +1343,7 @@ setup_incoming_promotions (rtx first) for (arg = DECL_ARGUMENTS (current_function_decl); arg; arg = TREE_CHAIN (arg)) { - rtx reg = DECL_INCOMING_RTL (arg); + rtx x, reg = DECL_INCOMING_RTL (arg); int uns1, uns3; enum machine_mode mode1, mode2, mode3, mode4; @@ -1375,34 +1375,38 @@ setup_incoming_promotions (rtx first) /* The mode of the register in which the argument is being passed. */ mode4 = GET_MODE (reg); - /* Eliminate sign extensions in the callee when possible. Only - do this when: - (a) A mode promotion has occurred; - (b) The mode of the register is the same as the mode of - the argument as it is passed; and - (c) Either there's no language level extension, or the extension - from source to end result is valid. The later case is true - when the signedness of the extensions match, or when the - language level extension is unsigned. In the later case, - a zero extension followed by a sign extension is the same - as one big zero extension. - (d) When no language-level promotions (which we cannot guarantee - will have been done by an external caller) are necessary, - unless we know that this function is only ever called from - the current compilation unit -- all of whose call sites will - do the mode1 --> mode2 promotion. */ - if (mode1 != mode3 - && mode3 == mode4 - && (mode1 == mode2 || ((uns1 || !uns3) && strictly_local))) - { - /* Record that the value was promoted from mode1 to mode3, - so that any sign extension at the head of the current - function may be eliminated. */ - rtx x; - x = gen_rtx_CLOBBER (mode1, const0_rtx); - x = gen_rtx_fmt_e ((uns3 ? ZERO_EXTEND : SIGN_EXTEND), mode3, x); - record_value_for_reg (reg, first, x); - } + /* Eliminate sign extensions in the callee when: + (a) A mode promotion has occurred; */ + if (mode1 == mode3) + continue; + /* (b) The mode of the register is the same as the mode of + the argument as it is passed; */ + if (mode3 != mode4) + continue; + /* (c) There's no language level extension; */ + if (mode1 == mode2) + ; + /* (c.1) All callers are from the current compilation unit. If that's + the case we don't have to rely on an ABI, we only have to know + what we're generating right now, and we know that we will do the + mode1 to mode2 promotion with the given sign. */ + else if (!strictly_local) + continue; + /* (c.2) The combination of the two promotions is useful. This is + true when the signs match, or if the first promotion is unsigned. + In the later case, (sign_extend (zero_extend x)) is the same as + (zero_extend (zero_extend x)), so make sure to force UNS3 true. */ + else if (uns1) + uns3 = true; + else if (uns3) + continue; + + /* Record that the value was promoted from mode1 to mode3, + so that any sign extension at the head of the current + function may be eliminated. */ + x = gen_rtx_CLOBBER (mode1, const0_rtx); + x = gen_rtx_fmt_e ((uns3 ? ZERO_EXTEND : SIGN_EXTEND), mode3, x); + record_value_for_reg (reg, first, x); } } -- cgit v1.2.1 From 2811363aeb7014c7966c2fcbb5e9f29d4b3c60bf Mon Sep 17 00:00:00 2001 From: jakub Date: Wed, 23 Dec 2009 17:04:07 +0000 Subject: PR rtl-optimization/42475 * combine.c (make_compound_operation) : Use mode of SUBREG_REG (x) instead of tem's mode. * gcc.dg/pr42475.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155430 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 2c60ae5640f..5ae557c180a 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -7306,15 +7306,14 @@ make_compound_operation (rtx x, enum rtx_code in_code) tem = make_compound_operation (SUBREG_REG (x), in_code); { - rtx simplified; - simplified = simplify_subreg (GET_MODE (x), tem, GET_MODE (tem), - SUBREG_BYTE (x)); + rtx simplified = simplify_subreg (mode, tem, GET_MODE (SUBREG_REG (x)), + SUBREG_BYTE (x)); if (simplified) tem = simplified; if (GET_CODE (tem) != GET_CODE (SUBREG_REG (x)) - && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (tem)) + && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))) && subreg_lowpart_p (x)) { rtx newer = force_to_mode (tem, mode, ~(HOST_WIDE_INT) 0, -- cgit v1.2.1 From 18e71d34911801ccd2019cbf4aa6c185d4b706bb Mon Sep 17 00:00:00 2001 From: jingyu Date: Fri, 15 Jan 2010 18:47:45 +0000 Subject: 2010-01-15 Jing Yu PR rtl-optimization/42691 * combine.c (try_combine): Set changed_i3_dest to 1 when I2 and I3 set a pseudo to a constant and are merged, and adjust comments. 2010-01-15 Jing Yu PR rtl-optimization/42691 * gcc.c-torture/execute/pr42691.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155944 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 5ae557c180a..e5d4c5aafc2 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2663,10 +2663,16 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) i2dest = SET_DEST (temp); i2dest_killed = dead_or_set_p (i2, i2dest); + /* Replace the source in I2 with the new constant and make the + resulting insn the new pattern for I3. Then skip to where we + validate the pattern. Everything was set up above. */ SUBST (SET_SRC (temp), immed_double_const (olo, ohi, GET_MODE (SET_DEST (temp)))); newpat = PATTERN (i2); + + /* The dest of I3 has been replaced with the dest of I2. */ + changed_i3_dest = 1; goto validate_replacement; } } @@ -3038,8 +3044,6 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) } } - /* We come here when we are replacing a destination in I2 with the - destination of I3. */ validate_replacement: /* Note which hard regs this insn has as inputs. */ -- cgit v1.2.1 From 9b464fe51fcd8443d5c62831df4ae3e9b8eee627 Mon Sep 17 00:00:00 2001 From: jingyu Date: Fri, 15 Jan 2010 21:38:20 +0000 Subject: Revert revision 155944 due to the broken testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155946 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index e5d4c5aafc2..5ae557c180a 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2663,16 +2663,10 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) i2dest = SET_DEST (temp); i2dest_killed = dead_or_set_p (i2, i2dest); - /* Replace the source in I2 with the new constant and make the - resulting insn the new pattern for I3. Then skip to where we - validate the pattern. Everything was set up above. */ SUBST (SET_SRC (temp), immed_double_const (olo, ohi, GET_MODE (SET_DEST (temp)))); newpat = PATTERN (i2); - - /* The dest of I3 has been replaced with the dest of I2. */ - changed_i3_dest = 1; goto validate_replacement; } } @@ -3044,6 +3038,8 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) } } + /* We come here when we are replacing a destination in I2 with the + destination of I3. */ validate_replacement: /* Note which hard regs this insn has as inputs. */ -- cgit v1.2.1 From 92c624a375e7b7a3af1cc5da0a473bacdf046692 Mon Sep 17 00:00:00 2001 From: jingyu Date: Fri, 15 Jan 2010 21:54:01 +0000 Subject: 2010-01-15 Jing Yu PR rtl-optimization/42691 * combine.c (try_combine): Set changed_i3_dest to 1 when I2 and I3 set a pseudo to a constant and are merged, and adjust comments. 2010-01-15 Jing Yu PR rtl-optimization/42691 * gcc.c-torture/execute/pr42691.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155948 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 5ae557c180a..e5d4c5aafc2 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2663,10 +2663,16 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) i2dest = SET_DEST (temp); i2dest_killed = dead_or_set_p (i2, i2dest); + /* Replace the source in I2 with the new constant and make the + resulting insn the new pattern for I3. Then skip to where we + validate the pattern. Everything was set up above. */ SUBST (SET_SRC (temp), immed_double_const (olo, ohi, GET_MODE (SET_DEST (temp)))); newpat = PATTERN (i2); + + /* The dest of I3 has been replaced with the dest of I2. */ + changed_i3_dest = 1; goto validate_replacement; } } @@ -3038,8 +3044,6 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) } } - /* We come here when we are replacing a destination in I2 with the - destination of I3. */ validate_replacement: /* Note which hard regs this insn has as inputs. */ -- cgit v1.2.1 From 35af01889aa8a9281e2c7addfedfaae568822c75 Mon Sep 17 00:00:00 2001 From: jakub Date: Tue, 16 Mar 2010 10:50:42 +0000 Subject: PR debug/43051 PR debug/43092 * cselib.c (cselib_preserve_constants, cfa_base_preserved_val): New static variables. (preserve_only_constants): New function. (cselib_reset_table): If cfa_base_preserved_val is non-NULL, don't clear its REG_VALUES. If cselib_preserve_constants, don't empty the whole hash table, but preserve there VALUEs with constants, cfa_base_preserved_val and cfa_base_preserved_val plus constant. (cselib_preserve_cfa_base_value): New function. (cselib_invalidate_regno): Don't invalidate cfa_base_preserved_val. (cselib_init): Change argument to int bitfield. Set cselib_preserve_constants to whether CSELIB_PRESERVE_CONSTANTS is in it. (cselib_finish): Clear cselib_preserve_constants and cfa_base_preserved_val. * cselib.h (enum cselib_record_what): New enum. (cselib_init): Change argument to int. (cselib_preserve_cfa_base_value): New prototype. * postreload.c (reload_cse_regs_1): Adjust cselib_init caller. * dse.c (dse_step1): Likewise. * cfgcleanup.c (thread_jump): Likewise. * sched-deps.c (sched_analyze): Likewise. * gcse.c (local_cprop_pass): Likewise. * simplify-rtx.c (simplify_replace_fn_rtx): Add argument to callback. If FN is non-NULL, call the callback always and whenever it returns non-NULL just return that. Only do rtx_equal_p if FN is NULL. * rtl.h (simplify_replace_fn_rtx): Add argument to callback. * combine.c (propagate_for_debug_subst): Add old_rtx argument, compare from with old_rtx and if it isn't rtx_equal_p, return NULL. * Makefile.in (var-tracking.o): Depend on $(RECOG_H). * var-tracking.c: Include recog.h. (bb_stack_adjust_offset): Remove. (vt_stack_adjustments): Don't call it, instead just gather the adjustments using insn_stack_adjust_offset_pre_post on each bb insn. (adjust_stack_reference): Remove. (compute_cfa_pointer): New function. (hard_frame_pointer_adjustment, cfa_base_rtx): New static variables. (struct adjust_mem_data): New type. (adjust_mems, adjust_mem_uses, adjust_mem_stores, adjust_insn): New functions. (get_address_mode): New function. (replace_expr_with_values): Use it. (use_type): Don't do cselib_lookup for VAR_LOC_UNKNOWN_P. Use get_address_mode. For cfa_base_rtx return MO_CLOBBER. (adjust_sets): Remove. (add_uses): Don't add extra MO_VAL_USE for cfa_base_rtx plus constant. Use get_address_mode. (get_adjusted_src): Remove. (add_stores): Don't call it. Never reuse expr SET. Don't add extra MO_VAL_USE for cfa_base_rtx plus constant. Use get_address_mode. (add_with_sets): Don't call adjust_sets. (fp_setter, vt_init_cfa_base): New functions. (vt_initialize): Change return type to bool. Move most of pool etc. initialization to the beginning of the function from end. Pass CSELIB_RECORD_MEMORY | CSELIB_PRESERVE_CONSTANTS to cselib_init. If !frame_pointer_needed, call vt_stack_adjustment before mos vector is filled, call vt_init_cfa_base if argp/framep has been eliminated to sp. If frame_pointer_needed and argp/framep has been eliminated to hard frame pointer, set hard_frame_pointer_adjustment and call vt_init_cfa_base after encountering fp setter in the prologue. For MO_ADJUST, call log_op_type before pusing the op into mos vector, not afterwards. Call adjust_insn before cselib_process_insn/add_with_sets, call cancel_changes (0) afterwards. (variable_tracking_main_1): Adjust for vt_initialize calling vt_stack_adjustments and returning whether it succeeded or not. * gcc.dg/guality/pr43051-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157476 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index e5d4c5aafc2..f4f2fa06fdb 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -1,6 +1,6 @@ /* Optimize by combining instructions for GNU compiler. Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -2286,10 +2286,12 @@ struct rtx_subst_pair substituted. */ static rtx -propagate_for_debug_subst (rtx from ATTRIBUTE_UNUSED, void *data) +propagate_for_debug_subst (rtx from, const_rtx old_rtx, void *data) { struct rtx_subst_pair *pair = (struct rtx_subst_pair *)data; + if (!rtx_equal_p (from, old_rtx)) + return NULL_RTX; if (!pair->adjusted) { pair->adjusted = true; -- cgit v1.2.1 From 0895c53c41cfab6c1522b9b02ad9edb35b6724f2 Mon Sep 17 00:00:00 2001 From: rguenth Date: Sat, 20 Mar 2010 13:44:18 +0000 Subject: 2010-03-20 Richard Guenther PR rtl-optimization/43438 * combine.c (make_extraction): Properly zero-/sign-extend an extraction of the low part of a CONST_INT. Also handle CONST_DOUBLE. * gcc.c-torture/execute/pr43438.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157592 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index f4f2fa06fdb..a5240c99e97 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -6793,8 +6793,10 @@ make_extraction (enum machine_mode mode, rtx inner, HOST_WIDE_INT pos, if (mode == tmode) return new_rtx; - if (CONST_INT_P (new_rtx)) - return gen_int_mode (INTVAL (new_rtx), mode); + if (CONST_INT_P (new_rtx) + || GET_CODE (new_rtx) == CONST_DOUBLE) + return simplify_unary_operation (unsignedp ? ZERO_EXTEND : SIGN_EXTEND, + mode, new_rtx, tmode); /* If we know that no extraneous bits are set, and that the high bit is not set, convert the extraction to the cheaper of -- cgit v1.2.1 From b420d71b710029cfd2ba17724a485cedf1edd91d Mon Sep 17 00:00:00 2001 From: bonzini Date: Sun, 25 Apr 2010 07:52:43 +0000 Subject: 2010-04-25 Paolo Bonzini * combine.c (find_split_point): Add third argument. Use it to find nested multiply-accumulate instructions. Adjust calls. (try_combine): Adjust call to find_split_point. testsuite: 2010-04-25 Paolo Bonzini * gcc.target/arm/mla-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158698 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index a5240c99e97..0c934457d26 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -391,7 +391,7 @@ static int contains_muldiv (rtx); static rtx try_combine (rtx, rtx, rtx, int *); static void undo_all (void); static void undo_commit (void); -static rtx *find_split_point (rtx *, rtx); +static rtx *find_split_point (rtx *, rtx, bool); static rtx subst (rtx, rtx, rtx, int, int); static rtx combine_simplify_rtx (rtx, enum machine_mode, int); static rtx simplify_if_then_else (rtx); @@ -3267,7 +3267,8 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) /* If we can split it and use I2DEST, go ahead and see if that helps things be recognized. Verify that none of the registers are set between I2 and I3. */ - if (insn_code_number < 0 && (split = find_split_point (&newpat, i3)) != 0 + if (insn_code_number < 0 + && (split = find_split_point (&newpat, i3, false)) != 0 #ifdef HAVE_cc0 && REG_P (i2dest) #endif @@ -4144,7 +4145,7 @@ undo_commit (void) two insns. */ static rtx * -find_split_point (rtx *loc, rtx insn) +find_split_point (rtx *loc, rtx insn, bool set_src) { rtx x = *loc; enum rtx_code code = GET_CODE (x); @@ -4164,7 +4165,7 @@ find_split_point (rtx *loc, rtx insn) if (MEM_P (SUBREG_REG (x))) return loc; #endif - return find_split_point (&SUBREG_REG (x), insn); + return find_split_point (&SUBREG_REG (x), insn, false); case MEM: #ifdef HAVE_lo_sum @@ -4281,12 +4282,12 @@ find_split_point (rtx *loc, rtx insn) #endif /* See if we can split SET_SRC as it stands. */ - split = find_split_point (&SET_SRC (x), insn); + split = find_split_point (&SET_SRC (x), insn, true); if (split && split != &SET_SRC (x)) return split; /* See if we can split SET_DEST as it stands. */ - split = find_split_point (&SET_DEST (x), insn); + split = find_split_point (&SET_DEST (x), insn, false); if (split && split != &SET_DEST (x)) return split; @@ -4330,7 +4331,7 @@ find_split_point (rtx *loc, rtx insn) SUBST (SET_DEST (x), dest); - split = find_split_point (&SET_SRC (x), insn); + split = find_split_point (&SET_SRC (x), insn, true); if (split && split != &SET_SRC (x)) return split; } @@ -4366,7 +4367,7 @@ find_split_point (rtx *loc, rtx insn) if (extraction != 0) { SUBST (SET_SRC (x), extraction); - return find_split_point (loc, insn); + return find_split_point (loc, insn, false); } } break; @@ -4388,7 +4389,7 @@ find_split_point (rtx *loc, rtx insn) XEXP (SET_SRC (x), 0), GEN_INT (pos)))); - split = find_split_point (&SET_SRC (x), insn); + split = find_split_point (&SET_SRC (x), insn, true); if (split && split != &SET_SRC (x)) return split; } @@ -4447,7 +4448,7 @@ find_split_point (rtx *loc, rtx insn) GEN_INT (pos)), GEN_INT (((HOST_WIDE_INT) 1 << len) - 1))); - split = find_split_point (&SET_SRC (x), insn); + split = find_split_point (&SET_SRC (x), insn, true); if (split && split != &SET_SRC (x)) return split; } @@ -4462,7 +4463,7 @@ find_split_point (rtx *loc, rtx insn) - len - pos)), GEN_INT (GET_MODE_BITSIZE (mode) - len))); - split = find_split_point (&SET_SRC (x), insn); + split = find_split_point (&SET_SRC (x), insn, true); if (split && split != &SET_SRC (x)) return split; } @@ -4502,7 +4503,7 @@ find_split_point (rtx *loc, rtx insn) GET_MODE (x), XEXP (XEXP (x, 0), 0), XEXP (XEXP (x, 1), 0)))); - return find_split_point (loc, insn); + return find_split_point (loc, insn, set_src); } /* Many RISC machines have a large set of logical insns. If the @@ -4516,6 +4517,14 @@ find_split_point (rtx *loc, rtx insn) } break; + case PLUS: + case MINUS: + /* Split at a multiply-accumulate instruction. However if this is + the SET_SRC, we likely do not have such an instruction and it's + worthless to try this split. */ + if (!set_src && GET_CODE (XEXP (x, 0)) == MULT) + return loc; + default: break; } @@ -4525,7 +4534,7 @@ find_split_point (rtx *loc, rtx insn) { case RTX_BITFIELD_OPS: /* This is ZERO_EXTRACT and SIGN_EXTRACT. */ case RTX_TERNARY: - split = find_split_point (&XEXP (x, 2), insn); + split = find_split_point (&XEXP (x, 2), insn, false); if (split) return split; /* ... fall through ... */ @@ -4533,7 +4542,7 @@ find_split_point (rtx *loc, rtx insn) case RTX_COMM_ARITH: case RTX_COMPARE: case RTX_COMM_COMPARE: - split = find_split_point (&XEXP (x, 1), insn); + split = find_split_point (&XEXP (x, 1), insn, false); if (split) return split; /* ... fall through ... */ @@ -4543,7 +4552,7 @@ find_split_point (rtx *loc, rtx insn) if (GET_CODE (x) != AND && GET_CODE (XEXP (x, 0)) == AND) return &XEXP (x, 0); - split = find_split_point (&XEXP (x, 0), insn); + split = find_split_point (&XEXP (x, 0), insn, false); if (split) return split; return loc; -- cgit v1.2.1 From e1ce1485c85cf2ea659a92ccddf9305fc2ff3c00 Mon Sep 17 00:00:00 2001 From: aesok Date: Sun, 2 May 2010 10:49:10 +0000 Subject: * target.h (struct calls): Add function_value_regno_p field. * target-def.h (TARGET_FUNCTION_VALUE_REGNO_P): Define. (TARGET_INITIALIZER): Use TARGET_FUNCTION_VALUE_REGNO_P. * targhooks.c (default_function_value_regno_p): New function. * targhooks.h (default_function_value_regno_p): Declare function. * rtlanal.c (keep_with_call_p): Use function_value_regno_p hook. * builtins.c. (apply_result_size): (Ditto.). * combine.c. (likely_spilled_retval_p): (Ditto.). * mode-switching.c. Include 'target.h'. (create_pre_exit): Use function_value_regno_p hook. * Makefile.in (mode-switching.o): Add dependency on TARGET_H. * doc/tm.texi (FUNCTION_VALUE_REGNO_P, TARGET_FUNCTION_VALUE_REGNO_P): Revise documentation. * config/i386/i386.h (TARGET_FUNCTION_VALUE_REGNO_P): Remove macro. * config/i386/i386.c (TARGET_FUNCTION_VALUE_REGNO_P): Define macro. (ix86_function_value_regno_p): Declare as static, change argument type to const unsigned int. * config/i386/i386-protos.h (ix86_function_value_regno_p): Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158970 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 0c934457d26..303f180f790 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2076,14 +2076,14 @@ likely_spilled_retval_p (rtx insn) unsigned regno, nregs; /* We assume here that no machine mode needs more than 32 hard registers when the value overlaps with a register - for which FUNCTION_VALUE_REGNO_P is true. */ + for which TARGET_FUNCTION_VALUE_REGNO_P is true. */ unsigned mask; struct likely_spilled_retval_info info; if (!NONJUMP_INSN_P (use) || GET_CODE (PATTERN (use)) != USE || insn == use) return 0; reg = XEXP (PATTERN (use), 0); - if (!REG_P (reg) || !FUNCTION_VALUE_REGNO_P (REGNO (reg))) + if (!REG_P (reg) || !targetm.calls.function_value_regno_p (REGNO (reg))) return 0; regno = REGNO (reg); nregs = hard_regno_nregs[regno][GET_MODE (reg)]; -- cgit v1.2.1 From 42a4b11f2cbed1a2af2157aff1b5ac2be08a78ad Mon Sep 17 00:00:00 2001 From: rsandifo Date: Wed, 19 May 2010 21:08:53 +0000 Subject: gcc/ * combine.c (propagate_for_debug): Call make_compound_operation on the source value. (try_combine): When implementing a split chosen by find_split_point, either copy i2src or set it to null. Assert that i2src is not null before substituting into CALL_INSN_FUNCTION_USAGE. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159600 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 303f180f790..8aa7e94a852 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2310,6 +2310,7 @@ static void propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src, bool move) { rtx next, move_pos = move ? last : NULL_RTX, loc; + bool first_p; #ifdef AUTO_INC_DEC struct rtx_subst_pair p; @@ -2318,6 +2319,7 @@ propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src, bool move) p.after = move; #endif + first_p = true; next = NEXT_INSN (insn); while (next != last) { @@ -2325,6 +2327,11 @@ propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src, bool move) next = NEXT_INSN (insn); if (DEBUG_INSN_P (insn)) { + if (first_p) + { + src = make_compound_operation (src, SET); + first_p = false; + } #ifdef AUTO_INC_DEC loc = simplify_replace_fn_rtx (INSN_VAR_LOCATION_LOC (insn), dest, propagate_for_debug_subst, &p); @@ -3294,6 +3301,14 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) i2scratch = true; + /* *SPLIT may be part of I2SRC, so make sure we have the + original expression around for later debug processing. + We should not need I2SRC any more in other cases. */ + if (MAY_HAVE_DEBUG_INSNS) + i2src = copy_rtx (i2src); + else + i2src = NULL; + /* Get NEWDEST as a register in the proper mode. We have already validated that we can do this. */ if (GET_MODE (i2dest) != split_mode && split_mode != VOIDmode) @@ -3790,7 +3805,13 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) call_usage = copy_rtx (call_usage); if (substed_i2) - replace_rtx (call_usage, i2dest, i2src); + { + /* I2SRC must still be meaningful at this point. Some splitting + operations can invalidate I2SRC, but those operations do not + apply to calls. */ + gcc_assert (i2src); + replace_rtx (call_usage, i2dest, i2src); + } if (substed_i1) replace_rtx (call_usage, i1dest, i1src); -- cgit v1.2.1 From a7a4626828090600459358ca745c4482cf9551a1 Mon Sep 17 00:00:00 2001 From: steven Date: Fri, 21 May 2010 13:53:22 +0000 Subject: gcc/ChangeLog: * tree.h: Include real.h and fixed-value.h as basic datatypes. * dfp.c, convert.c, reload1.c, reginfo.c, tree-flow.h, tree-ssa-threadedge.c, tree-ssanames.c, tree-loop-linear.c, tree-into-ssa.c, tree-vect-generic.c, tree-ssa-structalias.c, tree-ssa-loop-im.c, tree-dump.c, tree-complex.c, tree-ssa-uninit.c, genrecog.c, tree-ssa-threadupdate.c, tree-ssa-loop-niter.c, tree-pretty-print.c, tree-loop-distribution.c, tree-ssa-loop-unswitch.c, c-lex.c, optabs.c, postreload-gcse.c, tree-ssa-loop-manip.c, postreload.c, tree-ssa-loop-ch.c, tree-tailcall.c, tree.c, reload.c, tree-scalar-evolution.c, rtlanal.c, tree-phinodes.c, builtins.c, final.c, genoutput.c, fold-const.c, tree-ssa-dse.c, genautomata.c, tree-ssa-uncprop.c, toplev.c, tree-chrec.c, genemit.c, c-cppbuiltin.c, tree-ssa-sccvn.c, tree-ssa-ccp.c, tree-ssa-loop-ivopts.c, mode-switching.c, tree-call-cdce.c, cse.c, genpeep.c, tree-ssa-math-opts.c, tree-ssa-dom.c, tree-nrv.c, tree-ssa-propagate.c, tree-ssa-alias.c, tree-ssa-sink.c, jump.c, ifcvt.c, dwarf2out.c, expr.c, genattrtab.c, genconditions.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop.c, tree-parloops.c, recog.c, tree-ssa-address.c, lcm.c, tree-eh.c, gimple-pretty-print.c, c-pretty-print.c, print-rtl.c, gcse.c, tree-if-conv.c, tree-data-ref.c, tree-affine.c, gimplify.c, tree-ssa-phiopt.c, implicit-zee.c, expmed.c, tree-dfa.c, emit-rtl.c, store-motion.c, cselib.c, tree-cfgcleanup.c, simplify-rtx.c, tree-ssa-pre.c, genpreds.c, tree-mudflap.c, print-tree.c, tree-ssa-copy.c, tree-ssa-forwprop.c, tree-ssa-dce.c, varasm.c, tree-nested.c, tree-ssa.c, tree-ssa-loop-prefetch.c, rtl.c, tree-inline.c, integrate.c, tree-optimize.c, tree-ssa-phiprop.c, fixed-value.c, combine.c, tree-profile.c, c-common.c, sched-vis.c, tree-cfg.c, passes.c, tree-ssa-reassoc.c, config/alpha/alpha.c, config/frv/frv.c, config/s390/s390.c, config/m32c/m32c.c, config/spu/spu.c, config/sparc/sparc.c, config/mep/mep.c, config/m32r/m32r.c, config/rx/rx.c, config/i386/i386.c, config/sh/sh.c, config/pdp11/pdp11.c, config/avr/avr.c, config/crx/crx.c, config/xtensa/xtensa.c, config/stormy16/stormy16.c, config/fr30/fr30.c, config/lm32/lm32.c, config/moxie/moxie.c, config/m68hc11/m68hc11.c, config/cris/cris.c, config/iq2000/iq2000.c, config/mn10300/mn10300.c, config/ia64/ia64.c, config/m68k/m68k.c, config/rs6000/rs6000.c, config/picochip/picochip.c, config/darwin.c, config/arc/arc.c, config/mcore/mcore.c, config/score/score3.c, config/score/score7.c, config/score/score.c, config/arm/arm.c, config/pa/pa.c, config/mips/mips.c, config/vax/vax.c, config/h8300/h8300.c, config/v850/v850.c, config/mmix/mmix.c, config/bfin/bfin.c: Clean up redundant includes. * Makefile.in: Update accordingly. java/ChangeLog: * typeck.c, decl.c, jcf-parse.c, except.c, expr.c: cp/Changelog: * error.c, tree.c, typeck2.c, cxx-pretty-print.c, mangle.c: Clean up redundant includes. fortran/ChangeLog: * trans-const.c, trans-types.c, trans-intrinsic.c: Clean up redundant includes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159663 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 1 - 1 file changed, 1 deletion(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 8aa7e94a852..2e81efcb027 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -92,7 +92,6 @@ along with GCC; see the file COPYING3. If not see #include "expr.h" #include "insn-attr.h" #include "recog.h" -#include "real.h" #include "toplev.h" #include "target.h" #include "optabs.h" -- cgit v1.2.1 From d817d01d7fc755bdccd5d40f679be086b9ebf592 Mon Sep 17 00:00:00 2001 From: aesok Date: Tue, 25 May 2010 19:48:40 +0000 Subject: * double-int.h (double_int_and): New. * combine.c (try_combine): Clean up, use double_int_* and immed_double_int_const functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159842 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 74 ++++++++--------------------------------------------------- 1 file changed, 10 insertions(+), 64 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 2e81efcb027..9809565a77c 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2595,74 +2595,20 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) if (offset >= 0 && (GET_MODE_BITSIZE (GET_MODE (SET_DEST (temp))) - <= HOST_BITS_PER_WIDE_INT * 2)) + <= HOST_BITS_PER_DOUBLE_INT)) { - HOST_WIDE_INT mhi, ohi, ihi; - HOST_WIDE_INT mlo, olo, ilo; + double_int m, o, i; rtx inner = SET_SRC (PATTERN (i3)); rtx outer = SET_SRC (temp); - if (CONST_INT_P (outer)) - { - olo = INTVAL (outer); - ohi = olo < 0 ? -1 : 0; - } - else - { - olo = CONST_DOUBLE_LOW (outer); - ohi = CONST_DOUBLE_HIGH (outer); - } - - if (CONST_INT_P (inner)) - { - ilo = INTVAL (inner); - ihi = ilo < 0 ? -1 : 0; - } - else - { - ilo = CONST_DOUBLE_LOW (inner); - ihi = CONST_DOUBLE_HIGH (inner); - } - - if (width < HOST_BITS_PER_WIDE_INT) - { - mlo = ((unsigned HOST_WIDE_INT) 1 << width) - 1; - mhi = 0; - } - else if (width < HOST_BITS_PER_WIDE_INT * 2) - { - mhi = ((unsigned HOST_WIDE_INT) 1 - << (width - HOST_BITS_PER_WIDE_INT)) - 1; - mlo = -1; - } - else - { - mlo = -1; - mhi = -1; - } - - ilo &= mlo; - ihi &= mhi; - - if (offset >= HOST_BITS_PER_WIDE_INT) - { - mhi = mlo << (offset - HOST_BITS_PER_WIDE_INT); - mlo = 0; - ihi = ilo << (offset - HOST_BITS_PER_WIDE_INT); - ilo = 0; - } - else if (offset > 0) - { - mhi = (mhi << offset) | ((unsigned HOST_WIDE_INT) mlo - >> (HOST_BITS_PER_WIDE_INT - offset)); - mlo = mlo << offset; - ihi = (ihi << offset) | ((unsigned HOST_WIDE_INT) ilo - >> (HOST_BITS_PER_WIDE_INT - offset)); - ilo = ilo << offset; - } + o = rtx_to_double_int (outer); + i = rtx_to_double_int (inner); - olo = (olo & ~mlo) | ilo; - ohi = (ohi & ~mhi) | ihi; + m = double_int_mask (width); + i = double_int_and (i, m); + m = double_int_lshift (m, offset, HOST_BITS_PER_DOUBLE_INT, false); + i = double_int_lshift (i, offset, HOST_BITS_PER_DOUBLE_INT, false); + o = double_int_ior (double_int_and (o, double_int_not (m)), i); combine_merges++; subst_insn = i3; @@ -2675,7 +2621,7 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) resulting insn the new pattern for I3. Then skip to where we validate the pattern. Everything was set up above. */ SUBST (SET_SRC (temp), - immed_double_const (olo, ohi, GET_MODE (SET_DEST (temp)))); + immed_double_int_const (o, GET_MODE (SET_DEST (temp)))); newpat = PATTERN (i2); -- cgit v1.2.1 From cbeb677e2ce01e4bae1d9af26ac91d9eb839507d Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Tue, 25 May 2010 22:34:36 +0000 Subject: * function.h (struct function): Add can_throw_non_call_exceptions bit. * lto-streamer-in.c (input_function): Stream it in. * lto-streamer-out.c (output_function): Stream it out. * function.c (allocate_struct_function): Set it. (expand_function_end): Substitute cfun->can_throw_non_call_exceptions for flag_non_call_exceptions. * cfgbuild.c (control_flow_insn_p): Likewise. (make_edges): Likewise. * cfgexpand.c (expand_stack_alignment): Likewise. * combine.c (distribute_notes): Likewise. * cse.c (cse_extended_basic_block): Likewise. * except.c (insn_could_throw_p): Likewise. * gcse.c (simple_mem): Likewise. * ipa-pure-const.c (check_call): Likewise. (check_stmt ): Likewise. * lower-subreg.c (lower-subreg.c): Likewise. * optabs.c (emit_libcall_block): Likewise. (prepare_cmp_insn): Likewise. * postreload-gcse.c (eliminate_partially_redundant_loads): Likewise. * postreload.c (rest_of_handle_postreload): Likewise. * reload1.c (reload_as_needed): Likewise. (emit_input_reload_insns): Likewise. (emit_output_reload_insns): Likewise. (fixup_abnormal_edges): Likewise. * sel-sched-ir.c (init_global_and_expr_for_insn): Likewise. * store-motion.c (find_moveable_store): Likewise. * tree-eh.c (stmt_could_throw_p): Likewise. (tree_could_throw_p): Likewise. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Likewise. * config/arm/arm.c (arm_expand_prologue): Likewise. (thumb1_expand_prologue): Likewise. * config/rx/rx.md (cbranchsf4): Likewise. (cmpsf): Likewise. * config/s390/s390.c (s390_emit_prologue): Likewise. * tree-inline.c (initialize_cfun): Copy can_throw_non_call_exceptions. (inline_forbidden_into_p): New predicate. (expand_call_inline): Use it to forbid inlining. (tree_can_inline_p): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159847 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 9809565a77c..e9389d7b2b7 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -12734,7 +12734,7 @@ distribute_notes (rtx notes, rtx from_insn, rtx i3, rtx i2, rtx elim_i2, place = i2; else { - gcc_assert (flag_non_call_exceptions); + gcc_assert (cfun->can_throw_non_call_exceptions); if (may_trap_p (i3)) place = i3; else if (i2 && may_trap_p (i2)) -- cgit v1.2.1 From 547a09b3eee8d0b6b6c604ee52cd0754915e0d4c Mon Sep 17 00:00:00 2001 From: jakub Date: Thu, 27 May 2010 22:08:41 +0000 Subject: PR bootstrap/44255 * combine.c (struct rtx_subst_pair): Define unconditionally. (propagate_for_debug_subst): Likewise. If not AUTO_INC_DEC, copy_rtx pair->to instead of cleanup_auto_inc_dec it. Call make_compound_operation on pair->to. (propagate_for_debug): Don't call make_compound_operation here. Always use simplify_replace_fn_rtx. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159952 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index e9389d7b2b7..1bee2c7f422 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2271,6 +2271,7 @@ cleanup_auto_inc_dec (rtx src, bool after, enum machine_mode mem_mode) return x; } +#endif /* Auxiliary data structure for propagate_for_debug_stmt. */ @@ -2294,12 +2295,16 @@ propagate_for_debug_subst (rtx from, const_rtx old_rtx, void *data) if (!pair->adjusted) { pair->adjusted = true; +#ifdef AUTO_INC_DEC pair->to = cleanup_auto_inc_dec (pair->to, pair->after, VOIDmode); +#else + pair->to = copy_rtx (pair->to); +#endif + pair->to = make_compound_operation (pair->to, SET); return pair->to; } return copy_rtx (pair->to); } -#endif /* Replace occurrences of DEST with SRC in DEBUG_INSNs between INSN and LAST. If MOVE holds, debug insns must also be moved past @@ -2309,16 +2314,12 @@ static void propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src, bool move) { rtx next, move_pos = move ? last : NULL_RTX, loc; - bool first_p; -#ifdef AUTO_INC_DEC struct rtx_subst_pair p; p.to = src; p.adjusted = false; p.after = move; -#endif - first_p = true; next = NEXT_INSN (insn); while (next != last) { @@ -2326,17 +2327,8 @@ propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src, bool move) next = NEXT_INSN (insn); if (DEBUG_INSN_P (insn)) { - if (first_p) - { - src = make_compound_operation (src, SET); - first_p = false; - } -#ifdef AUTO_INC_DEC loc = simplify_replace_fn_rtx (INSN_VAR_LOCATION_LOC (insn), dest, propagate_for_debug_subst, &p); -#else - loc = simplify_replace_rtx (INSN_VAR_LOCATION_LOC (insn), dest, src); -#endif if (loc == INSN_VAR_LOCATION_LOC (insn)) continue; INSN_VAR_LOCATION_LOC (insn) = loc; -- cgit v1.2.1 From b4b21cd0a5c705f3ed3d47c129866ced3d677071 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Tue, 29 Jun 2010 09:24:34 +0000 Subject: PR rtl-optimization/44659 * combine.c (make_compound_operation) : Do not return the result of force_to_mode if it partially re-expanded the compound. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161523 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 1bee2c7f422..d3305cb4abe 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -7277,22 +7277,21 @@ make_compound_operation (rtx x, enum rtx_code in_code) /* Call ourselves recursively on the inner expression. If we are narrowing the object and it has a different RTL code from what it originally did, do this SUBREG as a force_to_mode. */ - - tem = make_compound_operation (SUBREG_REG (x), in_code); - { - rtx simplified = simplify_subreg (mode, tem, GET_MODE (SUBREG_REG (x)), - SUBREG_BYTE (x)); + rtx inner = SUBREG_REG (x), simplified; + + tem = make_compound_operation (inner, in_code); + simplified + = simplify_subreg (mode, tem, GET_MODE (inner), SUBREG_BYTE (x)); if (simplified) tem = simplified; - if (GET_CODE (tem) != GET_CODE (SUBREG_REG (x)) - && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))) + if (GET_CODE (tem) != GET_CODE (inner) + && GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (inner)) && subreg_lowpart_p (x)) { - rtx newer = force_to_mode (tem, mode, ~(HOST_WIDE_INT) 0, - 0); + rtx newer = force_to_mode (tem, mode, ~(HOST_WIDE_INT) 0, 0); /* If we have something other than a SUBREG, we might have done an expansion, so rerun ourselves. */ @@ -7300,9 +7299,16 @@ make_compound_operation (rtx x, enum rtx_code in_code) newer = make_compound_operation (newer, in_code); /* force_to_mode can expand compounds. If it just re-expanded the - compound use gen_lowpart instead to convert to the desired - mode. */ - if (rtx_equal_p (newer, x)) + compound, use gen_lowpart to convert to the desired mode. */ + if (rtx_equal_p (newer, x) + /* Likewise if it re-expanded the compound only partially. + This happens for SUBREG of ZERO_EXTRACT if they extract + the same number of bits. */ + || (GET_CODE (newer) == SUBREG + && (GET_CODE (SUBREG_REG (newer)) == LSHIFTRT + || GET_CODE (SUBREG_REG (newer)) == ASHIFTRT) + && GET_CODE (inner) == AND + && rtx_equal_p (SUBREG_REG (newer), XEXP (inner, 0)))) return gen_lowpart (GET_MODE (x), tem); return newer; -- cgit v1.2.1 From 0b205f4ca112a643f4f1b9c9886648b569e0b380 Mon Sep 17 00:00:00 2001 From: manu Date: Thu, 8 Jul 2010 04:22:54 +0000 Subject: =?UTF-8?q?2010-07-08=20=20Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez=20?= =?UTF-8?q?=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * toplev.h: Do not include diagnostic-core.h. Include diagnostic-core.h in every file that includes toplev.h. * c-tree.h: Do not include toplev.h. * pretty-print.h: Update comment. * Makefile.in: Update dependencies. * alias.c: Include diagnostic-core.h in every file that includes toplev.h. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgbuild.c: Likewise. * cfgcleanup.c: Likewise. * cfghooks.c: Likewise. * cfgloop.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arc/arc.c: Likewise. * config/arm/arm.c: Likewise. * config/arm/pe.c: Likewise. * config/avr/avr.c: Likewise. * config/bfin/bfin.c: Likewise. * config/cris/cris.c: Likewise. * config/crx/crx.c: Likewise. * config/darwin-c.c: Likewise. * config/darwin.c: Likewise. * config/fr30/fr30.c: Likewise. * config/frv/frv.c: Likewise. * config/h8300/h8300.c: Likewise. * config/host-darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/netware.c: Likewise. * config/i386/nwld.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/i386/winnt-stubs.c: Likewise. * config/i386/winnt.c: Likewise. * config/ia64/ia64-c.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/lm32/lm32.c: Likewise. * config/m32c/m32c-pragma.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32r/m32r.c: Likewise. * config/m68hc11/m68hc11.c: Likewise. * config/m68k/m68k.c: Likewise. * config/mcore/mcore.c: Likewise. * config/mep/mep-pragma.c: Likewise. * config/mep/mep.c: Likewise. * config/mmix/mmix.c: Likewise. * config/mn10300/mn10300.c: Likewise. * config/moxie/moxie.c: Likewise. * config/pa/pa.c: Likewise. * config/pdp11/pdp11.c: Likewise. * config/picochip/picochip.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/s390/s390.c: Likewise. * config/score/score.c: Likewise. * config/score/score3.c: Likewise. * config/score/score7.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-base.c: Likewise. * config/sh/symbian-c.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sol2-c.c: Likewise. * config/sol2.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/v850/v850-c.c: Likewise. * config/v850/v850.c: Likewise. * config/vax/vax.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * convert.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbxout.c: Likewise. * ddg.c: Likewise. * dominance.c: Likewise. * emit-rtl.c: Likewise. * explow.c: Likewise. * expmed.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * fwprop.c: Likewise. * gcse.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * gimple-low.c: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * haifa-sched.c: Likewise. * ifcvt.c: Likewise. * implicit-zee.c: Likewise. * integrate.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-iv.c: Likewise. * lto-opts.c: Likewise. * lto-symtab.c: Likewise. * main.c: Likewise. * modulo-sched.c: Likewise. * optabs.c: Likewise. * params.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * profile.c: Likewise. * real.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtlanal.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * simplify-rtx.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * targhooks.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-inline.c: Likewise. * tree-nomudflap.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-phinodes.c: Likewise. * tree-profile.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vrp.c: Likewise. * varasm.c: Likewise. * vec.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. c-family/ * c-common.h: Include diagnostic-core.h. Error if already included. * c-semantics.c: Do not define GCC_DIAG_STYLE here. cp/ * cp-tree.h: Do not include toplev.h. java/ * boehm.c: Include diagnostic-core.h in every file that includes toplev.h. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. ada/ * gcc-interface/utils.c: Include diagnostic-core.h in every file that includes toplev.h. lto/ * lto-coff.c: Include diagnostic-core.h in every file that includes toplev.h. * lto-elf.c: Likewise. * lto-lang.c: Likewise. * lto-macho.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161943 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index d3305cb4abe..4dcb6cef5ca 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -92,6 +92,7 @@ along with GCC; see the file COPYING3. If not see #include "expr.h" #include "insn-attr.h" #include "recog.h" +#include "diagnostic-core.h" #include "toplev.h" #include "target.h" #include "optabs.h" -- cgit v1.2.1 From 1767a056f10a2ccbc900df04d01193da73a3d272 Mon Sep 17 00:00:00 2001 From: froydnj Date: Thu, 15 Jul 2010 14:31:28 +0000 Subject: gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162223 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/combine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/combine.c') diff --git a/gcc/combine.c b/gcc/combine.c index 4dcb6cef5ca..0a1e787cbb7 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -1341,7 +1341,7 @@ setup_incoming_promotions (rtx first) bool strictly_local = false; for (arg = DECL_ARGUMENTS (current_function_decl); arg; - arg = TREE_CHAIN (arg)) + arg = DECL_CHAIN (arg)) { rtx x, reg = DECL_INCOMING_RTL (arg); int uns1, uns3; -- cgit v1.2.1