From fffbab82e7fd15ef695159746a0ce7b9ac906778 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 30 Aug 2017 11:10:28 +0000 Subject: [17/77] Add an int_mode_for_size helper function This patch adds a wrapper around mode_for_size for cases in which the mode class is MODE_INT (the commonest case). The return type can then be an opt_scalar_int_mode instead of a machine_mode. 2017-08-30 Richard Sandiford Alan Hayward David Sherwood gcc/ * machmode.h (int_mode_for_size): New function. * builtins.c (set_builtin_user_assembler_name): Use int_mode_for_size instead of mode_for_size. * calls.c (save_fixed_argument_area): Likewise. Make use of BLKmode explicit. * combine.c (expand_field_assignment): Use int_mode_for_size instead of mode_for_size. (make_extraction): Likewise. (simplify_shift_const_1): Likewise. (simplify_comparison): Likewise. * dojump.c (do_jump): Likewise. * dwarf2out.c (mem_loc_descriptor): Likewise. * emit-rtl.c (init_derived_machine_modes): Likewise. * expmed.c (flip_storage_order): Likewise. (convert_extracted_bit_field): Likewise. * expr.c (copy_blkmode_from_reg): Likewise. * graphite-isl-ast-to-gimple.c (max_mode_int_precision): Likewise. * internal-fn.c (expand_mul_overflow): Likewise. * lower-subreg.c (simple_move): Likewise. * optabs-libfuncs.c (init_optabs): Likewise. * simplify-rtx.c (simplify_unary_operation_1): Likewise. * tree.c (vector_type_mode): Likewise. * tree-ssa-strlen.c (handle_builtin_memcmp): Likewise. * tree-vect-data-refs.c (vect_lanes_optab_supported_p): Likewise. * tree-vect-generic.c (expand_vector_parallel): Likewise. * tree-vect-stmts.c (vectorizable_load): Likewise. (vectorizable_store): Likewise. gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): Use int_mode_for_size instead of mode_for_size. (gnat_to_gnu_subprog_type): Likewise. * gcc-interface/utils.c (make_type_from_size): Likewise. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r251469 --- gcc/ada/gcc-interface/decl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gcc/ada/gcc-interface/decl.c') diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 83c582f..1b88e25 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -3625,11 +3625,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) /* True if we make a dummy type here. */ bool made_dummy = false; /* The mode to be used for the pointer type. */ - machine_mode p_mode = mode_for_size (esize, MODE_INT, 0); + scalar_int_mode p_mode; /* The GCC type used for the designated type. */ tree gnu_desig_type = NULL_TREE; - if (!targetm.valid_pointer_mode (p_mode)) + if (!int_mode_for_size (esize, 0).exists (&p_mode) + || !targetm.valid_pointer_mode (p_mode)) p_mode = ptr_mode; /* If either the designated type or its full view is an unconstrained @@ -5939,12 +5940,11 @@ gnat_to_gnu_subprog_type (Entity_Id gnat_subprog, bool definition, unsigned int size = TREE_INT_CST_LOW (TYPE_SIZE (gnu_cico_return_type)); unsigned int i = BITS_PER_UNIT; - machine_mode mode; + scalar_int_mode mode; while (i < size) i <<= 1; - mode = mode_for_size (i, MODE_INT, 0); - if (mode != BLKmode) + if (int_mode_for_size (i, 0).exists (&mode)) { SET_TYPE_MODE (gnu_cico_return_type, mode); SET_TYPE_ALIGN (gnu_cico_return_type, -- cgit v1.1