From c7ad039d8d75666f4f188a913033da36206503b8 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 30 Aug 2017 11:13:29 +0000 Subject: [35/77] Add uses of as_a This patch adds asserting as_a conversions to contexts in which the input is known to be a scalar integer mode. In expand_divmod, op1 is always a scalar_int_mode if op1_is_constant (but might not be otherwise). In expand_binop, the patch reverses a < comparison in order to avoid splitting a long line. gcc/ 2017-08-30 Richard Sandiford Alan Hayward David Sherwood * cfgexpand.c (convert_debug_memory_address): Use as_a . * combine.c (expand_compound_operation): Likewise. (make_extraction): Likewise. (change_zero_ext): Likewise. (simplify_comparison): Likewise. * cse.c (cse_insn): Likewise. * dwarf2out.c (minmax_loc_descriptor): Likewise. (mem_loc_descriptor): Likewise. (loc_descriptor): Likewise. * expmed.c (init_expmed_one_mode): Likewise. (synth_mult): Likewise. (emit_store_flag_1): Likewise. (expand_divmod): Likewise. Use HWI_COMPUTABLE_MODE_P instead of a comparison with size. * expr.c (expand_assignment): Use as_a . (reduce_to_bit_field_precision): Likewise. * function.c (expand_function_end): Likewise. * internal-fn.c (expand_arith_overflow_result_store): Likewise. * loop-doloop.c (doloop_modify): Likewise. * optabs.c (expand_binop): Likewise. (expand_unop): Likewise. (expand_copysign_absneg): Likewise. (prepare_cmp_insn): Likewise. (maybe_legitimize_operand): Likewise. * recog.c (const_scalar_int_operand): Likewise. * rtlanal.c (get_address_mode): Likewise. * simplify-rtx.c (simplify_unary_operation_1): Likewise. (simplify_cond_clz_ctz): Likewise. * tree-nested.c (get_nl_goto_field): Likewise. * tree.c (build_vector_type_for_mode): Likewise. * var-tracking.c (use_narrower_mode): Likewise. gcc/c-family/ 2017-08-30 Richard Sandiford Alan Hayward David Sherwood * c-common.c (c_common_type_for_mode): Use as_a . gcc/lto/ 2017-08-30 Richard Sandiford Alan Hayward David Sherwood * lto-lang.c (lto_type_for_mode): Use as_a . From-SVN: r251487 --- gcc/lto/lto-lang.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'gcc/lto/lto-lang.c') diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c index 375cdd1..eaf7933 100644 --- a/gcc/lto/lto-lang.c +++ b/gcc/lto/lto-lang.c @@ -941,15 +941,15 @@ lto_type_for_mode (machine_mode mode, int unsigned_p) if (mode == TYPE_MODE (void_type_node)) return void_type_node; - if (mode == TYPE_MODE (build_pointer_type (char_type_node))) - return (unsigned_p - ? make_unsigned_type (GET_MODE_PRECISION (mode)) - : make_signed_type (GET_MODE_PRECISION (mode))); - - if (mode == TYPE_MODE (build_pointer_type (integer_type_node))) - return (unsigned_p - ? make_unsigned_type (GET_MODE_PRECISION (mode)) - : make_signed_type (GET_MODE_PRECISION (mode))); + if (mode == TYPE_MODE (build_pointer_type (char_type_node)) + || mode == TYPE_MODE (build_pointer_type (integer_type_node))) + { + unsigned int precision + = GET_MODE_PRECISION (as_a (mode)); + return (unsigned_p + ? make_unsigned_type (precision) + : make_signed_type (precision)); + } if (COMPLEX_MODE_P (mode)) { -- cgit v1.1