This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] remove the unsigned_type language hook


Not OK.  Please leave the Gigi code untouched and only delete in misc.c
LANG_HOOKS_UNSIGNED_TYPE (and LANG_HOOKS_SIGNED_TYPE).

A new version that includes the implementation, has been ported to a new revision and does the least possible changes to ada is attached.

OK for trunk?

* gcc/ada/misc.c (LANG_HOOKS_UNSIGNED_TYPE): Remove.

* gcc/c-common.c (warnings_for_convert_and_check): Use
get_unsigned_type 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 get_unsigned_type
instead of c_common_unsigned_type.
* gcc/c-format.c (check_format_types): Likewise.
* gcc/c-decl.c (grokdeclarator): Likewise.
* gcc/c-typeck.c (convert_for_assignment): Likewise.
* gcc/c-common.h (c_common_unsigned_type): Remove.
* gcc/c-objc-common.h (LANG_HOOKS_UNSIGNED_TYPE): Remove.
* gcc/convert.c (convert_to_integer): Use get_unsigned_type instead of
lang_hooks.types.unsigned_type.
* gcc/fold-const.c (fold_negate_expr): Likewise.
                  (build_range_check): Likewise.
                  (fold_unary): Likewise.
                  (fold_binary): Likewise.
                  (fold_ternary): Likewise.
* gcc/expmed.c (make_tree): Likewise.
* gcc/tree.c (unsigned_type_for): Likewise.
* gcc/langhooks-def.h (LANG_HOOKS_FOR_TYPES_INITIALIZER): Remove
LANG_HOOKS_UNSIGNED_TYPE
* gcc/langhooks.c (get_unsigned_type): New.
* gcc/langhooks.h (lang_hooks_for_types): Remove unsigned_type.
* gcc/tree.h (get_unsigned_type): New.

* gcc/cp/cp-objcp-common.h (LANG_HOOKS_UNSIGNED_TYPE): Remove.
* gcc/cp/decl.c (grokdeclarator): Use get_unsigned_type instead of
c_common_unsigned_type.

* gcc/fortran/f95-lang.c (LANG_HOOKS_UNSIGNED_TYPE): Remove.
* gcc/fortran/trans-intrinsic.c (gfc_conv_intrinsic_ishft): Use
get_unsigned_type instead of gfc_unsigned_type.
* gcc/fortran/trans-stmt.c (gfc_trans_do): Likewise.
* gcc/fortran/trans-types.c (gfc_unsigned_type): Remove.
* gcc/fortran/trans-types.h (gfc_unsigned_type): Remove.

* gcc/java/expr.c (build_java_binop): Use get_unsigned_type instead of
java_unsigned_type.
* gcc/java/java-tree.h (java_unsigned_type): Remove.
* gcc/java/lang.c (LANG_HOOKS_UNSIGNED_TYPE): Remove.
* gcc/java/typeck.c (java_unsigned_type): Remove.
--- gcc/ada/misc.c	(revision 124568)
+++ gcc/ada/misc.c	(local)
@@ -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
--- gcc/c-common.c	(revision 124568)
+++ gcc/c-common.c	(local)
@@ -1303,7 +1303,7 @@ warnings_for_convert_and_check (tree typ
           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, get_unsigned_type (type))) 
 	warning (OPT_Woverflow,
 		 "overflow in implicit constant conversion");
       /* No warning for converting 0x80000000 to int.  */
@@ -1998,39 +1998,6 @@ c_common_type_for_mode (enum machine_mod
   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
@@ -2473,7 +2440,8 @@ shorten_compare (tree *op0_ptr, tree *op
 	      default:
 		break;
 	      }
-	  type = c_common_unsigned_type (type);
+	  /* get_unsigned_type doesn't support C bit fields */
+	  type = c_common_signed_or_unsigned_type (1, type);
 	}
 
       if (TREE_CODE (primop0) != INTEGER_CST)
@@ -3640,7 +3608,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 = get_unsigned_type (wchar_type_node);
     }
 
   /* This is for wide string constants.  */
@@ -3658,7 +3626,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 = get_unsigned_type (ptrdiff_type_node);
 
   lang_hooks.decls.pushdecl
     (build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"),
--- gcc/c-common.h	(revision 124568)
+++ gcc/c-common.h	(local)
@@ -667,7 +667,6 @@ extern int c_common_handle_option (size_
 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);
--- gcc/c-decl.c	(revision 124568)
+++ gcc/c-decl.c	(local)
@@ -4086,7 +4086,7 @@ grokdeclarator (const struct c_declarato
      "signed".  */
   if (bitfield && !flag_signed_bitfields && !declspecs->explicit_signed_p
       && TREE_CODE (type) == INTEGER_TYPE)
-    type = c_common_unsigned_type (type);
+    type = get_unsigned_type (type);
 
   /* Figure out the type qualifiers for the declaration.  There are
      two ways a declaration can become qualified.  One is something
--- gcc/c-format.c	(revision 124568)
+++ gcc/c-format.c	(local)
@@ -2249,7 +2249,7 @@ check_format_types (format_wanted_type *
 	  && 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 == get_unsigned_type (cur_type)
 	      : wanted_type == c_common_signed_type (cur_type)))
 	continue;
       /* Likewise, "signed char", "unsigned char" and "char" are
--- gcc/c-objc-common.h	(revision 124568)
+++ gcc/c-objc-common.h	(local)
@@ -104,8 +104,6 @@ extern void c_initialize_diagnostics (di
 #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
--- gcc/c-typeck.c	(revision 124568)
+++ gcc/c-typeck.c	(local)
@@ -4081,8 +4081,8 @@ convert_for_assignment (tree type, tree 
       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)))
+	  || (get_unsigned_type (mvl)
+	      == get_unsigned_type (mvr)))
 	{
 	  if (pedantic
 	      && ((VOID_TYPE_P (ttl) && TREE_CODE (ttr) == FUNCTION_TYPE)
--- gcc/convert.c	(revision 124568)
+++ gcc/convert.c	(local)
@@ -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 = get_unsigned_type (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 = get_unsigned_type (type);
 	    else
 	      typex = lang_hooks.types.signed_type (type);
 	    return convert (type,
--- gcc/cp/cp-objcp-common.h	(revision 124568)
+++ gcc/cp/cp-objcp-common.h	(local)
@@ -136,8 +136,6 @@ extern tree objcp_tsubst_copy_and_build 
 #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
--- gcc/cp/decl.c	(revision 124568)
+++ gcc/cp/decl.c	(local)
@@ -7376,7 +7376,7 @@ grokdeclarator (const cp_declarator *dec
       else if (type == char_type_node)
 	type = unsigned_char_type_node;
       else if (typedef_decl)
-	type = c_common_unsigned_type (type);
+	type = get_unsigned_type (type);
       else
 	type = unsigned_type_node;
     }
--- gcc/expmed.c	(revision 124568)
+++ gcc/expmed.c	(local)
@@ -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 = get_unsigned_type (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 = get_unsigned_type (type);
       return fold_convert (type, build2 (TRUNC_DIV_EXPR, t,
 				    	 make_tree (t, XEXP (x, 0)),
 				    	 make_tree (t, XEXP (x, 1))));
--- gcc/fold-const.c	(revision 124568)
+++ gcc/fold-const.c	(local)
@@ -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);
+			   : get_unsigned_type (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, 
     {
       if (! TYPE_UNSIGNED (etype))
 	{
-	  etype = lang_hooks.types.unsigned_type (etype);
+	  etype = get_unsigned_type (etype);
 	  high = fold_convert (etype, high);
 	  exp = fold_convert (etype, exp);
 	}
@@ -4420,7 +4420,7 @@ build_range_check (tree type, tree exp, 
 
       /* 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 = get_unsigned_type (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 ty
 		  && (LOAD_EXTEND_OP (TYPE_MODE (TREE_TYPE (and0)))
 		      == ZERO_EXTEND))
 		{
-		  tree uns = lang_hooks.types.unsigned_type (TREE_TYPE (and0));
+		  tree uns = get_unsigned_type (TREE_TYPE (and0));
 		  and0 = fold_convert (uns, and0);
 		  and1 = fold_convert (uns, and1);
 		}
@@ -11220,7 +11220,7 @@ fold_binary (enum tree_code code, tree t
 	      || TREE_CODE (arg0) == ROUND_MOD_EXPR)
 	  && integer_pow2p (TREE_OPERAND (arg0, 1)))
 	{
-	  tree newtype = lang_hooks.types.unsigned_type (TREE_TYPE (arg0));
+	  tree newtype = get_unsigned_type (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 
 	      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 = get_unsigned_type (TREE_TYPE (tem));
 		  tem = fold_convert (tem_type, tem);
 		}
 	      else
--- gcc/fortran/f95-lang.c	(revision 124568)
+++ gcc/fortran/f95-lang.c	(local)
@@ -113,7 +113,6 @@ static HOST_WIDE_INT gfc_get_alias_set (
 #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 (
 #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
--- gcc/fortran/trans-intrinsic.c	(revision 124568)
+++ gcc/fortran/trans-intrinsic.c	(local)
@@ -2400,7 +2400,7 @@ gfc_conv_intrinsic_ishft (gfc_se * se, g
   arg2 = TREE_VALUE (TREE_CHAIN (arg));
   arg = TREE_VALUE (arg);
   type = TREE_TYPE (arg);
-  utype = gfc_unsigned_type (type);
+  utype = get_unsigned_type (type);
 
   width = fold_build1 (ABS_EXPR, TREE_TYPE (arg2), arg2);
 
--- gcc/fortran/trans-stmt.c	(revision 124568)
+++ gcc/fortran/trans-stmt.c	(local)
@@ -890,7 +890,7 @@ gfc_trans_do (gfc_code * code)
     {
       tree ustep;
 
-      utype = gfc_unsigned_type (type);
+      utype = get_unsigned_type (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 = get_unsigned_type (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);
--- gcc/fortran/trans-types.c	(revision 124568)
+++ gcc/fortran/trans-types.c	(local)
@@ -1839,14 +1839,6 @@ gfc_type_for_mode (enum machine_mode mod
   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
--- gcc/fortran/trans-types.h	(revision 124568)
+++ gcc/fortran/trans-types.h	(local)
@@ -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);
--- gcc/java/expr.c	(revision 124568)
+++ gcc/java/expr.c	(local)
@@ -1523,7 +1523,7 @@ build_java_binop (enum tree_code op, tre
     {
     case URSHIFT_EXPR:
       {
-	tree u_type = java_unsigned_type (type);
+	tree u_type = get_unsigned_type (type);
 	arg1 = convert (u_type, arg1);
 	arg1 = build_java_binop (RSHIFT_EXPR, u_type, arg1, arg2);
 	return convert (type, arg1);
--- gcc/java/java-tree.h	(revision 124568)
+++ gcc/java/java-tree.h	(local)
@@ -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);
--- gcc/java/lang.c	(revision 124568)
+++ gcc/java/lang.c	(local)
@@ -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
--- gcc/java/typeck.c	(revision 124568)
+++ gcc/java/typeck.c	(local)
@@ -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.  */
--- gcc/langhooks-def.h	(revision 124568)
+++ gcc/langhooks-def.h	(local)
@@ -211,7 +211,6 @@ extern tree lhd_make_node (enum tree_cod
   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, \
--- gcc/langhooks.c	(revision 124568)
+++ gcc/langhooks.c	(local)
@@ -592,3 +592,11 @@ lhd_signed_or_unsigned_type (int unsigne
 {
   return lang_hooks.types.type_for_size (TYPE_PRECISION (type), unsignedp);
 }
+
+/* Return an unsigned type the same as TYPE in other respects.  */
+
+tree
+get_unsigned_type (tree type)
+{
+  return get_signed_or_unsigned_type (1, type);
+}
--- gcc/langhooks.h	(revision 124568)
+++ gcc/langhooks.h	(local)
@@ -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);
--- gcc/tree.c	(revision 124568)
+++ gcc/tree.c	(local)
@@ -7737,8 +7737,8 @@ 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.  */
--- gcc/tree.h	(revision 124568)
+++ gcc/tree.h	(local)
@@ -3814,6 +3814,7 @@ extern bool may_negate_without_overflow_
 extern tree get_inner_array_type (tree);
 
 extern tree get_signed_or_unsigned_type (int unsignedp, tree type);
+extern tree get_unsigned_type (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
--- gcc/treelang/treetree.c	(revision 124568)
+++ gcc/treelang/treetree.c	(local)
@@ -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 (tr
 #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_mo
     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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]