diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-08-30 11:12:14 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-08-30 11:12:14 +0000 |
commit | 546513775069e93d5f33f7aae5f1cb26c77ca2c9 (patch) | |
tree | 8a383584e324e07a123acf20a153583961e949e9 /gcc/dwarf2out.c | |
parent | 095a49c86a8ac69b5dd6d78edf17b9e3803e5bf8 (diff) | |
download | gcc-546513775069e93d5f33f7aae5f1cb26c77ca2c9.zip gcc-546513775069e93d5f33f7aae5f1cb26c77ca2c9.tar.gz gcc-546513775069e93d5f33f7aae5f1cb26c77ca2c9.tar.bz2 |
[28/77] Use is_a <scalar_int_mode> for miscellaneous types of test
This patch adds is_a <scalar_int_mode> checks to various places
that were explicitly or implicitly restricted to integers already,
in cases where adding an explicit is_a <scalar_int_mode> is useful
for later patches.
In simplify_if_then_else, the:
GET_MODE (XEXP (XEXP (t, 0), N))
expressions were equivalent to:
GET_MODE (XEXP (t, 0))
due to the type of operation.
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* combine.c (sign_extend_short_imm): Add is_a <scalar_int_mode>
checks.
(try_combine): Likewise.
(simplify_if_then_else): Likewise.
* cse.c (cse_insn): Likewise.
* dwarf2out.c (mem_loc_descriptor): Likewise.
* emit-rtl.c (gen_lowpart_common): Likewise.
* simplify-rtx.c (simplify_truncation): Likewise.
(simplify_binary_operation_1): Likewise.
(simplify_const_relational_operation): Likewise.
(simplify_ternary_operation): Likewise.
* tree-ssa-loop-ivopts.c (force_expr_to_var_cost): Likewise.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r251480
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 7dd9f26..0637bdd 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -14824,31 +14824,29 @@ mem_loc_descriptor (rtx rtl, machine_mode mode, case SIGN_EXTEND: case ZERO_EXTEND: - if (!is_a <scalar_int_mode> (mode, &int_mode)) + if (!is_a <scalar_int_mode> (mode, &int_mode) + || !is_a <scalar_int_mode> (GET_MODE (XEXP (rtl, 0)), &inner_mode)) break; - op0 = mem_loc_descriptor (XEXP (rtl, 0), GET_MODE (XEXP (rtl, 0)), + op0 = mem_loc_descriptor (XEXP (rtl, 0), inner_mode, mem_mode, VAR_INIT_STATUS_INITIALIZED); if (op0 == 0) break; else if (GET_CODE (rtl) == ZERO_EXTEND && GET_MODE_SIZE (int_mode) <= DWARF2_ADDR_SIZE - && GET_MODE_BITSIZE (GET_MODE (XEXP (rtl, 0))) - < HOST_BITS_PER_WIDE_INT + && GET_MODE_BITSIZE (inner_mode) < HOST_BITS_PER_WIDE_INT /* If DW_OP_const{1,2,4}u won't be used, it is shorter to expand zero extend as two shifts instead of masking. */ - && GET_MODE_SIZE (GET_MODE (XEXP (rtl, 0))) <= 4) + && GET_MODE_SIZE (inner_mode) <= 4) { - machine_mode imode = GET_MODE (XEXP (rtl, 0)); mem_loc_result = op0; add_loc_descr (&mem_loc_result, - int_loc_descriptor (GET_MODE_MASK (imode))); + int_loc_descriptor (GET_MODE_MASK (inner_mode))); add_loc_descr (&mem_loc_result, new_loc_descr (DW_OP_and, 0, 0)); } else if (GET_MODE_SIZE (int_mode) <= DWARF2_ADDR_SIZE) { - int shift = DWARF2_ADDR_SIZE - - GET_MODE_SIZE (GET_MODE (XEXP (rtl, 0))); + int shift = DWARF2_ADDR_SIZE - GET_MODE_SIZE (inner_mode); shift *= BITS_PER_UNIT; if (GET_CODE (rtl) == SIGN_EXTEND) op = DW_OP_shra; @@ -14865,7 +14863,7 @@ mem_loc_descriptor (rtx rtl, machine_mode mode, dw_die_ref type_die1, type_die2; dw_loc_descr_ref cvt; - type_die1 = base_type_for_mode (GET_MODE (XEXP (rtl, 0)), + type_die1 = base_type_for_mode (inner_mode, GET_CODE (rtl) == ZERO_EXTEND); if (type_die1 == NULL) break; @@ -15410,14 +15408,15 @@ mem_loc_descriptor (rtx rtl, machine_mode mode, if (CONST_INT_P (XEXP (rtl, 1)) && CONST_INT_P (XEXP (rtl, 2)) && is_a <scalar_int_mode> (mode, &int_mode) + && is_a <scalar_int_mode> (GET_MODE (XEXP (rtl, 0)), &inner_mode) + && GET_MODE_SIZE (int_mode) <= DWARF2_ADDR_SIZE + && GET_MODE_SIZE (inner_mode) <= DWARF2_ADDR_SIZE && ((unsigned) INTVAL (XEXP (rtl, 1)) + (unsigned) INTVAL (XEXP (rtl, 2)) - <= GET_MODE_BITSIZE (int_mode)) - && GET_MODE_SIZE (int_mode) <= DWARF2_ADDR_SIZE - && GET_MODE_SIZE (GET_MODE (XEXP (rtl, 0))) <= DWARF2_ADDR_SIZE) + <= GET_MODE_BITSIZE (int_mode))) { int shift, size; - op0 = mem_loc_descriptor (XEXP (rtl, 0), GET_MODE (XEXP (rtl, 0)), + op0 = mem_loc_descriptor (XEXP (rtl, 0), inner_mode, mem_mode, VAR_INIT_STATUS_INITIALIZED); if (op0 == 0) break; @@ -15429,8 +15428,7 @@ mem_loc_descriptor (rtx rtl, machine_mode mode, size = INTVAL (XEXP (rtl, 1)); shift = INTVAL (XEXP (rtl, 2)); if (BITS_BIG_ENDIAN) - shift = GET_MODE_BITSIZE (GET_MODE (XEXP (rtl, 0))) - - shift - size; + shift = GET_MODE_BITSIZE (inner_mode) - shift - size; if (shift + size != (int) DWARF2_ADDR_SIZE) { add_loc_descr (&mem_loc_result, |