* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124715
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-05-14 Rafael Avila de Espindola <espindola@google.com>
+
+ * 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 <kazu@codesourcery.com>
* config/m68k/m68k-protos.h: Rename m68k_interrupt_function_p
+2007-05-14 Rafael Avila de Espindola <espindola@google.com>
+
+ * misc.c (LANG_HOOKS_UNSIGNED_TYPE): Remove.
+
2007-05-02 Pascal Obry <obry@adacore.com>
* gnatchop.adb (Write_Source_Reference_Pragma): Change implementation
#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
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. */
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
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)
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. */
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"),
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);
"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
&& 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
#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
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)
|| !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,
/* 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,
+2007-05-14 Rafael Avila de Espindola <espindola@google.com>
+
+ * 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 <rus@google.com>
* cp/typeck.c (build_indirect_ref): Add call to
#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
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;
}
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))));
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))));
{
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);
{
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);
}
/* 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);
&& (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);
}
|| 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)),
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
+2007-05-14 Rafael Avila de Espindola <espindola@google.com>
+
+ * 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 <pault@gcc.gnu.org>
PR fortran/30746
#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
#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
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);
{
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));
/* 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);
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
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);
+2007-05-14 Rafael Avila de Espindola <espindola@google.com>
+
+ * 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 <andrew_pinski@playstation.sony.com>
* java-tree.h (lang_tree_node): Use GENERIC_NEXT
{
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);
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);
#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
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. */
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, \
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);
}
+/* 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. */
+2007-05-14 Rafael Avila de Espindola <espindola@google.com>
+
+ * treetree.c (tree_lang_unsigned_type): Remove.
+ (LANG_HOOKS_UNSIGNED_TYPE): Remove.
+
2007-03-30 Rafael Avila de Espindola <espindola@google.com>
* treetree.c (tree_lang_signed_or_unsigned_type): Remove.
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. */
#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
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