From b0567726a311d3f2fcec5b62380675231cd610c9 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 30 Aug 2017 11:11:02 +0000 Subject: [21/77] Replace SCALAR_INT_MODE_P checks with is_a This patch replaces checks of "SCALAR_INT_MODE_P (...)" with "is_a (..., &var)" in cases where it becomes useful to refer to the mode as a scalar_int_mode. It also replaces some checks for the two constituent classes (MODE_INT and MODE_PARTIAL_INT). The patch also introduces is_a checks for some uses of HWI_COMPUTABLE_MODE_P, which is a subcondition of SCALAR_INT_MODE_P. 2017-08-30 Richard Sandiford Alan Hayward David Sherwood gcc/ * wide-int.h (int_traits) New class. (int_traits) Likewise. * cfgexpand.c (expand_debug_expr): Use is_a . Use GET_MODE_UNIT_PRECISION and remove redundant test for SCALAR_INT_MODE_P. * combine.c (set_nonzero_bits_and_sign_copies): Use is_a . (find_split_point): Likewise. (combine_simplify_rtx): Likewise. (simplify_logical): Likewise. (expand_compound_operation): Likewise. (expand_field_assignment): Likewise. (make_compound_operation): Likewise. (extended_count): Likewise. (change_zero_ext): Likewise. (simplify_comparison): Likewise. * dwarf2out.c (scompare_loc_descriptor): Likewise. (ucompare_loc_descriptor): Likewise. (minmax_loc_descriptor): Likewise. (mem_loc_descriptor): Likewise. (loc_descriptor): Likewise. * expmed.c (init_expmed_one_mode): Likewise. * lra-constraints.c (lra_constraint_offset): Likewise. * optabs.c (prepare_libcall_arg): Likewise. * postreload.c (move2add_note_store): Likewise. * reload.c (operands_match_p): Likewise. * rtl.h (load_extend_op): Likewise. * rtlhooks.c (gen_lowpart_general): Likewise. * simplify-rtx.c (simplify_truncation): Likewise. (simplify_unary_operation_1): Likewise. (simplify_binary_operation_1): Likewise. (simplify_const_binary_operation): Likewise. (simplify_const_relational_operation): Likewise. (simplify_subreg): Likewise. * stor-layout.c (bitwise_mode_for_mode): Likewise. * var-tracking.c (adjust_mems): Likewise. (prepare_call_arguments): Likewise. gcc/ada/ * gcc-interface/decl.c (check_ok_for_atomic_type): Use is_a . * gcc-interface/trans.c (Pragma_to_gnu): Likewise. * gcc-interface/utils.c (gnat_type_for_mode): Likewise. gcc/fortran/ * trans-types.c (gfc_type_for_mode): Use is_a . Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r251473 --- gcc/ada/gcc-interface/decl.c | 5 +++-- gcc/ada/gcc-interface/trans.c | 6 +++--- gcc/ada/gcc-interface/utils.c | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'gcc/ada/gcc-interface') diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 1b88e25..c80960f 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -8801,9 +8801,10 @@ check_ok_for_atomic_type (tree type, Entity_Id gnat_entity, bool component_p) /* Consider all aligned floating-point types atomic and any aligned types that are represented by integers no wider than a machine word. */ + scalar_int_mode int_mode; if ((mclass == MODE_FLOAT - || ((mclass == MODE_INT || mclass == MODE_PARTIAL_INT) - && GET_MODE_BITSIZE (mode) <= BITS_PER_WORD)) + || (is_a (mode, &int_mode) + && GET_MODE_BITSIZE (int_mode) <= BITS_PER_WORD)) && align >= GET_MODE_ALIGNMENT (mode)) return; diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index c0c6fb3..693c74f 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -1277,6 +1277,7 @@ Pragma_to_gnu (Node_Id gnat_node) tree gnu_expr = gnat_to_gnu (gnat_expr); int use_address; machine_mode mode; + scalar_int_mode int_mode; tree asm_constraint = NULL_TREE; #ifdef ASM_COMMENT_START char *comment; @@ -1288,9 +1289,8 @@ Pragma_to_gnu (Node_Id gnat_node) /* Use the value only if it fits into a normal register, otherwise use the address. */ mode = TYPE_MODE (TREE_TYPE (gnu_expr)); - use_address = ((GET_MODE_CLASS (mode) != MODE_INT - && GET_MODE_CLASS (mode) != MODE_PARTIAL_INT) - || GET_MODE_SIZE (mode) > UNITS_PER_WORD); + use_address = (!is_a (mode, &int_mode) + || GET_MODE_SIZE (int_mode) > UNITS_PER_WORD); if (use_address) gnu_expr = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_expr); diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index bc916bb..9510898 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -3470,8 +3470,9 @@ gnat_type_for_mode (machine_mode mode, int unsignedp) return float_type_for_precision (GET_MODE_PRECISION (float_mode), float_mode); - if (SCALAR_INT_MODE_P (mode)) - return gnat_type_for_size (GET_MODE_BITSIZE (mode), unsignedp); + scalar_int_mode int_mode; + if (is_a (mode, &int_mode)) + return gnat_type_for_size (GET_MODE_BITSIZE (int_mode), unsignedp); if (VECTOR_MODE_P (mode)) { -- cgit v1.1