diff options
author | espindola <espindola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-06-11 15:40:55 +0000 |
---|---|---|
committer | espindola <espindola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-06-11 15:40:55 +0000 |
commit | 11773141a9a1b8b945255eb8dbcde0d9e25c4e6f (patch) | |
tree | 09e966f66888827cc56e0e29aacd33c5d45e7819 /gcc | |
parent | 2bff6d8b45f3a32ac3ecd70e9f3898f8feba88b5 (diff) | |
download | gcc-11773141a9a1b8b945255eb8dbcde0d9e25c4e6f.tar.gz |
really remove signed(_or_unsigned)?_type langhooks
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125621 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/misc.c | 2 | ||||
-rw-r--r-- | gcc/ada/trans.c | 2 | ||||
-rw-r--r-- | gcc/c-common.c | 45 | ||||
-rw-r--r-- | gcc/c-common.h | 1 | ||||
-rw-r--r-- | gcc/c-decl.c | 2 | ||||
-rw-r--r-- | gcc/c-format.c | 2 | ||||
-rw-r--r-- | gcc/c-objc-common.h | 4 | ||||
-rw-r--r-- | gcc/c-typeck.c | 4 | ||||
-rw-r--r-- | gcc/convert.c | 4 | ||||
-rw-r--r-- | gcc/cp/cp-objcp-common.h | 4 | ||||
-rw-r--r-- | gcc/expmed.c | 4 | ||||
-rw-r--r-- | gcc/expr.c | 2 | ||||
-rw-r--r-- | gcc/fold-const.c | 26 | ||||
-rw-r--r-- | gcc/fortran/f95-lang.c | 2 | ||||
-rw-r--r-- | gcc/fortran/trans-types.c | 8 | ||||
-rw-r--r-- | gcc/fortran/trans-types.h | 1 | ||||
-rw-r--r-- | gcc/java/java-tree.h | 1 | ||||
-rw-r--r-- | gcc/java/lang.c | 2 | ||||
-rw-r--r-- | gcc/java/typeck.c | 8 | ||||
-rw-r--r-- | gcc/langhooks-def.h | 3 | ||||
-rw-r--r-- | gcc/langhooks.c | 21 | ||||
-rw-r--r-- | gcc/langhooks.h | 9 | ||||
-rw-r--r-- | gcc/tree.c | 26 | ||||
-rw-r--r-- | gcc/tree.h | 3 | ||||
-rw-r--r-- | gcc/treelang/treetree.c | 11 |
25 files changed, 52 insertions, 145 deletions
diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index e63856de009..ece8553c149 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -157,8 +157,6 @@ static tree gnat_type_max_size (tree); #define LANG_HOOKS_TYPE_FOR_MODE gnat_type_for_mode #undef LANG_HOOKS_TYPE_FOR_SIZE #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_ATTRIBUTE_TABLE #define LANG_HOOKS_ATTRIBUTE_TABLE gnat_internal_attribute_table #undef LANG_HOOKS_BUILTIN_FUNCTION diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index 54ab6087359..082ecd12661 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -1092,7 +1092,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) } gnu_compute_type - = get_signed_or_unsigned_type (0, + = signed_or_unsigned_type_for (0, get_base_type (gnu_result_type)); gnu_result diff --git a/gcc/c-common.c b/gcc/c-common.c index f17bb7fef68..ccbc479fdee 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1342,7 +1342,7 @@ warnings_for_convert_and_check (tree type, tree expr, tree result) else conversion_warning (type, expr); } - else if (!int_fits_type_p (expr, unsigned_type_for (type))) + else if (!int_fits_type_p (expr, c_common_unsigned_type (type))) warning (OPT_Woverflow, "overflow in implicit constant conversion"); /* No warning for converting 0x80000000 to int. */ @@ -2037,37 +2037,17 @@ c_common_type_for_mode (enum machine_mode mode, int unsignedp) return 0; } +tree +c_common_unsigned_type (tree type) +{ + return c_common_signed_or_unsigned_type (1, type); +} + /* Return a signed type the same as TYPE in other respects. */ tree c_common_signed_type (tree type) { - tree type1 = TYPE_MAIN_VARIANT (type); - if (type1 == unsigned_char_type_node || type1 == char_type_node) - return signed_char_type_node; - if (type1 == unsigned_type_node) - return integer_type_node; - if (type1 == short_unsigned_type_node) - return short_integer_type_node; - if (type1 == long_unsigned_type_node) - return long_integer_type_node; - if (type1 == long_long_unsigned_type_node) - return long_long_integer_type_node; - if (type1 == widest_unsigned_literal_type_node) - return widest_integer_literal_type_node; -#if HOST_BITS_PER_WIDE_INT >= 64 - if (type1 == unsigned_intTI_type_node) - return intTI_type_node; -#endif - if (type1 == unsigned_intDI_type_node) - return intDI_type_node; - if (type1 == unsigned_intSI_type_node) - return intSI_type_node; - if (type1 == unsigned_intHI_type_node) - return intHI_type_node; - if (type1 == unsigned_intQI_type_node) - return intQI_type_node; - return c_common_signed_or_unsigned_type (0, type); } @@ -2514,8 +2494,7 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr, default: break; } - /* unsigned_type_for doesn't support C bit fields */ - type = c_common_signed_or_unsigned_type (1, type); + type = c_common_unsigned_type (type); } if (TREE_CODE (primop0) != INTEGER_CST) @@ -3685,7 +3664,7 @@ c_common_nodes_and_builtins (void) else { signed_wchar_type_node = c_common_signed_type (wchar_type_node); - unsigned_wchar_type_node = unsigned_type_for (wchar_type_node); + unsigned_wchar_type_node = c_common_unsigned_type (wchar_type_node); } /* This is for wide string constants. */ @@ -3703,7 +3682,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 = unsigned_type_for (ptrdiff_type_node); + unsigned_ptrdiff_type_node = c_common_unsigned_type (ptrdiff_type_node); lang_hooks.decls.pushdecl (build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"), @@ -6918,8 +6897,8 @@ same_scalar_type_ignoring_signedness (tree t1, tree t2) /* Equality works here because c_common_signed_type uses TYPE_MAIN_VARIANT. */ - return lang_hooks.types.signed_type (t1) - == lang_hooks.types.signed_type (t2); + return c_common_signed_type (t1) + == c_common_signed_type (t2); } /* Check for missing format attributes on function pointers. LTYPE is diff --git a/gcc/c-common.h b/gcc/c-common.h index 62032c62c68..1a9a3e57900 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -675,6 +675,7 @@ 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 ea058523966..bde95aa0252 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -4078,7 +4078,7 @@ grokdeclarator (const struct c_declarator *declarator, "signed". */ if (bitfield && !flag_signed_bitfields && !declspecs->explicit_signed_p && TREE_CODE (type) == INTEGER_TYPE) - type = unsigned_type_for (type); + type = c_common_unsigned_type (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 92e4ee61b0c..a64e30984ee 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 == unsigned_type_for (cur_type) + ? wanted_type == c_common_unsigned_type (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 9b923b54375..e6a82efd4ae 100644 --- a/gcc/c-objc-common.h +++ b/gcc/c-objc-common.h @@ -102,10 +102,6 @@ extern void c_initialize_diagnostics (diagnostic_context *); #define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode #undef LANG_HOOKS_TYPE_FOR_SIZE #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_SIGNED_OR_UNSIGNED_TYPE -#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type #undef LANG_HOOKS_INCOMPLETE_TYPE_ERROR #define LANG_HOOKS_INCOMPLETE_TYPE_ERROR c_incomplete_type_error #undef LANG_HOOKS_TYPE_PROMOTES_TO diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 121febaaa1b..aff4a638234 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -4098,8 +4098,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 - || (unsigned_type_for (mvl) - == unsigned_type_for (mvr))) + || (c_common_unsigned_type (mvl) + == c_common_unsigned_type (mvr))) { if (pedantic && ((VOID_TYPE_P (ttl) && TREE_CODE (ttr) == FUNCTION_TYPE) diff --git a/gcc/convert.c b/gcc/convert.c index 1cfb05cfd3e..0c7c1086a9b 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -658,7 +658,7 @@ convert_to_integer (tree type, tree expr) || ex_form == MINUS_EXPR))) typex = unsigned_type_for (typex); else - typex = lang_hooks.types.signed_type (typex); + typex = signed_type_for (typex); return convert (type, fold_build2 (ex_form, typex, convert (typex, arg0), @@ -680,7 +680,7 @@ convert_to_integer (tree type, tree expr) if (TYPE_UNSIGNED (TREE_TYPE (expr))) typex = unsigned_type_for (type); else - typex = lang_hooks.types.signed_type (type); + typex = signed_type_for (type); return convert (type, fold_build1 (ex_form, typex, convert (typex, diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h index 6f17276b547..ee320119929 100644 --- a/gcc/cp/cp-objcp-common.h +++ b/gcc/cp/cp-objcp-common.h @@ -134,10 +134,6 @@ extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t, #define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode #undef LANG_HOOKS_TYPE_FOR_SIZE #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_SIGNED_OR_UNSIGNED_TYPE -#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type #undef LANG_HOOKS_INCOMPLETE_TYPE_ERROR #define LANG_HOOKS_INCOMPLETE_TYPE_ERROR cxx_incomplete_type_error #undef LANG_HOOKS_TYPE_PROMOTES_TO diff --git a/gcc/expmed.c b/gcc/expmed.c index c1fdc31c97b..b3709b02e5a 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -5050,14 +5050,14 @@ make_tree (tree type, rtx x) make_tree (type, XEXP (x, 1)))); case ASHIFTRT: - t = lang_hooks.types.signed_type (type); + t = signed_type_for (type); return fold_convert (type, build2 (RSHIFT_EXPR, t, make_tree (t, XEXP (x, 0)), make_tree (type, XEXP (x, 1)))); case DIV: if (TREE_CODE (type) != REAL_TYPE) - t = lang_hooks.types.signed_type (type); + t = signed_type_for (type); else t = type; diff --git a/gcc/expr.c b/gcc/expr.c index 9c5056b3f13..8ce9b49e847 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -4435,7 +4435,7 @@ store_expr (tree exp, rtx target, int call_param_p, bool nontemporal) /* Some types, e.g. Fortran's logical*4, won't have a signed version, so use the mode instead. */ tree ntype - = (get_signed_or_unsigned_type + = (signed_or_unsigned_type_for (SUBREG_PROMOTED_UNSIGNED_P (target), TREE_TYPE (exp))); if (ntype == NULL) ntype = lang_hooks.types.type_for_mode diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 5c7effe3e34..d2dd8cb2fbc 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1410,7 +1410,7 @@ fold_negate_expr (tree t) == TREE_INT_CST_LOW (op1)) { tree ntype = TYPE_UNSIGNED (type) - ? lang_hooks.types.signed_type (type) + ? signed_type_for (type) : unsigned_type_for (type); tree temp = fold_convert (ntype, TREE_OPERAND (t, 0)); temp = fold_build2 (RSHIFT_EXPR, ntype, temp, op1); @@ -2028,7 +2028,7 @@ size_diffop (tree arg0, tree arg1) else if (type == bitsizetype) ctype = sbitsizetype; else - ctype = lang_hooks.types.signed_type (type); + ctype = signed_type_for (type); /* If either operand is not a constant, do the conversions to the signed type and subtract. The hardware will do the right thing with any @@ -3045,7 +3045,7 @@ operand_equal_for_comparison_p (tree arg0, tree arg1, tree other) /* Make sure shorter operand is extended the right way to match the longer operand. */ - primarg1 = fold_convert (get_signed_or_unsigned_type + primarg1 = fold_convert (signed_or_unsigned_type_for (unsignedp1, TREE_TYPE (primarg1)), primarg1); if (operand_equal_p (arg0, fold_convert (type, primarg1), 0)) @@ -3828,7 +3828,7 @@ all_ones_mask_p (tree mask, int size) unsigned int precision = TYPE_PRECISION (type); tree tmask; - tmask = build_int_cst_type (lang_hooks.types.signed_type (type), -1); + tmask = build_int_cst_type (signed_type_for (type), -1); return tree_int_cst_equal (mask, @@ -4382,7 +4382,7 @@ build_range_check (tree type, tree exp, int in_p, tree low, tree high) { if (TYPE_UNSIGNED (etype)) { - etype = lang_hooks.types.signed_type (etype); + etype = signed_type_for (etype); exp = fold_convert (etype, exp); } return fold_build2 (GT_EXPR, type, exp, @@ -4756,7 +4756,7 @@ fold_cond_expr_with_comparison (tree type, tree arg0, tree arg1, tree arg2) case GE_EXPR: case GT_EXPR: if (TYPE_UNSIGNED (TREE_TYPE (arg1))) - arg1 = fold_convert (lang_hooks.types.signed_type + arg1 = fold_convert (signed_type_for (TREE_TYPE (arg1)), arg1); tem = fold_build1 (ABS_EXPR, TREE_TYPE (arg1), arg1); return pedantic_non_lvalue (fold_convert (type, tem)); @@ -4767,7 +4767,7 @@ fold_cond_expr_with_comparison (tree type, tree arg0, tree arg1, tree arg2) case LE_EXPR: case LT_EXPR: if (TYPE_UNSIGNED (TREE_TYPE (arg1))) - arg1 = fold_convert (lang_hooks.types.signed_type + arg1 = fold_convert (signed_type_for (TREE_TYPE (arg1)), arg1); tem = fold_build1 (ABS_EXPR, TREE_TYPE (arg1), arg1); return negate_expr (fold_convert (type, tem)); @@ -5075,7 +5075,7 @@ unextend (tree c, int p, int unsignedp, tree mask) zero or one, and the conversion to a signed type can never overflow. We could get an overflow if this conversion is done anywhere else. */ if (TYPE_UNSIGNED (type)) - temp = fold_convert (lang_hooks.types.signed_type (type), temp); + temp = fold_convert (signed_type_for (type), temp); temp = const_binop (LSHIFT_EXPR, temp, size_int (modesize - 1), 0); temp = const_binop (RSHIFT_EXPR, temp, size_int (modesize - p - 1), 0); @@ -5747,7 +5747,7 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type, must avoid building ABS_EXPR itself as unsigned. */ if (TYPE_UNSIGNED (ctype) && !TYPE_UNSIGNED (type)) { - tree cstype = (*lang_hooks.types.signed_type) (ctype); + tree cstype = (*signed_type_for) (ctype); if ((t1 = extract_muldiv (op0, c, code, cstype, strict_overflow_p)) != 0) { @@ -6558,7 +6558,7 @@ fold_single_bit_test_into_sign_test (enum tree_code code, tree arg0, tree arg1, && TYPE_PRECISION (TREE_TYPE (arg00)) == GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (arg00)))) { - tree stype = lang_hooks.types.signed_type (TREE_TYPE (arg00)); + tree stype = signed_type_for (TREE_TYPE (arg00)); return fold_build2 (code == EQ_EXPR ? GE_EXPR : LT_EXPR, result_type, fold_convert (stype, arg00), build_int_cst (stype, 0)); @@ -11414,7 +11414,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) { if (TYPE_UNSIGNED (itype)) { - itype = lang_hooks.types.signed_type (itype); + itype = signed_type_for (itype); arg00 = fold_convert (itype, arg00); } return fold_build2 (code == EQ_EXPR ? GE_EXPR : LT_EXPR, @@ -11967,7 +11967,7 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) if (code == LE_EXPR || code == GT_EXPR) { tree st; - st = lang_hooks.types.signed_type (TREE_TYPE (arg1)); + st = signed_type_for (TREE_TYPE (arg1)); return fold_build2 (code == LE_EXPR ? GE_EXPR : LT_EXPR, type, fold_convert (st, arg0), build_int_cst (st, 0)); @@ -12357,7 +12357,7 @@ fold_ternary (enum tree_code code, tree type, tree op0, tree op1, tree op2) if ((TREE_INT_CST_HIGH (arg1) & mask_hi) == mask_hi && (TREE_INT_CST_LOW (arg1) & mask_lo) == mask_lo) { - tem_type = lang_hooks.types.signed_type (TREE_TYPE (tem)); + tem_type = signed_type_for (TREE_TYPE (tem)); tem = fold_convert (tem_type, tem); } else if ((TREE_INT_CST_HIGH (arg1) & mask_hi) == 0 diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index 06cea98d73a..558ba0c680b 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_SIGNED_TYPE #undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION #undef LANG_HOOKS_CLEAR_BINDING_STACK #undef LANG_HOOKS_GET_ALIAS_SET @@ -137,7 +136,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_SIGNED_TYPE gfc_signed_type #define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION gfc_expand_function #define LANG_HOOKS_CLEAR_BINDING_STACK gfc_clear_binding_stack #define LANG_HOOKS_GET_ALIAS_SET gfc_get_alias_set diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 20d1718b818..897b4ca18d8 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -1848,12 +1848,4 @@ gfc_type_for_mode (enum machine_mode mode, int unsignedp) return NULL_TREE; } -/* Return a signed type the same as TYPE in other respects. */ - -tree -gfc_signed_type (tree type) -{ - return get_signed_or_unsigned_type (0, type); -} - #include "gt-fortran-trans-types.h" diff --git a/gcc/fortran/trans-types.h b/gcc/fortran/trans-types.h index 761b2184af5..8e4cf86a34e 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_signed_type (tree); tree gfc_get_element_type (tree); tree gfc_get_array_type_bounds (tree, int, tree *, tree *, int); diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index cf41ef2435c..10418d3186a 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_signed_type (tree); extern tree java_truthvalue_conversion (tree); extern void add_assume_compiled (const char *, int); extern void add_enable_assert (const char *, int); diff --git a/gcc/java/lang.c b/gcc/java/lang.c index 5b0cbe84140..7fd6fcdb98f 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -182,8 +182,6 @@ struct language_function GTY(()) #define LANG_HOOKS_TYPE_FOR_MODE java_type_for_mode #undef LANG_HOOKS_TYPE_FOR_SIZE #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_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 0d70929d099..4177fd1dd36 100644 --- a/gcc/java/typeck.c +++ b/gcc/java/typeck.c @@ -195,14 +195,6 @@ java_type_for_size (unsigned bits, int unsignedp) return 0; } -/* Return a signed type the same as TYPE in other respects. */ - -tree -java_signed_type (tree type) -{ - return get_signed_or_unsigned_type (0, 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 80b80435cf8..28b35bb89b1 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -120,7 +120,6 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *, #define LANG_HOOKS_TREE_SIZE lhd_tree_size #define LANG_HOOKS_TYPES_COMPATIBLE_P lhd_types_compatible_p #define LANG_HOOKS_BUILTIN_FUNCTION lhd_builtin_function -#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE lhd_signed_or_unsigned_type #define LANG_HOOKS_EXPR_TO_DECL lhd_expr_to_decl #define LANG_HOOKS_TO_TARGET_CHARSET lhd_to_target_charset #define LANG_HOOKS_INIT_TS lhd_do_nothing @@ -207,8 +206,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_SIGNED_TYPE, \ - LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE, \ LANG_HOOKS_GENERIC_TYPE_P, \ LANG_HOOKS_TYPE_PROMOTES_TO, \ LANG_HOOKS_REGISTER_BUILTIN_TYPE, \ diff --git a/gcc/langhooks.c b/gcc/langhooks.c index f1d4f142d1d..5d4d63c7066 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -570,24 +570,3 @@ lhd_builtin_function (tree decl) lang_hooks.decls.pushdecl (decl); return decl; } - -/* If TYPE is an integral type, return an equivalent type which is - unsigned iff UNSIGNEDP is true. If TYPE is not an integral type, - return TYPE itself. */ - -tree -get_signed_or_unsigned_type (int unsignedp, tree type) -{ - return lang_hooks.types.signed_or_unsigned_type(unsignedp, type); -} - -/* Default implementation of the signed_or_unsigned_type language hook */ - -tree -lhd_signed_or_unsigned_type (int unsignedp, tree type) -{ - if (!INTEGRAL_TYPE_P (type) || TYPE_UNSIGNED (type) == unsignedp) - return type; - - return lang_hooks.types.type_for_size (TYPE_PRECISION (type), unsignedp); -} diff --git a/gcc/langhooks.h b/gcc/langhooks.h index b3719c7094d..e48c0bca81c 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -103,14 +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 signed. - If T is signed, the value is T. */ - tree (*signed_type) (tree); - - /* Return a type the same as TYPE except unsigned or signed - according to UNSIGNEDP. */ - tree (*signed_or_unsigned_type) (int, tree); - /* True if the type is an instantiation of a generic type, e.g. C++ template implicit specializations. */ bool (*generic_p) (tree); @@ -445,6 +437,5 @@ extern tree add_builtin_function (const char *name, tree type, int function_code, enum built_in_class cl, const char *library_name, tree attrs); -extern tree lhd_signed_or_unsigned_type (int unsignedp, tree type); #endif /* GCC_LANG_HOOKS_H */ diff --git a/gcc/tree.c b/gcc/tree.c index 2d96bd7af87..2560c8f72a4 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -7730,13 +7730,21 @@ int_cst_value (tree x) return val; } +/* If TYPE is an integral type, return an equivalent type which is + unsigned iff UNSIGNEDP is true. If TYPE is not an integral type, + return TYPE itself. */ -/* Return an unsigned type the same as TYPE in other respects. */ - -static tree -get_unsigned_type (tree type) +tree +signed_or_unsigned_type_for (int unsignedp, tree type) { - return get_signed_or_unsigned_type (1, type); + tree t = type; + if (POINTER_TYPE_P (type)) + t = size_type_node; + + if (!INTEGRAL_TYPE_P (t) || TYPE_UNSIGNED (t) == unsignedp) + return t; + + return lang_hooks.types.type_for_size (TYPE_PRECISION (t), unsignedp); } /* Returns unsigned variant of TYPE. */ @@ -7744,9 +7752,7 @@ get_unsigned_type (tree type) tree unsigned_type_for (tree type) { - if (POINTER_TYPE_P (type)) - return get_unsigned_type (size_type_node); - return get_unsigned_type (type); + return signed_or_unsigned_type_for (1, type); } /* Returns signed variant of TYPE. */ @@ -7754,9 +7760,7 @@ unsigned_type_for (tree type) tree signed_type_for (tree type) { - if (POINTER_TYPE_P (type)) - return lang_hooks.types.signed_type (size_type_node); - return lang_hooks.types.signed_type (type); + return signed_or_unsigned_type_for (0, type); } /* Returns the largest value obtainable by casting something in INNER type to diff --git a/gcc/tree.h b/gcc/tree.h index bd6232d42ef..1023b86424e 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -3776,6 +3776,7 @@ extern tree build_call_array (tree, tree, int, tree*); extern tree make_signed_type (int); extern tree make_unsigned_type (int); +extern tree signed_or_unsigned_type_for (int, tree); extern tree signed_type_for (tree); extern tree unsigned_type_for (tree); extern void initialize_sizetypes (bool); @@ -3820,8 +3821,6 @@ extern bool tree_expr_nonnegative_warnv_p (tree, bool *); extern bool may_negate_without_overflow_p (tree); extern tree get_inner_array_type (tree); -extern tree get_signed_or_unsigned_type (int unsignedp, tree type); - /* From expmed.c. Since rtl.h is included after tree.h, we can't put the prototype here. Rtl.h does declare the prototype if tree.h had been included. */ diff --git a/gcc/treelang/treetree.c b/gcc/treelang/treetree.c index d288c0eda97..477c1967e9a 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_signed_type (tree type_node); /* Functions to keep track of the current scope. */ static void pushlevel (int ignore); @@ -150,8 +149,6 @@ static void treelang_expand_function (tree fndecl); #undef LANG_HOOKS_MARK_ADDRESSABLE #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_TYPE_FOR_MODE #define LANG_HOOKS_TYPE_FOR_MODE tree_lang_type_for_mode #undef LANG_HOOKS_TYPE_FOR_SIZE @@ -862,14 +859,6 @@ tree_lang_type_for_mode (enum machine_mode mode, int unsignedp) return NULL_TREE; } -/* Return the signed version of a TYPE_NODE, a scalar type. */ - -static tree -tree_lang_signed_type (tree type_node) -{ - return tree_lang_type_for_size (TYPE_PRECISION (type_node), 0); -} - /* These functions and variables deal with binding contours. We only need these functions for the list of PARM_DECLs, but we leave the |