From ca5ba2a3ea97efc7f23622d759bc3a885a12662b Mon Sep 17 00:00:00 2001 From: Rafael Avila de Espindola Date: Mon, 14 May 2007 14:37:17 +0000 Subject: [PATCH] c-common.c (warnings_for_convert_and_check): Use unsigned_type_for instead of c_common_unsigned_type. gcc/ * c-common.c (warnings_for_convert_and_check): Use unsigned_type_for instead of c_common_unsigned_type. (c_common_unsigned_type): Remove. (shorten_compare): Use c_common_signed_or_unsigned_type instead of c_common_unsigned_type. (c_common_nodes_and_builtins): Use unsigned_type_for instead of c_common_unsigned_type. * c-common.h (c_common_unsigned_type): Remove. * c-decl.c (grokdeclarator): Use unsigned_type_for instead of c_common_unsigned_type. * c-format.c (check_format_types): Use unsigned_type_for instead of c_common_unsigned_type. * c-objc-common.h (LANG_HOOKS_UNSIGNED_TYPE): Remove. * c-typeck.c (convert_for_assignment): Use unsigned_type_for instead of c_common_unsigned_type. * convert.c (convert_to_integer): Use unsigned_type_for instead of lang_hooks.types.unsigned_type. * expmed.c (make_tree): Use unsigned_type_for instead of lang_hooks.types.unsigned_type. * fold-const.c (fold_negate_expr): Use unsigned_type_for instead of lang_hooks.types.unsigned_type. (build_range_check): Likewise. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Likewise. * langhooks-def.h (LANG_HOOKS_UNSIGNED_TYPE): Remove. * langhooks.h (lang_hooks_for_types): Remove unsigned_type. * tree.c (get_unsigned_type): New. (unsigned_type_for): Use get_unsigned_type instead of lang_hooks.types.unsigned_type gcc/ada * misc.c (LANG_HOOKS_UNSIGNED_TYPE): Remove. gcc/cp * cp-objcp-common.h (LANG_HOOKS_UNSIGNED_TYPE): Remove. * decl.c (grokdeclarator): Use unsigned_type_for instead of c_common_unsigned_type. gcc/fortran * f95-lang.c (LANG_HOOKS_UNSIGNED_TYPE): Remove. * trans-intrinsic.c (gfc_conv_intrinsic_ishft): Use unsigned_type_for instead of gfc_unsigned_type. * trans-stmt.c (gfc_trans_do): Use unsigned_type_for instead of gfc_unsigned_type. * trans-types.c (gfc_unsigned_type): Remove. * trans-types.h (gfc_unsigned_type): Remove. gcc/java * expr.c (build_java_binop): Use unsigned_type_for instead of java_unsigned_type. * java-tree.h (java_unsigned_type): Remove. * lang.c (LANG_HOOKS_UNSIGNED_TYPE): Remove. * typeck.c (java_unsigned_type): Remove. gcc/treelang * treetree.c (tree_lang_unsigned_type): Remove. (LANG_HOOKS_UNSIGNED_TYPE): Remove. From-SVN: r124715 --- gcc/ChangeLog | 33 +++++++++++++++++++++++++++++++++ gcc/ada/ChangeLog | 4 ++++ gcc/ada/misc.c | 2 -- gcc/c-common.c | 42 +++++------------------------------------- gcc/c-common.h | 1 - gcc/c-decl.c | 2 +- gcc/c-format.c | 2 +- gcc/c-objc-common.h | 2 -- gcc/c-typeck.c | 4 ++-- gcc/convert.c | 4 ++-- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/cp-objcp-common.h | 2 -- gcc/cp/decl.c | 2 +- gcc/expmed.c | 4 ++-- gcc/fold-const.c | 12 ++++++------ gcc/fortran/ChangeLog | 10 ++++++++++ gcc/fortran/f95-lang.c | 2 -- gcc/fortran/trans-intrinsic.c | 2 +- gcc/fortran/trans-stmt.c | 4 ++-- gcc/fortran/trans-types.c | 8 -------- gcc/fortran/trans-types.h | 1 - gcc/java/ChangeLog | 8 ++++++++ gcc/java/expr.c | 2 +- gcc/java/java-tree.h | 1 - gcc/java/lang.c | 2 -- gcc/java/typeck.c | 8 -------- gcc/langhooks-def.h | 1 - gcc/langhooks.h | 4 ---- gcc/tree.c | 12 ++++++++++-- gcc/treelang/ChangeLog | 5 +++++ gcc/treelang/treetree.c | 11 ----------- 31 files changed, 100 insertions(+), 103 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d470dab..37ba76e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,36 @@ +2007-05-14 Rafael Avila de Espindola + + * c-common.c (warnings_for_convert_and_check): Use unsigned_type_for + instead of c_common_unsigned_type. + (c_common_unsigned_type): Remove. + (shorten_compare): Use c_common_signed_or_unsigned_type instead of + c_common_unsigned_type. + (c_common_nodes_and_builtins): Use unsigned_type_for instead of + c_common_unsigned_type. + * c-common.h (c_common_unsigned_type): Remove. + * c-decl.c (grokdeclarator): Use unsigned_type_for instead of + c_common_unsigned_type. + * c-format.c (check_format_types): Use unsigned_type_for instead of + c_common_unsigned_type. + * c-objc-common.h (LANG_HOOKS_UNSIGNED_TYPE): Remove. + * c-typeck.c (convert_for_assignment): Use unsigned_type_for instead of + c_common_unsigned_type. + * convert.c (convert_to_integer): Use unsigned_type_for instead of + lang_hooks.types.unsigned_type. + * expmed.c (make_tree): Use unsigned_type_for instead of + lang_hooks.types.unsigned_type. + * fold-const.c (fold_negate_expr): Use unsigned_type_for instead of + lang_hooks.types.unsigned_type. + (build_range_check): Likewise. + (fold_unary): Likewise. + (fold_binary): Likewise. + (fold_ternary): Likewise. + * langhooks-def.h (LANG_HOOKS_UNSIGNED_TYPE): Remove. + * langhooks.h (lang_hooks_for_types): Remove unsigned_type. + * tree.c (get_unsigned_type): New. + (unsigned_type_for): Use get_unsigned_type instead of + lang_hooks.types.unsigned_type. + 2007-05-14 Kazu Hirata * config/m68k/m68k-protos.h: Rename m68k_interrupt_function_p diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e85a5a0..fc5337d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2007-05-14 Rafael Avila de Espindola + + * misc.c (LANG_HOOKS_UNSIGNED_TYPE): Remove. + 2007-05-02 Pascal Obry * gnatchop.adb (Write_Source_Reference_Pragma): Change implementation diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index 7d4ffde..db39179 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -159,8 +159,6 @@ static tree gnat_type_max_size (tree); #define LANG_HOOKS_TYPE_FOR_SIZE gnat_type_for_size #undef LANG_HOOKS_SIGNED_TYPE #define LANG_HOOKS_SIGNED_TYPE gnat_signed_type -#undef LANG_HOOKS_UNSIGNED_TYPE -#define LANG_HOOKS_UNSIGNED_TYPE gnat_unsigned_type #undef LANG_HOOKS_ATTRIBUTE_TABLE #define LANG_HOOKS_ATTRIBUTE_TABLE gnat_internal_attribute_table #undef LANG_HOOKS_BUILTIN_FUNCTION diff --git a/gcc/c-common.c b/gcc/c-common.c index 17a0067..d132be9 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1330,7 +1330,7 @@ warnings_for_convert_and_check (tree type, tree expr, tree result) else if (warn_conversion) conversion_warning (type, expr); } - else if (!int_fits_type_p (expr, c_common_unsigned_type (type))) + else if (!int_fits_type_p (expr, unsigned_type_for (type))) warning (OPT_Woverflow, "overflow in implicit constant conversion"); /* No warning for converting 0x80000000 to int. */ @@ -2025,39 +2025,6 @@ c_common_type_for_mode (enum machine_mode mode, int unsignedp) return 0; } -/* Return an unsigned type the same as TYPE in other respects. */ -tree -c_common_unsigned_type (tree type) -{ - tree type1 = TYPE_MAIN_VARIANT (type); - if (type1 == signed_char_type_node || type1 == char_type_node) - return unsigned_char_type_node; - if (type1 == integer_type_node) - return unsigned_type_node; - if (type1 == short_integer_type_node) - return short_unsigned_type_node; - if (type1 == long_integer_type_node) - return long_unsigned_type_node; - if (type1 == long_long_integer_type_node) - return long_long_unsigned_type_node; - if (type1 == widest_integer_literal_type_node) - return widest_unsigned_literal_type_node; -#if HOST_BITS_PER_WIDE_INT >= 64 - if (type1 == intTI_type_node) - return unsigned_intTI_type_node; -#endif - if (type1 == intDI_type_node) - return unsigned_intDI_type_node; - if (type1 == intSI_type_node) - return unsigned_intSI_type_node; - if (type1 == intHI_type_node) - return unsigned_intHI_type_node; - if (type1 == intQI_type_node) - return unsigned_intQI_type_node; - - return c_common_signed_or_unsigned_type (1, type); -} - /* Return a signed type the same as TYPE in other respects. */ tree @@ -2500,7 +2467,8 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr, default: break; } - type = c_common_unsigned_type (type); + /* unsigned_type_for doesn't support C bit fields */ + type = c_common_signed_or_unsigned_type (1, type); } if (TREE_CODE (primop0) != INTEGER_CST) @@ -3667,7 +3635,7 @@ c_common_nodes_and_builtins (void) else { signed_wchar_type_node = c_common_signed_type (wchar_type_node); - unsigned_wchar_type_node = c_common_unsigned_type (wchar_type_node); + unsigned_wchar_type_node = unsigned_type_for (wchar_type_node); } /* This is for wide string constants. */ @@ -3685,7 +3653,7 @@ c_common_nodes_and_builtins (void) default_function_type = build_function_type (integer_type_node, NULL_TREE); ptrdiff_type_node = TREE_TYPE (identifier_global_value (get_identifier (PTRDIFF_TYPE))); - unsigned_ptrdiff_type_node = c_common_unsigned_type (ptrdiff_type_node); + unsigned_ptrdiff_type_node = unsigned_type_for (ptrdiff_type_node); lang_hooks.decls.pushdecl (build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"), diff --git a/gcc/c-common.h b/gcc/c-common.h index 7e1967a..71a958d 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -667,7 +667,6 @@ extern int c_common_handle_option (size_t code, const char *arg, int value); extern bool c_common_missing_argument (const char *opt, size_t code); extern tree c_common_type_for_mode (enum machine_mode, int); extern tree c_common_type_for_size (unsigned int, int); -extern tree c_common_unsigned_type (tree); extern tree c_common_signed_type (tree); extern tree c_common_signed_or_unsigned_type (int, tree); extern tree c_build_bitfield_integer_type (unsigned HOST_WIDE_INT, int); diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 9feb25ce..db8412c 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -4086,7 +4086,7 @@ grokdeclarator (const struct c_declarator *declarator, "signed". */ if (bitfield && !flag_signed_bitfields && !declspecs->explicit_signed_p && TREE_CODE (type) == INTEGER_TYPE) - type = c_common_unsigned_type (type); + type = unsigned_type_for (type); /* Figure out the type qualifiers for the declaration. There are two ways a declaration can become qualified. One is something diff --git a/gcc/c-format.c b/gcc/c-format.c index a64e309..92e4ee6 100644 --- a/gcc/c-format.c +++ b/gcc/c-format.c @@ -2249,7 +2249,7 @@ check_format_types (format_wanted_type *types, const char *format_start, && TREE_CODE (cur_type) == INTEGER_TYPE && (!pedantic || i == 0 || (i == 1 && char_type_flag)) && (TYPE_UNSIGNED (wanted_type) - ? wanted_type == c_common_unsigned_type (cur_type) + ? wanted_type == unsigned_type_for (cur_type) : wanted_type == c_common_signed_type (cur_type))) continue; /* Likewise, "signed char", "unsigned char" and "char" are diff --git a/gcc/c-objc-common.h b/gcc/c-objc-common.h index 78438ad..9b923b5 100644 --- a/gcc/c-objc-common.h +++ b/gcc/c-objc-common.h @@ -104,8 +104,6 @@ extern void c_initialize_diagnostics (diagnostic_context *); #define LANG_HOOKS_TYPE_FOR_SIZE c_common_type_for_size #undef LANG_HOOKS_SIGNED_TYPE #define LANG_HOOKS_SIGNED_TYPE c_common_signed_type -#undef LANG_HOOKS_UNSIGNED_TYPE -#define LANG_HOOKS_UNSIGNED_TYPE c_common_unsigned_type #undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE #define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type #undef LANG_HOOKS_INCOMPLETE_TYPE_ERROR diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 2b1e965..fc42389 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -4095,8 +4095,8 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype, if (VOID_TYPE_P (ttl) || VOID_TYPE_P (ttr) || (target_cmp = comp_target_types (type, rhstype)) || is_opaque_pointer - || (c_common_unsigned_type (mvl) - == c_common_unsigned_type (mvr))) + || (unsigned_type_for (mvl) + == unsigned_type_for (mvr))) { if (pedantic && ((VOID_TYPE_P (ttl) && TREE_CODE (ttr) == FUNCTION_TYPE) diff --git a/gcc/convert.c b/gcc/convert.c index 82b40ba..1cfb05c 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -656,7 +656,7 @@ convert_to_integer (tree type, tree expr) || !TYPE_OVERFLOW_WRAPS (TREE_TYPE (arg1))) && (ex_form == PLUS_EXPR || ex_form == MINUS_EXPR))) - typex = lang_hooks.types.unsigned_type (typex); + typex = unsigned_type_for (typex); else typex = lang_hooks.types.signed_type (typex); return convert (type, @@ -678,7 +678,7 @@ convert_to_integer (tree type, tree expr) /* Don't do unsigned arithmetic where signed was wanted, or vice versa. */ if (TYPE_UNSIGNED (TREE_TYPE (expr))) - typex = lang_hooks.types.unsigned_type (type); + typex = unsigned_type_for (type); else typex = lang_hooks.types.signed_type (type); return convert (type, diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a4c5cea..286a19b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2007-05-14 Rafael Avila de Espindola + + * cp-objcp-common.h (LANG_HOOKS_UNSIGNED_TYPE): Remove. + * decl.c (grokdeclarator): Use unsigned_type_for instead of + c_common_unsigned_type. + 2007-05-11 Silvius Rus * cp/typeck.c (build_indirect_ref): Add call to diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h index 2c0dd83..6f17276 100644 --- a/gcc/cp/cp-objcp-common.h +++ b/gcc/cp/cp-objcp-common.h @@ -136,8 +136,6 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t, #define LANG_HOOKS_TYPE_FOR_SIZE c_common_type_for_size #undef LANG_HOOKS_SIGNED_TYPE #define LANG_HOOKS_SIGNED_TYPE c_common_signed_type -#undef LANG_HOOKS_UNSIGNED_TYPE -#define LANG_HOOKS_UNSIGNED_TYPE c_common_unsigned_type #undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE #define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type #undef LANG_HOOKS_INCOMPLETE_TYPE_ERROR diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 31bc8d2..9b62658 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7376,7 +7376,7 @@ grokdeclarator (const cp_declarator *declarator, else if (type == char_type_node) type = unsigned_char_type_node; else if (typedef_decl) - type = c_common_unsigned_type (type); + type = unsigned_type_for (type); else type = unsigned_type_node; } diff --git a/gcc/expmed.c b/gcc/expmed.c index 8e8a639..c1fdc31 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -5044,7 +5044,7 @@ make_tree (tree type, rtx x) make_tree (type, XEXP (x, 1))); case LSHIFTRT: - t = lang_hooks.types.unsigned_type (type); + t = unsigned_type_for (type); return fold_convert (type, build2 (RSHIFT_EXPR, t, make_tree (t, XEXP (x, 0)), make_tree (type, XEXP (x, 1)))); @@ -5065,7 +5065,7 @@ make_tree (tree type, rtx x) make_tree (t, XEXP (x, 0)), make_tree (t, XEXP (x, 1)))); case UDIV: - t = lang_hooks.types.unsigned_type (type); + t = unsigned_type_for (type); return fold_convert (type, build2 (TRUNC_DIV_EXPR, t, make_tree (t, XEXP (x, 0)), make_tree (t, XEXP (x, 1)))); diff --git a/gcc/fold-const.c b/gcc/fold-const.c index ba17d46..c4c6edc 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1411,7 +1411,7 @@ fold_negate_expr (tree t) { tree ntype = TYPE_UNSIGNED (type) ? lang_hooks.types.signed_type (type) - : lang_hooks.types.unsigned_type (type); + : unsigned_type_for (type); tree temp = fold_convert (ntype, TREE_OPERAND (t, 0)); temp = fold_build2 (RSHIFT_EXPR, ntype, temp, op1); return fold_convert (type, temp); @@ -4352,7 +4352,7 @@ build_range_check (tree type, tree exp, int in_p, tree low, tree high) { if (! TYPE_UNSIGNED (etype)) { - etype = lang_hooks.types.unsigned_type (etype); + etype = unsigned_type_for (etype); high = fold_convert (etype, high); exp = fold_convert (etype, exp); } @@ -4420,7 +4420,7 @@ build_range_check (tree type, tree exp, int in_p, tree low, tree high) /* Check if (unsigned) INT_MAX + 1 == (unsigned) INT_MIN for the type in question, as we rely on this here. */ - utype = lang_hooks.types.unsigned_type (etype); + utype = unsigned_type_for (etype); maxv = fold_convert (utype, TYPE_MAX_VALUE (etype)); maxv = range_binop (PLUS_EXPR, NULL_TREE, maxv, 1, integer_one_node, 1); @@ -7798,7 +7798,7 @@ fold_unary (enum tree_code code, tree type, tree op0) && (LOAD_EXTEND_OP (TYPE_MODE (TREE_TYPE (and0))) == ZERO_EXTEND)) { - tree uns = lang_hooks.types.unsigned_type (TREE_TYPE (and0)); + tree uns = unsigned_type_for (TREE_TYPE (and0)); and0 = fold_convert (uns, and0); and1 = fold_convert (uns, and1); } @@ -11220,7 +11220,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) || TREE_CODE (arg0) == ROUND_MOD_EXPR) && integer_pow2p (TREE_OPERAND (arg0, 1))) { - tree newtype = lang_hooks.types.unsigned_type (TREE_TYPE (arg0)); + tree newtype = unsigned_type_for (TREE_TYPE (arg0)); tree newmod = fold_build2 (TREE_CODE (arg0), newtype, fold_convert (newtype, TREE_OPERAND (arg0, 0)), @@ -12329,7 +12329,7 @@ fold_ternary (enum tree_code code, tree type, tree op0, tree op1, tree op2) else if ((TREE_INT_CST_HIGH (arg1) & mask_hi) == 0 && (TREE_INT_CST_LOW (arg1) & mask_lo) == 0) { - tem_type = lang_hooks.types.unsigned_type (TREE_TYPE (tem)); + tem_type = unsigned_type_for (TREE_TYPE (tem)); tem = fold_convert (tem_type, tem); } else diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 4046c88..f94b3c3 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2007-05-14 Rafael Avila de Espindola + + * f95-lang.c (LANG_HOOKS_UNSIGNED_TYPE): Remove. + * trans-intrinsic.c (gfc_conv_intrinsic_ishft): Use unsigned_type_for + instead of gfc_unsigned_type. + * trans-stmt.c (gfc_trans_do): Use unsigned_type_for instead of + gfc_unsigned_type. + * trans-types.c (gfc_unsigned_type): Remove. + * trans-types.h (gfc_unsigned_type): Remove. + 2007-05-12 Paul Thomas PR fortran/30746 diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index 4995e4c5..d4fc2cc 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -113,7 +113,6 @@ static HOST_WIDE_INT gfc_get_alias_set (tree); #undef LANG_HOOKS_MARK_ADDRESSABLE #undef LANG_HOOKS_TYPE_FOR_MODE #undef LANG_HOOKS_TYPE_FOR_SIZE -#undef LANG_HOOKS_UNSIGNED_TYPE #undef LANG_HOOKS_SIGNED_TYPE #undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION #undef LANG_HOOKS_CLEAR_BINDING_STACK @@ -138,7 +137,6 @@ static HOST_WIDE_INT gfc_get_alias_set (tree); #define LANG_HOOKS_MARK_ADDRESSABLE gfc_mark_addressable #define LANG_HOOKS_TYPE_FOR_MODE gfc_type_for_mode #define LANG_HOOKS_TYPE_FOR_SIZE gfc_type_for_size -#define LANG_HOOKS_UNSIGNED_TYPE gfc_unsigned_type #define LANG_HOOKS_SIGNED_TYPE gfc_signed_type #define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION gfc_expand_function #define LANG_HOOKS_CLEAR_BINDING_STACK gfc_clear_binding_stack diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 25c8e1e..33b2e22 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -2400,7 +2400,7 @@ gfc_conv_intrinsic_ishft (gfc_se * se, gfc_expr * expr) arg2 = TREE_VALUE (TREE_CHAIN (arg)); arg = TREE_VALUE (arg); type = TREE_TYPE (arg); - utype = gfc_unsigned_type (type); + utype = unsigned_type_for (type); width = fold_build1 (ABS_EXPR, TREE_TYPE (arg2), arg2); diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 92462cb..0fcc66f 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -890,7 +890,7 @@ gfc_trans_do (gfc_code * code) { tree ustep; - utype = gfc_unsigned_type (type); + utype = unsigned_type_for (type); /* tmp = abs(to - from) / abs(step) */ ustep = fold_convert (utype, fold_build1 (ABS_EXPR, type, step)); @@ -905,7 +905,7 @@ gfc_trans_do (gfc_code * code) /* TODO: We could use the same width as the real type. This would probably cause more problems that it solves when we implement "long double" types. */ - utype = gfc_unsigned_type (gfc_array_index_type); + utype = unsigned_type_for (gfc_array_index_type); tmp = fold_build2 (MINUS_EXPR, type, to, from); tmp = fold_build2 (RDIV_EXPR, type, tmp, step); tmp = fold_build1 (FIX_TRUNC_EXPR, utype, tmp); diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index c31b732..d83987e 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -1839,14 +1839,6 @@ gfc_type_for_mode (enum machine_mode mode, int unsignedp) return NULL_TREE; } -/* Return an unsigned type the same as TYPE in other respects. */ - -tree -gfc_unsigned_type (tree type) -{ - return get_signed_or_unsigned_type (1, type); -} - /* Return a signed type the same as TYPE in other respects. */ tree diff --git a/gcc/fortran/trans-types.h b/gcc/fortran/trans-types.h index c39c375..761b218 100644 --- a/gcc/fortran/trans-types.h +++ b/gcc/fortran/trans-types.h @@ -82,7 +82,6 @@ tree gfc_get_function_type (gfc_symbol *); tree gfc_type_for_size (unsigned, int); tree gfc_type_for_mode (enum machine_mode, int); -tree gfc_unsigned_type (tree); tree gfc_signed_type (tree); tree gfc_get_element_type (tree); diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 202ffc3..dceb969 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,11 @@ +2007-05-14 Rafael Avila de Espindola + + * expr.c (build_java_binop): Use unsigned_type_for instead of + java_unsigned_type. + * java-tree.h (java_unsigned_type): Remove. + * lang.c (LANG_HOOKS_UNSIGNED_TYPE): Remove. + * typeck.c (java_unsigned_type): Remove. + 2007-04-21 Andrew Pinski * java-tree.h (lang_tree_node): Use GENERIC_NEXT diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 1a5ec68..c915a91 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -1523,7 +1523,7 @@ build_java_binop (enum tree_code op, tree type, tree arg1, tree arg2) { case URSHIFT_EXPR: { - tree u_type = java_unsigned_type (type); + tree u_type = unsigned_type_for (type); arg1 = convert (u_type, arg1); arg1 = build_java_binop (RSHIFT_EXPR, u_type, arg1, arg2); return convert (type, arg1); diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index d560dee..cf41ef2 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -1099,7 +1099,6 @@ extern void java_parse_file (int); extern bool java_mark_addressable (tree); extern tree java_type_for_mode (enum machine_mode, int); extern tree java_type_for_size (unsigned int, int); -extern tree java_unsigned_type (tree); extern tree java_signed_type (tree); extern tree java_truthvalue_conversion (tree); extern void add_assume_compiled (const char *, int); diff --git a/gcc/java/lang.c b/gcc/java/lang.c index 723d9a6..5b0cbe8 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -184,8 +184,6 @@ struct language_function GTY(()) #define LANG_HOOKS_TYPE_FOR_SIZE java_type_for_size #undef LANG_HOOKS_SIGNED_TYPE #define LANG_HOOKS_SIGNED_TYPE java_signed_type -#undef LANG_HOOKS_UNSIGNED_TYPE -#define LANG_HOOKS_UNSIGNED_TYPE java_unsigned_type #undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN #define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN java_dump_tree diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c index b35461b..0d70929 100644 --- a/gcc/java/typeck.c +++ b/gcc/java/typeck.c @@ -203,14 +203,6 @@ java_signed_type (tree type) return get_signed_or_unsigned_type (0, type); } -/* Return an unsigned type the same as TYPE in other respects. */ - -tree -java_unsigned_type (tree type) -{ - return get_signed_or_unsigned_type (1, type); -} - /* Mark EXP saying that we need to be able to take the address of it; it should not be allocated in a register. Value is true if successful. */ diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index c2d5bc2..def7a4a 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -211,7 +211,6 @@ extern tree lhd_make_node (enum tree_code); LANG_HOOKS_MAKE_TYPE, \ LANG_HOOKS_TYPE_FOR_MODE, \ LANG_HOOKS_TYPE_FOR_SIZE, \ - LANG_HOOKS_UNSIGNED_TYPE, \ LANG_HOOKS_SIGNED_TYPE, \ LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE, \ LANG_HOOKS_GENERIC_TYPE_P, \ diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 3e38f26..b3719c7 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -103,10 +103,6 @@ struct lang_hooks_for_types integer type with at least that precision. */ tree (*type_for_size) (unsigned, int); - /* Given an integer type T, return a type like T but unsigned. - If T is unsigned, the value is T. */ - tree (*unsigned_type) (tree); - /* Given an integer type T, return a type like T but signed. If T is signed, the value is T. */ tree (*signed_type) (tree); diff --git a/gcc/tree.c b/gcc/tree.c index b636de6..2d96bd7 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -7731,14 +7731,22 @@ int_cst_value (tree x) } +/* Return an unsigned type the same as TYPE in other respects. */ + +static tree +get_unsigned_type (tree type) +{ + return get_signed_or_unsigned_type (1, type); +} + /* Returns unsigned variant of TYPE. */ tree unsigned_type_for (tree type) { if (POINTER_TYPE_P (type)) - return lang_hooks.types.unsigned_type (size_type_node); - return lang_hooks.types.unsigned_type (type); + return get_unsigned_type (size_type_node); + return get_unsigned_type (type); } /* Returns signed variant of TYPE. */ diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog index 2903de6..b74851c 100644 --- a/gcc/treelang/ChangeLog +++ b/gcc/treelang/ChangeLog @@ -1,3 +1,8 @@ +2007-05-14 Rafael Avila de Espindola + + * treetree.c (tree_lang_unsigned_type): Remove. + (LANG_HOOKS_UNSIGNED_TYPE): Remove. + 2007-03-30 Rafael Avila de Espindola * treetree.c (tree_lang_signed_or_unsigned_type): Remove. diff --git a/gcc/treelang/treetree.c b/gcc/treelang/treetree.c index 0645b9d..d288c0e 100644 --- a/gcc/treelang/treetree.c +++ b/gcc/treelang/treetree.c @@ -127,7 +127,6 @@ struct language_function GTY(()) static bool tree_mark_addressable (tree exp); static tree tree_lang_type_for_size (unsigned precision, int unsignedp); static tree tree_lang_type_for_mode (enum machine_mode mode, int unsignedp); -static tree tree_lang_unsigned_type (tree type_node); static tree tree_lang_signed_type (tree type_node); /* Functions to keep track of the current scope. */ @@ -153,8 +152,6 @@ static void treelang_expand_function (tree fndecl); #define LANG_HOOKS_MARK_ADDRESSABLE tree_mark_addressable #undef LANG_HOOKS_SIGNED_TYPE #define LANG_HOOKS_SIGNED_TYPE tree_lang_signed_type -#undef LANG_HOOKS_UNSIGNED_TYPE -#define LANG_HOOKS_UNSIGNED_TYPE tree_lang_unsigned_type #undef LANG_HOOKS_TYPE_FOR_MODE #define LANG_HOOKS_TYPE_FOR_MODE tree_lang_type_for_mode #undef LANG_HOOKS_TYPE_FOR_SIZE @@ -865,14 +862,6 @@ tree_lang_type_for_mode (enum machine_mode mode, int unsignedp) return NULL_TREE; } -/* Return the unsigned version of a TYPE_NODE, a scalar type. */ - -static tree -tree_lang_unsigned_type (tree type_node) -{ - return tree_lang_type_for_size (TYPE_PRECISION (type_node), 1); -} - /* Return the signed version of a TYPE_NODE, a scalar type. */ static tree -- 2.7.4