]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
typeck.c (java_signed_or_unsigned_type): Remove.
authorRafael Avila de Espindola <espindola@google.com>
Fri, 30 Mar 2007 22:09:01 +0000 (22:09 +0000)
committerRafael Espindola <espindola@gcc.gnu.org>
Fri, 30 Mar 2007 22:09:01 +0000 (22:09 +0000)
gcc/java/ChangeLog:
   * typeck.c (java_signed_or_unsigned_type): Remove.
   (java_signed_type): use get_signed_or_unsigned_type instead of
java_signed_or_unsigned_type.
   (java_unsigned_type): Ditto.
   * lang.c (LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): Remove.
   * java-tree.h (java_signed_or_unsigned_type): Remove

gcc/Changelog:
   * tree.h(get_signed_or_unsigned_type): New
   * fold-const.c (operand_equal_for_comparison_p): Use
get_signed_or_unsigned_type instead of
lang_hooks.types.signed_or_unsigned_type.
   * expr.c (store_expr): Ditto.
   * langhooks.c (get_signed_or_unsigned_type): New.
     (lhd_signed_or_unsigned_type): New
   * langhooks.h (lhd_signed_or_unsigned_type): New.
   * langhooks-def.h (LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): Define.

gcc/treelang/ChangeLog:
   * treetree.c (tree_lang_signed_or_unsigned_type): Remove.
   (LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE) Remove.

gcc/ada/ChangeLog:
    * trans.c (Attribute_to_gnu): Use get_signed_or_unsigned_type
instead of gnat_signed_or_unsigned_type.
    * utils.c (gnat_signed_or_unsigned_type): Remove.
    * misc.c (LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): Remove
    * gigi.h (gnat_signed_or_unsigned_type): Remove

gcc/forrtan/trans-types.c:
   * trans-types.c (gfc_signed_or_unsigned_type): Remove.
     (gfc_unsigned_type): Use get_signed_or_unsigned_type instead of
gfc_signed_or_unsigned_type.
     (gfc_signed_type): Ditto.
   * trans-types.h (gfc_signed_or_unsigned_type): Remove.
   * f95-lang.c (LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): Remove.

From-SVN: r123373

22 files changed:
gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/gigi.h
gcc/ada/misc.c
gcc/ada/trans.c
gcc/ada/utils.c
gcc/expr.c
gcc/fold-const.c
gcc/fortran/ChangeLog
gcc/fortran/f95-lang.c
gcc/fortran/trans-types.c
gcc/fortran/trans-types.h
gcc/java/ChangeLog
gcc/java/java-tree.h
gcc/java/lang.c
gcc/java/typeck.c
gcc/langhooks-def.h
gcc/langhooks.c
gcc/langhooks.h
gcc/tree.h
gcc/treelang/ChangeLog
gcc/treelang/treetree.c

index b048bc7532a87fa3edaa245fee2a046998be9dda..7a03dd94da3ae7df8db84bd0acc81ed0675a1a17 100644 (file)
@@ -1,3 +1,15 @@
+2007-03-30  Rafael Avila de Espindola  <espindola@google.com>
+
+       * tree.h (get_signed_or_unsigned_type): New.
+       * fold-const.c (operand_equal_for_comparison_p): Use
+       get_signed_or_unsigned_type instead of
+       lang_hooks.types.signed_or_unsigned_type.
+       * expr.c (store_expr): Ditto.
+       * langhooks.c (get_signed_or_unsigned_type): New.
+       (lhd_signed_or_unsigned_type): New.
+       * langhooks.h (lhd_signed_or_unsigned_type): New.
+       * langhooks-def.h (LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): Define.
+
 2007-03-30  Richard Henderson  <rth@redhat.com>
 
        * tree-ssa-loop-ivopts.c: Include target.h.
index 8fe5c3cfb51451478e9fab4deaf903ca51e7ac8a..60901bf6a6c4dbe71e6fef185208d68dd22f5ea5 100644 (file)
@@ -1,3 +1,11 @@
+2007-03-30  Rafael Avila de Espindola  <espindola@google.com>
+
+       * trans.c (Attribute_to_gnu): Use get_signed_or_unsigned_type
+       instead of gnat_signed_or_unsigned_type.
+       * utils.c (gnat_signed_or_unsigned_type): Remove.
+       * misc.c (LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): Remove
+       * gigi.h (gnat_signed_or_unsigned_type): Remove
+
 2007-03-09  Roger Sayle  <roger@eyesopen.com>
 
        * cuintp.c (UI_To_gnu): Use fold_buildN calls instead of calling
index 1c1c161334dd84ab599e1209b3725f01c165bf6d..b16649fa1a6397691c79c440d8a7dfabb5bc8437 100644 (file)
@@ -454,10 +454,6 @@ extern tree gnat_unsigned_type (tree type_node);
 /* Return the signed version of a TYPE_NODE, a scalar type.  */
 extern tree gnat_signed_type (tree type_node);
 
-/* Return a type the same as TYPE except unsigned or signed according to
-   UNSIGNEDP.  */
-extern tree gnat_signed_or_unsigned_type (int unsignedp, tree type);
-
 /* Create an expression whose value is that of EXPR,
    converted to type TYPE.  The TREE_TYPE of the value
    is always TYPE.  This function implements all reasonable
index 67de3ffa7bcff47256a3c6f1cf0436f6640319af..bd22e7e71e010d7c1b827e2cf35ea047c6a0810c 100644 (file)
@@ -161,8 +161,6 @@ static tree gnat_type_max_size              (tree);
 #define LANG_HOOKS_SIGNED_TYPE         gnat_signed_type
 #undef  LANG_HOOKS_UNSIGNED_TYPE
 #define LANG_HOOKS_UNSIGNED_TYPE       gnat_unsigned_type
-#undef  LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
-#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE gnat_signed_or_unsigned_type
 #undef  LANG_HOOKS_ATTRIBUTE_TABLE
 #define LANG_HOOKS_ATTRIBUTE_TABLE     gnat_internal_attribute_table
 #undef  LANG_HOOKS_BUILTIN_FUNCTION
index 965382278b8b28de940ce8df6d5cbf37f6a21b1e..230dccf2ea50dd10c2a264768d9b77879c8fc544 100644 (file)
@@ -876,7 +876,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
          /* 'Length or 'Range_Length.  */
          {
            tree gnu_compute_type
-             = gnat_signed_or_unsigned_type (0,
+             = get_signed_or_unsigned_type (0,
                                              get_base_type (gnu_result_type));
 
            gnu_result
index 42c9a9df23ed30fdfc41ea4bb3e1017a885424c7..1782ca9eec833cdf0d41d58b3b9e7c3f19339006 100644 (file)
@@ -2307,17 +2307,6 @@ gnat_signed_type (tree type_node)
   return type;
 }
 
-/* Return a type the same as TYPE except unsigned or signed according to
-   UNSIGNEDP.  */
-
-tree
-gnat_signed_or_unsigned_type (int unsignedp, tree type)
-{
-  if (!INTEGRAL_TYPE_P (type) || TYPE_UNSIGNED (type) == unsignedp)
-    return type;
-  else
-    return gnat_type_for_size (TYPE_PRECISION (type), unsignedp);
-}
 \f
 /* EXP is an expression for the size of an object.  If this size contains
    discriminant references, replace them with the maximum (if MAX_P) or
index 1e22c8ca3f82377cf4404ba7a906cc63ac146730..653eb56ce961f8ef241f988e8a2aef8712353598 100644 (file)
@@ -4384,7 +4384,7 @@ store_expr (tree exp, rtx target, int call_param_p)
          if (TYPE_UNSIGNED (TREE_TYPE (exp))
              != SUBREG_PROMOTED_UNSIGNED_P (target))
            exp = fold_convert
-             (lang_hooks.types.signed_or_unsigned_type
+             (get_signed_or_unsigned_type
               (SUBREG_PROMOTED_UNSIGNED_P (target), TREE_TYPE (exp)), exp);
 
          exp = fold_convert (lang_hooks.types.type_for_mode
index 66bcbbcd3620bc4d01013c63d88fef277f6b444c..5ee9cf1c56695a469a70d402f90820751ec77333 100644 (file)
@@ -3032,7 +3032,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 (lang_hooks.types.signed_or_unsigned_type
+      primarg1 = fold_convert (get_signed_or_unsigned_type
                               (unsignedp1, TREE_TYPE (primarg1)), primarg1);
 
       if (operand_equal_p (arg0, fold_convert (type, primarg1), 0))
index ddb515bd995723c1187c53c9b475513924bed9b1..1697e44b4d8d110a70d886a4f134d4f51389cadf 100644 (file)
@@ -1,3 +1,12 @@
+2007-03-30  Rafael Avila de Espindola  <espindola@google.com>
+
+       * trans-types.c (gfc_signed_or_unsigned_type): Remove.
+       (gfc_unsigned_type): Use get_signed_or_unsigned_type instead of
+       gfc_signed_or_unsigned_type.
+       (gfc_signed_type): Ditto.
+       * trans-types.h (gfc_signed_or_unsigned_type): Remove.
+       * f95-lang.c (LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): Remove.
+
 2007-03-30  Tobias Schlüter  <tobi@gcc.gnu.org>
 
        * symbol.c (gfc_find_gsymbol): Simplify, don't unconditionally
index 8f9c206c77f58249aa1bf8011a4a5fef15ea7a67..c498398dd5db45f77949b30b0bfe48cff56887b9 100644 (file)
@@ -115,7 +115,6 @@ static HOST_WIDE_INT gfc_get_alias_set (tree);
 #undef LANG_HOOKS_TYPE_FOR_SIZE
 #undef LANG_HOOKS_UNSIGNED_TYPE
 #undef LANG_HOOKS_SIGNED_TYPE
-#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
 #undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
 #undef LANG_HOOKS_CLEAR_BINDING_STACK
 #undef LANG_HOOKS_GET_ALIAS_SET
@@ -141,7 +140,6 @@ static HOST_WIDE_INT gfc_get_alias_set (tree);
 #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_SIGNED_OR_UNSIGNED_TYPE gfc_signed_or_unsigned_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
index db93a109045cb75a2ba1fa71a57ae1f2e13ab185..80cdb25b0d35ff9987eb2c1372781c34306a4a00 100644 (file)
@@ -1832,24 +1832,12 @@ gfc_type_for_mode (enum machine_mode mode, int unsignedp)
   return NULL_TREE;
 }
 
-/* Return a type the same as TYPE except unsigned or
-   signed according to UNSIGNEDP.  */
-
-tree
-gfc_signed_or_unsigned_type (int unsignedp, tree type)
-{
-  if (TREE_CODE (type) != INTEGER_TYPE || TYPE_UNSIGNED (type) == unsignedp)
-    return type;
-  else
-    return gfc_type_for_size (TYPE_PRECISION (type), unsignedp);
-}
-
 /* Return an unsigned type the same as TYPE in other respects.  */
 
 tree
 gfc_unsigned_type (tree type)
 {
-  return gfc_signed_or_unsigned_type (1, type);
+  return get_signed_or_unsigned_type (1, type);
 }
 
 /* Return a signed type the same as TYPE in other respects.  */
@@ -1857,7 +1845,7 @@ gfc_unsigned_type (tree type)
 tree
 gfc_signed_type (tree type)
 {
-  return gfc_signed_or_unsigned_type (0, type);
+  return get_signed_or_unsigned_type (0, type);
 }
 
 #include "gt-fortran-trans-types.h"
index af77c1de788966490cef9f7a806c641a59b07110..2c05f81d51a13009526adba7275519a4e741b978 100644 (file)
@@ -76,7 +76,6 @@ 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_signed_or_unsigned_type (int, tree);
 
 tree gfc_get_element_type (tree);
 tree gfc_get_array_type_bounds (tree, int, tree *, tree *, int);
index 965f7abb41b698b60696eac474f33dadd0aa8afa..f979728bdaf6aca82c40ce644002681910e2abe9 100644 (file)
@@ -1,3 +1,12 @@
+2007-03-30  Rafael Avila de Espindola  <espindola@google.com>
+
+       * typeck.c (java_signed_or_unsigned_type): Removed.
+       (java_signed_type): use get_signed_or_unsigned_type instead of
+       java_signed_or_unsigned_type.
+       (java_unsigned_type): Ditto.
+       * lang.c (LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE): Removed.
+       * java-tree.h (java_signed_or_unsigned_type): Removed.
+
 2007-03-26  Tom Tromey  <tromey@redhat.com>
 
        * Make-lang.in (JAVA_MANFILES): Removed grmiregistry.1.
index 4a413712fe2d0548485a0ee0a2c70601dcc472ec..c11f83e337c4f4ec8559c8835ced8986aaf07664 100644 (file)
@@ -1101,7 +1101,6 @@ 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_signed_or_unsigned_type (int, tree);
 extern tree java_truthvalue_conversion (tree);
 extern void add_assume_compiled (const char *, int);
 extern void add_enable_assert (const char *, int);
index b1912cc1128f15717622b95c446e8fa458b7f973..723d9a69a4351e658caa50c34d4371ec99e91710 100644 (file)
@@ -186,8 +186,6 @@ struct language_function GTY(())
 #define LANG_HOOKS_SIGNED_TYPE java_signed_type
 #undef LANG_HOOKS_UNSIGNED_TYPE
 #define LANG_HOOKS_UNSIGNED_TYPE java_unsigned_type
-#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
-#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE java_signed_or_unsigned_type
 
 #undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
 #define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN java_dump_tree
index 395168fa706afa2fed2875ee2b792c0b8adb6784..b35461b47616fb89eb0fcd6f51b6f0cb77cdeb12 100644 (file)
@@ -195,31 +195,12 @@ java_type_for_size (unsigned bits, int unsignedp)
   return 0;
 }
 
-/* Return a type the same as TYPE except unsigned or
-   signed according to UNSIGNEDP.  */
-
-tree
-java_signed_or_unsigned_type (int unsignedp, tree type)
-{
-  if (! INTEGRAL_TYPE_P (type))
-    return type;
-  if (TYPE_PRECISION (type) == TYPE_PRECISION (int_type_node))
-    return unsignedp ? unsigned_int_type_node : int_type_node;
-  if (TYPE_PRECISION (type) == TYPE_PRECISION (byte_type_node))
-    return unsignedp ? unsigned_byte_type_node : byte_type_node;
-  if (TYPE_PRECISION (type) == TYPE_PRECISION (short_type_node))
-    return unsignedp ? unsigned_short_type_node : short_type_node;
-  if (TYPE_PRECISION (type) == TYPE_PRECISION (long_type_node))
-    return unsignedp ? unsigned_long_type_node : long_type_node;
-  return type;
-}
-
 /* Return a signed type the same as TYPE in other respects.  */
 
 tree
 java_signed_type (tree type)
 {
-  return java_signed_or_unsigned_type (0, type);
+  return get_signed_or_unsigned_type (0, type);
 }
 
 /* Return an unsigned type the same as TYPE in other respects.  */
@@ -227,7 +208,7 @@ java_signed_type (tree type)
 tree
 java_unsigned_type (tree type)
 {
-  return java_signed_or_unsigned_type (1, type);
+  return get_signed_or_unsigned_type (1, type);
 }
 
 /* Mark EXP saying that we need to be able to take the
index 1165d344fefa3088371da8f36ff52e11ec48732b..572990039a276cf73faef680d864236502b3ca99 100644 (file)
@@ -130,6 +130,7 @@ 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
index 9a33bcafc9e370378d22f59dc930fe86842451bd..1ba6ec224cf052d20d69ef7e0938fad02e2611f8 100644 (file)
@@ -621,3 +621,24 @@ 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)
+{
+  if (!INTEGRAL_TYPE_P (type) || TYPE_UNSIGNED (type) == unsignedp)
+    return 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)
+{
+  return lang_hooks.types.type_for_size (TYPE_PRECISION (type), unsignedp);
+}
index db7a35e16a5ced883e48fd72048b27c159507e5d..b7116103f85c4a4f3b215525d6fd2f6bd6b1cccb 100644 (file)
@@ -461,5 +461,6 @@ 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 */
index c3512960be266fb759f2cc2cbbf029e42ea282e1..64efe7c60fe1d855791cbddb4b13720cbf4646c4 100644 (file)
@@ -3806,6 +3806,8 @@ 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.  */
index 0f08dd69870c9095d6e061dfe583fa165a01295b..2903de6d788f944cb87de7f1db3427b4d81a2ccb 100644 (file)
@@ -1,3 +1,8 @@
+2007-03-30  Rafael Avila de Espindola  <espindola@google.com>
+
+       * treetree.c (tree_lang_signed_or_unsigned_type): Remove.
+       (LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE) Remove.
+
 2007-03-01  Brooks Moses  <brooks.moses@codesourcery.com>
 
        * Make-lang.in: Add install-pdf target as copied from
index aade17c8b9546611288ad410a82438dc8f66f846..0645b9d1da55036388ef7148a5f1314ff4536fd7 100644 (file)
@@ -129,7 +129,6 @@ 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);
-static tree tree_lang_signed_or_unsigned_type (int unsignedp, tree type);
 
 /* Functions to keep track of the current scope.  */
 static void pushlevel (int ignore);
@@ -156,8 +155,6 @@ static void treelang_expand_function (tree fndecl);
 #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_SIGNED_OR_UNSIGNED_TYPE
-#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE tree_lang_signed_or_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
@@ -884,17 +881,6 @@ tree_lang_signed_type (tree type_node)
   return tree_lang_type_for_size (TYPE_PRECISION (type_node), 0);
 }
 
-/* Return a type the same as TYPE except unsigned or signed according to
-   UNSIGNEDP.  */
-
-static tree
-tree_lang_signed_or_unsigned_type (int unsignedp, tree type)
-{
-  if (! INTEGRAL_TYPE_P (type) || TYPE_UNSIGNED (type) == unsignedp)
-    return type;
-  else
-    return tree_lang_type_for_size (TYPE_PRECISION (type), unsignedp);
-}
 \f
 /* These functions and variables deal with binding contours.  We only
    need these functions for the list of PARM_DECLs, but we leave the