+2004-03-31 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * builtins.c, c-aux-info.c, c-common.c, c-cppbuiltin.c, c-decl.c:
+ Change most occurrences of TREE_UNSIGNED to TYPE_UNSIGNED.
+ * c-format.c, c-opts.c, c-pretty-print.c, c-typeck.c: Likewise.
+ * calls.c, convert.c, dbxout.c, dojump.c, dwarf2out.c: Likewise.
+ * expmed.c, expr.c, fold-const.c, function.c, integrate.c: Likewise.
+ * optabs.c, sdbout.c, stmt.c, stor-layout.c, tree-dump.c: Likewise.
+ * tree.c, config/iq2000/iq2000.c, config/m32r/m32r.c: Likewise.
+ * config/mips/mips.c, config/rs6000/rs6000.c: Likewise.
+ * config/s390/s390.c, config/sparc/sparc.c, objc/objc-act.c: Likewise.
+ * stor-layout.c (layout_type, case COMPLEX_TYPE): Test for
+ REAL_TYPE, not INTEGER_TYPE.
+ (layout_type, case VECTOR_TYPE): Simplify code.
+ * tree.c (build_vector_type_for_mode): Remove dup unsigned setting.
+ * tree.h: Update comments.
+ (STRIP_NOPS): Use TYPE_UNSIGNED.
+ (TYPE_UNSIGNED): New macro.
+ (TYPE_TRAP_SIGNED): Remove now redundant check.
+ (SAVE_EXPR_NOPLACEHOLDER): Don't use TREE_UNSIGNED.
+
2004-03-31 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* function.c (put_var_into_stack): Properly set orig_reg for indirect.
+2004-03-31 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * decl.c (gnat_to_gnu_entity, make_type_from_size):
+ Use TYPE_UNSIGNED, not TREE_UNSIGNED.
+ * trans.c (tree_transform, convert_with_check): Likewise.
+ * utils.c (gnat_signed_or_unsigned_type): Likewise.
+ (build_vms_descriptor, unchecked_convert): Likewise.
+ * utils2.c (nonbinary_modular_operation): Likewise.
+
2004-03-29 Javier Miranda <miranda@gnat.com>
* checks.adb (Null_Exclusion_Static_Checks): New subprogram
= TYPE_MODULAR_P (gnu_type)
? gnu_high : TYPE_MAX_VALUE (gnu_type);
TYPE_PRECISION (gnu_subtype) = esize;
- TREE_UNSIGNED (gnu_subtype) = 1;
+ TYPE_UNSIGNED (gnu_subtype) = 1;
TYPE_EXTRA_SUBTYPE_P (gnu_subtype) = 1;
TYPE_PACKED_ARRAY_TYPE_P (gnu_subtype)
= Is_Packed_Array_Type (gnat_entity);
/* This should be an unsigned type if the lower bound is constant
and non-negative or if the base type is unsigned; a signed type
otherwise. */
- TREE_UNSIGNED (gnu_type)
- = (TREE_UNSIGNED (TREE_TYPE (gnu_type))
+ TYPE_UNSIGNED (gnu_type)
+ = (TYPE_UNSIGNED (TREE_TYPE (gnu_type))
|| (TREE_CODE (TYPE_MIN_VALUE (gnu_type)) == INTEGER_CST
&& TREE_INT_CST_HIGH (TYPE_MIN_VALUE (gnu_type)) >= 0)
|| TYPE_BIASED_REPRESENTATION_P (gnu_type)
else if (TREE_CODE (gnu_high) == INTEGER_CST
&& TREE_OVERFLOW (gnu_high))
gnu_high = gnu_max;
- else if (TREE_UNSIGNED (gnu_base_subtype)
+ else if (TYPE_UNSIGNED (gnu_base_subtype)
|| TREE_CODE (gnu_high) == INTEGER_CST)
gnu_high = size_binop (MAX_EXPR, gnu_max, gnu_high);
else
= TYPE_MAX_VALUE (gnu_inner_type);
TYPE_PRECISION (gnu_subtype)
= TYPE_PRECISION (gnu_inner_type);
- TREE_UNSIGNED (gnu_subtype)
- = TREE_UNSIGNED (gnu_inner_type);
+ TYPE_UNSIGNED (gnu_subtype)
+ = TYPE_UNSIGNED (gnu_inner_type);
TYPE_EXTRA_SUBTYPE_P (gnu_subtype) = 1;
layout_type (gnu_subtype);
= ((TREE_CODE (type) == INTEGER_TYPE
&& TYPE_BIASED_REPRESENTATION_P (type))
|| biased_p);
- TREE_UNSIGNED (new_type)
- = TREE_UNSIGNED (type) | TYPE_BIASED_REPRESENTATION_P (new_type);
+ TYPE_UNSIGNED (new_type)
+ = TYPE_UNSIGNED (type) | TYPE_BIASED_REPRESENTATION_P (new_type);
TYPE_RM_SIZE_INT (new_type) = bitsize_int (size);
return new_type;
/* For right shifts, the type says what kind of shift to do,
so we may need to choose a different type. */
if (Nkind (gnat_node) == N_Op_Shift_Right
- && ! TREE_UNSIGNED (gnu_type))
+ && ! TYPE_UNSIGNED (gnu_type))
gnu_type = gnat_unsigned_type (gnu_type);
else if (Nkind (gnat_node) == N_Op_Shift_Right_Arithmetic
- && TREE_UNSIGNED (gnu_type))
+ && TYPE_UNSIGNED (gnu_type))
gnu_type = gnat_signed_type (gnu_type);
if (gnu_type != gnu_result_type)
/* Convert the lower bounds to signed types, so we're sure we're
comparing them properly. Likewise, convert the upper bounds
to unsigned types. */
- if (INTEGRAL_TYPE_P (gnu_in_basetype) && TREE_UNSIGNED (gnu_in_basetype))
+ if (INTEGRAL_TYPE_P (gnu_in_basetype) && TYPE_UNSIGNED (gnu_in_basetype))
gnu_in_lb = convert (gnat_signed_type (gnu_in_basetype), gnu_in_lb);
if (INTEGRAL_TYPE_P (gnu_in_basetype)
- && ! TREE_UNSIGNED (gnu_in_basetype))
+ && !TYPE_UNSIGNED (gnu_in_basetype))
gnu_in_ub = convert (gnat_unsigned_type (gnu_in_basetype), gnu_in_ub);
- if (INTEGRAL_TYPE_P (gnu_base_type) && TREE_UNSIGNED (gnu_base_type))
+ if (INTEGRAL_TYPE_P (gnu_base_type) && TYPE_UNSIGNED (gnu_base_type))
gnu_out_lb = convert (gnat_signed_type (gnu_base_type), gnu_out_lb);
- if (INTEGRAL_TYPE_P (gnu_base_type) && ! TREE_UNSIGNED (gnu_base_type))
+ if (INTEGRAL_TYPE_P (gnu_base_type) && !TYPE_UNSIGNED (gnu_base_type))
gnu_out_ub = convert (gnat_unsigned_type (gnu_base_type), gnu_out_ub);
/* Check each bound separately and only if the result bound
tree
gnat_signed_or_unsigned_type (int unsignedp, tree type)
{
- if (! INTEGRAL_TYPE_P (type) || TREE_UNSIGNED (type) == unsignedp)
+ if (! INTEGRAL_TYPE_P (type) || TYPE_UNSIGNED (type) == unsignedp)
return type;
else
return gnat_type_for_size (TYPE_PRECISION (type), unsignedp);
switch (GET_MODE_BITSIZE (TYPE_MODE (type)))
{
case 8:
- dtype = TREE_UNSIGNED (type) ? 2 : 6;
+ dtype = TYPE_UNSIGNED (type) ? 2 : 6;
break;
case 16:
- dtype = TREE_UNSIGNED (type) ? 3 : 7;
+ dtype = TYPE_UNSIGNED (type) ? 3 : 7;
break;
case 32:
- dtype = TREE_UNSIGNED (type) ? 4 : 8;
+ dtype = TYPE_UNSIGNED (type) ? 4 : 8;
break;
case 64:
- dtype = TREE_UNSIGNED (type) ? 5 : 9;
+ dtype = TYPE_UNSIGNED (type) ? 5 : 9;
break;
case 128:
- dtype = TREE_UNSIGNED (type) ? 25 : 26;
+ dtype = TYPE_UNSIGNED (type) ? 25 : 26;
break;
}
break;
&& 0 != compare_tree_int (TYPE_RM_SIZE (type),
GET_MODE_BITSIZE (TYPE_MODE (type)))
&& ! (INTEGRAL_TYPE_P (etype)
- && TREE_UNSIGNED (type) == TREE_UNSIGNED (etype)
+ && TYPE_UNSIGNED (type) == TYPE_UNSIGNED (etype)
&& operand_equal_p (TYPE_RM_SIZE (type),
(TYPE_RM_SIZE (etype) != 0
? TYPE_RM_SIZE (etype) : TYPE_SIZE (etype)),
0))
- && ! (TREE_UNSIGNED (type) && TREE_UNSIGNED (etype)))
+ && ! (TYPE_UNSIGNED (type) && TYPE_UNSIGNED (etype)))
{
tree base_type = gnat_type_for_mode (TYPE_MODE (type),
- TREE_UNSIGNED (type));
+ TYPE_UNSIGNED (type));
tree shift_expr
= convert (base_type,
size_binop (MINUS_EXPR,
/* If our type is the wrong signedness or isn't wide enough, make a new
type and convert both our operands to it. */
if (TYPE_PRECISION (op_type) < precision
- || TREE_UNSIGNED (op_type) != unsignedp)
+ || TYPE_UNSIGNED (op_type) != unsignedp)
{
/* Copy the node so we ensure it can be modified to make it modular. */
op_type = copy_node (gnat_type_for_size (precision, unsignedp));
XEXP (arg1_rtx, 0), Pmode,
XEXP (arg2_rtx, 0), Pmode,
convert_to_mode (TYPE_MODE (sizetype), arg3_rtx,
- TREE_UNSIGNED (sizetype)),
+ TYPE_UNSIGNED (sizetype)),
TYPE_MODE (sizetype));
/* Return the value in the proper mode for this function. */
data_type = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (t)));
/* Normally, `unsigned' is part of the deal. Not so if it comes
with a type qualifier. */
- if (TREE_UNSIGNED (t) && TYPE_QUALS (t))
+ if (TYPE_UNSIGNED (t) && TYPE_QUALS (t))
data_type = concat ("unsigned ", data_type, NULL);
break;
if (TREE_CODE (operand) == INTEGER_CST
&& TREE_CODE (type) == INTEGER_TYPE
- && TREE_UNSIGNED (type)
+ && TYPE_UNSIGNED (type)
&& skip_evaluation == 0
&& !int_fits_type_p (operand, type))
{
TREE_CONSTANT_OVERFLOW (t) = TREE_CONSTANT_OVERFLOW (expr);
/* No warning for converting 0x80000000 to int. */
- if (!(TREE_UNSIGNED (type) < TREE_UNSIGNED (TREE_TYPE (expr))
+ if (!(TYPE_UNSIGNED (type) < TYPE_UNSIGNED (TREE_TYPE (expr))
&& TREE_CODE (TREE_TYPE (expr)) == INTEGER_TYPE
&& TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (expr))))
/* If EXPR fits in the unsigned version of TYPE,
don't warn unless pedantic. */
if ((pedantic
- || TREE_UNSIGNED (type)
+ || TYPE_UNSIGNED (type)
|| ! constant_fits_type_p (expr,
c_common_unsigned_type (type)))
&& skip_evaluation == 0)
c_common_signed_or_unsigned_type (int unsignedp, tree type)
{
if (! INTEGRAL_TYPE_P (type)
- || TREE_UNSIGNED (type) == unsignedp)
+ || TYPE_UNSIGNED (type) == unsignedp)
return type;
/* Must check the mode of the types, not the precision. Enumeral types
but it *requires* conversion to FINAL_TYPE. */
if (op0 == primop0 && TREE_TYPE (op0) != *restype_ptr)
- unsignedp0 = TREE_UNSIGNED (TREE_TYPE (op0));
+ unsignedp0 = TYPE_UNSIGNED (TREE_TYPE (op0));
if (op1 == primop1 && TREE_TYPE (op1) != *restype_ptr)
- unsignedp1 = TREE_UNSIGNED (TREE_TYPE (op1));
+ unsignedp1 = TYPE_UNSIGNED (TREE_TYPE (op1));
/* If one of the operands must be floated, we cannot optimize. */
real1 = TREE_CODE (TREE_TYPE (primop0)) == REAL_TYPE;
int min_gt, max_gt, min_lt, max_lt;
tree maxval, minval;
/* 1 if comparison is nominally unsigned. */
- int unsignedp = TREE_UNSIGNED (*restype_ptr);
+ int unsignedp = TYPE_UNSIGNED (*restype_ptr);
tree val;
type = c_common_signed_or_unsigned_type (unsignedp0,
{
type = common_type (TREE_TYPE (primop0), TREE_TYPE (primop1));
type = c_common_signed_or_unsigned_type (unsignedp0
- || TREE_UNSIGNED (*restype_ptr),
+ || TYPE_UNSIGNED (*restype_ptr),
type);
/* Make sure shorter operand is extended the right way
to match the longer operand. */
primop1 = op1;
if (!real1 && !real2 && integer_zerop (primop1)
- && TREE_UNSIGNED (*restype_ptr))
+ && TYPE_UNSIGNED (*restype_ptr))
{
tree value = 0;
switch (code)
/* If the constant is unsigned, and smaller than the pointer size,
then we must skip this optimization. This is because it could cause
an overflow error if the constant is negative but INTOP is not. */
- && (! TREE_UNSIGNED (TREE_TYPE (intop))
+ && (! TYPE_UNSIGNED (TREE_TYPE (intop))
|| (TYPE_PRECISION (TREE_TYPE (intop))
== TYPE_PRECISION (TREE_TYPE (ptrop)))))
{
so the multiply won't overflow spuriously. */
if (TYPE_PRECISION (TREE_TYPE (intop)) != TYPE_PRECISION (sizetype)
- || TREE_UNSIGNED (TREE_TYPE (intop)) != TREE_UNSIGNED (sizetype))
+ || TYPE_UNSIGNED (TREE_TYPE (intop)) != TYPE_UNSIGNED (sizetype))
intop = convert (c_common_type_for_size (TYPE_PRECISION (sizetype),
- TREE_UNSIGNED (sizetype)), intop);
+ TYPE_UNSIGNED (sizetype)), intop);
/* Replace the integer argument with a suitable product by the object size.
Do this multiplication as signed, then convert to the appropriate
/* The C standard specifically allows aliasing between signed and
unsigned variants of the same type. We treat the signed
variant as canonical. */
- if (TREE_CODE (t) == INTEGER_TYPE && TREE_UNSIGNED (t))
+ if (TREE_CODE (t) == INTEGER_TYPE && TYPE_UNSIGNED (t))
{
tree t1 = c_common_signed_type (t);
wchar_type_size = TYPE_PRECISION (wchar_type_node);
if (c_dialect_cxx ())
{
- if (TREE_UNSIGNED (wchar_type_node))
+ if (TYPE_UNSIGNED (wchar_type_node))
wchar_type_node = make_unsigned_type (wchar_type_size);
else
wchar_type_node = make_signed_type (wchar_type_size);
warning ("use __attribute__ ((vector_size)) instead");
}
- typefm = lang_hooks.types.type_for_mode (mode, TREE_UNSIGNED (type));
+ typefm = lang_hooks.types.type_for_mode (mode, TYPE_UNSIGNED (type));
if (typefm == NULL_TREE)
error ("no data type for mode `%s'", p);
if (!flag_signed_char)
cpp_define (pfile, "__CHAR_UNSIGNED__");
- if (c_dialect_cxx () && TREE_UNSIGNED (wchar_type_node))
+ if (c_dialect_cxx () && TYPE_UNSIGNED (wchar_type_node))
cpp_define (pfile, "__WCHAR_UNSIGNED__");
/* Make the choice of ObjC runtime visible to source code. */
default: abort ();
}
- value = values[idx + TREE_UNSIGNED (type)];
- suffix = suffixes[is_long * 2 + TREE_UNSIGNED (type)];
+ value = values[idx + TYPE_UNSIGNED (type)];
+ suffix = suffixes[is_long * 2 + TYPE_UNSIGNED (type)];
buf = alloca (strlen (macro) + 1 + strlen (value) + strlen (suffix) + 1);
sprintf (buf, "%s=%s%s", macro, value, suffix);
w = tree_low_cst (*width, 1);
if (TREE_CODE (*type) == ENUMERAL_TYPE
- && (w < min_precision (TYPE_MIN_VALUE (*type), TREE_UNSIGNED (*type))
- || w < min_precision (TYPE_MAX_VALUE (*type), TREE_UNSIGNED (*type))))
+ && (w < min_precision (TYPE_MIN_VALUE (*type), TYPE_UNSIGNED (*type))
+ || w < min_precision (TYPE_MAX_VALUE (*type),
+ TYPE_UNSIGNED (*type))))
warning ("`%s' is narrower than values of its type", name);
}
\f
TYPE_MODE (ref) = TYPE_MODE (unsigned_type_node);
TYPE_ALIGN (ref) = TYPE_ALIGN (unsigned_type_node);
TYPE_USER_ALIGN (ref) = 0;
- TREE_UNSIGNED (ref) = 1;
+ TYPE_UNSIGNED (ref) = 1;
TYPE_PRECISION (ref) = TYPE_PRECISION (unsigned_type_node);
TYPE_MIN_VALUE (ref) = TYPE_MIN_VALUE (unsigned_type_node);
TYPE_MAX_VALUE (ref) = TYPE_MAX_VALUE (unsigned_type_node);
TYPE_MIN_VALUE (enumtype) = minnode;
TYPE_MAX_VALUE (enumtype) = maxnode;
TYPE_PRECISION (enumtype) = precision;
- TREE_UNSIGNED (enumtype) = unsign;
+ TYPE_UNSIGNED (enumtype) = unsign;
TYPE_SIZE (enumtype) = 0;
layout_type (enumtype);
TYPE_PRECISION (tem) = TYPE_PRECISION (enumtype);
TYPE_ALIGN (tem) = TYPE_ALIGN (enumtype);
TYPE_USER_ALIGN (tem) = TYPE_USER_ALIGN (enumtype);
- TREE_UNSIGNED (tem) = TREE_UNSIGNED (enumtype);
+ TYPE_UNSIGNED (tem) = TYPE_UNSIGNED (enumtype);
}
/* Finish debugging output for this type. */
TYPE_PRECISION (integer_type_node)),
(TYPE_PRECISION (type)
>= TYPE_PRECISION (integer_type_node)
- && TREE_UNSIGNED (type)));
+ && TYPE_UNSIGNED (type)));
decl = build_decl (CONST_DECL, name, type);
DECL_INITIAL (decl) = convert (type, value);
if (c_promoting_integer_type_p (restype))
{
/* It retains unsignedness if not really getting wider. */
- if (TREE_UNSIGNED (restype)
+ if (TYPE_UNSIGNED (restype)
&& (TYPE_PRECISION (restype)
== TYPE_PRECISION (integer_type_node)))
restype = unsigned_type_node;
if (TREE_CODE (wanted_type) == INTEGER_TYPE
&& TREE_CODE (cur_type) == INTEGER_TYPE
&& (! pedantic || i == 0 || (i == 1 && char_type_flag))
- && (TREE_UNSIGNED (wanted_type)
+ && (TYPE_UNSIGNED (wanted_type)
? wanted_type == c_common_unsigned_type (cur_type)
: wanted_type == c_common_signed_type (cur_type)))
continue;
cpp_opts->char_precision = TYPE_PRECISION (char_type_node);
cpp_opts->int_precision = TYPE_PRECISION (integer_type_node);
cpp_opts->wchar_precision = TYPE_PRECISION (wchar_type_node);
- cpp_opts->unsigned_wchar = TREE_UNSIGNED (wchar_type_node);
+ cpp_opts->unsigned_wchar = TYPE_UNSIGNED (wchar_type_node);
cpp_opts->bytes_big_endian = BYTES_BIG_ENDIAN;
/* This can't happen until after wchar_precision and bytes_big_endian
if (TYPE_NAME (t))
t = TYPE_NAME (t);
else
- t = c_common_type_for_mode (TYPE_MODE (t), TREE_UNSIGNED (t));
+ t = c_common_type_for_mode (TYPE_MODE (t), TYPE_UNSIGNED (t));
pp_c_type_specifier (pp, t);
break;
TREE_INT_CST_HIGH (i), TREE_INT_CST_LOW (i));
pp_string (pp, pp_buffer (pp)->digit_buffer);
}
- if (TREE_UNSIGNED (type))
+ if (TYPE_UNSIGNED (type))
pp_character (pp, 'u');
if (type == long_integer_type_node || type == long_unsigned_type_node)
pp_character (pp, 'l');
if (type == wchar_type_node)
pp_character (pp, 'L');
pp_quote (pp);
- if (host_integerp (c, TREE_UNSIGNED (type)))
- pp_c_char (pp, tree_low_cst (c, TREE_UNSIGNED (type)));
+ if (host_integerp (c, TYPE_UNSIGNED (type)))
+ pp_c_char (pp, tree_low_cst (c, TYPE_UNSIGNED (type)));
else
pp_scalar (pp, "\\x%x", (unsigned) TREE_INT_CST_LOW (c));
pp_quote (pp);
if (c_promoting_integer_type_p (type))
{
/* Preserve unsignedness if not really getting any wider. */
- if (TREE_UNSIGNED (type)
+ if (TYPE_UNSIGNED (type)
&& (TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node)))
return unsigned_type_node;
return integer_type_node;
{
/* But preserve unsignedness from the other type,
since long cannot hold all the values of an unsigned int. */
- if (TREE_UNSIGNED (t1) || TREE_UNSIGNED (t2))
+ if (TYPE_UNSIGNED (t1) || TYPE_UNSIGNED (t2))
t1 = long_unsigned_type_node;
else
t1 = long_integer_type_node;
/* Otherwise prefer the unsigned one. */
- if (TREE_UNSIGNED (t1))
+ if (TYPE_UNSIGNED (t1))
return build_type_attribute_variant (t1, attributes);
else
return build_type_attribute_variant (t2, attributes);
are compatible with each other only if they are the same type. */
if (TREE_CODE (t1) == ENUMERAL_TYPE && TREE_CODE (t2) != ENUMERAL_TYPE)
- t1 = c_common_type_for_size (TYPE_PRECISION (t1), TREE_UNSIGNED (t1));
+ t1 = c_common_type_for_size (TYPE_PRECISION (t1), TYPE_UNSIGNED (t1));
else if (TREE_CODE (t2) == ENUMERAL_TYPE && TREE_CODE (t1) != ENUMERAL_TYPE)
- t2 = c_common_type_for_size (TYPE_PRECISION (t2), TREE_UNSIGNED (t2));
+ t2 = c_common_type_for_size (TYPE_PRECISION (t2), TYPE_UNSIGNED (t2));
if (t1 == t2)
return 1;
TYPE_PRECISION (integer_type_node)),
((TYPE_PRECISION (type)
>= TYPE_PRECISION (integer_type_node))
- && TREE_UNSIGNED (type)));
+ && TYPE_UNSIGNED (type)));
return convert (type, exp);
}
if (c_promoting_integer_type_p (type))
{
/* Preserve unsignedness if not really getting any wider. */
- if (TREE_UNSIGNED (type)
+ if (TYPE_UNSIGNED (type)
&& TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))
return convert (unsigned_type_node, exp);
;
else if (formal_prec != TYPE_PRECISION (type1))
warn_for_assignment ("%s with different width due to prototype", (char *) 0, name, parmnum + 1);
- else if (TREE_UNSIGNED (type) == TREE_UNSIGNED (type1))
+ else if (TYPE_UNSIGNED (type) == TYPE_UNSIGNED (type1))
;
/* Don't complain if the formal parameter type
is an enum, because we can't tell now whether
pass it as signed or unsigned; the value
certainly is the same either way. */
else if (TYPE_PRECISION (TREE_TYPE (val)) < TYPE_PRECISION (type)
- && TREE_UNSIGNED (TREE_TYPE (val)))
+ && TYPE_UNSIGNED (TREE_TYPE (val)))
;
- else if (TREE_UNSIGNED (type))
+ else if (TYPE_UNSIGNED (type))
warn_for_assignment ("%s as unsigned due to prototype", (char *) 0, name, parmnum + 1);
else
warn_for_assignment ("%s as signed due to prototype", (char *) 0, name, parmnum + 1);
will be considered, but default promotions won't. */
if (warn_sign_compare && !skip_evaluation)
{
- int unsigned_op1 = TREE_UNSIGNED (TREE_TYPE (orig_op1));
- int unsigned_op2 = TREE_UNSIGNED (TREE_TYPE (orig_op2));
+ int unsigned_op1 = TYPE_UNSIGNED (TREE_TYPE (orig_op1));
+ int unsigned_op2 = TYPE_UNSIGNED (TREE_TYPE (orig_op2));
if (unsigned_op1 ^ unsigned_op2)
{
/* Do not warn if the result type is signed, since the
signed type will only be chosen if it can represent
all the values of the unsigned type. */
- if (! TREE_UNSIGNED (result_type))
+ if (! TYPE_UNSIGNED (result_type))
/* OK */;
/* Do not warn if the signed quantity is an unsuffixed
integer literal (or some static constant expression
}
}
- if (!TREE_UNSIGNED (type))
+ if (!TYPE_UNSIGNED (type))
{
bitpos = ((wchar_bytes - 1) * charwidth) + HOST_BITS_PER_CHAR;
if (bitpos < HOST_BITS_PER_WIDE_INT)
undefined if the quotient can't be represented in the
computation mode. We shorten only if unsigned or if
dividing by something we know != -1. */
- shorten = (TREE_UNSIGNED (TREE_TYPE (orig_op0))
+ shorten = (TYPE_UNSIGNED (TREE_TYPE (orig_op0))
|| (TREE_CODE (op1) == INTEGER_CST
&& ! integer_all_onesp (op1)));
common = 1;
on some targets, since the modulo instruction is undefined if the
quotient can't be represented in the computation mode. We shorten
only if unsigned or if dividing by something we know != -1. */
- shorten = (TREE_UNSIGNED (TREE_TYPE (orig_op0))
+ shorten = (TYPE_UNSIGNED (TREE_TYPE (orig_op0))
|| (TREE_CODE (op1) == INTEGER_CST
&& ! integer_all_onesp (op1)));
common = 1;
tree arg0 = get_narrower (op0, &unsigned0);
tree arg1 = get_narrower (op1, &unsigned1);
/* UNS is 1 if the operation to be done is an unsigned one. */
- int uns = TREE_UNSIGNED (result_type);
+ int uns = TYPE_UNSIGNED (result_type);
tree type;
final_type = result_type;
if ((TYPE_PRECISION (TREE_TYPE (op0))
== TYPE_PRECISION (TREE_TYPE (arg0)))
&& TREE_TYPE (op0) != final_type)
- unsigned0 = TREE_UNSIGNED (TREE_TYPE (op0));
+ unsigned0 = TYPE_UNSIGNED (TREE_TYPE (op0));
if ((TYPE_PRECISION (TREE_TYPE (op1))
== TYPE_PRECISION (TREE_TYPE (arg1)))
&& TREE_TYPE (op1) != final_type)
- unsigned1 = TREE_UNSIGNED (TREE_TYPE (op1));
+ unsigned1 = TYPE_UNSIGNED (TREE_TYPE (op1));
/* Now UNSIGNED0 is 1 if ARG0 zero-extends to FINAL_TYPE. */
final_type = result_type;
if (arg0 == op0 && final_type == TREE_TYPE (op0))
- unsigned_arg = TREE_UNSIGNED (TREE_TYPE (op0));
+ unsigned_arg = TYPE_UNSIGNED (TREE_TYPE (op0));
if (TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type)
/* We can shorten only if the shift count is less than the
number of bits in the smaller type size. */
&& compare_tree_int (op1, TYPE_PRECISION (TREE_TYPE (arg0))) < 0
/* We cannot drop an unsigned shift after sign-extension. */
- && (!TREE_UNSIGNED (final_type) || unsigned_arg))
+ && (!TYPE_UNSIGNED (final_type) || unsigned_arg))
{
/* Do an unsigned shift if the operand was zero-extended. */
result_type
if (warn_sign_compare && skip_evaluation == 0)
{
- int op0_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op0));
- int op1_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op1));
+ int op0_signed = ! TYPE_UNSIGNED (TREE_TYPE (orig_op0));
+ int op1_signed = ! TYPE_UNSIGNED (TREE_TYPE (orig_op1));
int unsignedp0, unsignedp1;
tree primop0 = get_narrower (op0, &unsignedp0);
tree primop1 = get_narrower (op1, &unsignedp1);
Do not warn if the comparison is being done in a signed type,
since the signed type will only be chosen if it can represent
all the values of the unsigned type. */
- if (! TREE_UNSIGNED (result_type))
+ if (! TYPE_UNSIGNED (result_type))
/* OK */;
/* Do not warn if both operands are the same signedness. */
else if (op0_signed == op1_signed)
}
mode = TYPE_MODE (type);
- unsignedp = TREE_UNSIGNED (type);
+ unsignedp = TYPE_UNSIGNED (type);
if (targetm.calls.promote_function_args (fndecl ? TREE_TYPE (fndecl) : 0))
mode = promote_mode (type, mode, &unsignedp, 1);
&& GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp)))
{
tree type = TREE_TYPE (exp);
- int unsignedp = TREE_UNSIGNED (type);
+ int unsignedp = TYPE_UNSIGNED (type);
int offset = 0;
/* If we don't promote as expected, something is wrong. */
{
int reg = GP_RETURN;
enum machine_mode mode = TYPE_MODE (valtype);
- int unsignedp = TREE_UNSIGNED (valtype);
+ int unsignedp = TYPE_UNSIGNED (valtype);
/* Since we define TARGET_PROMOTE_FUNCTION_RETURN that returns true,
we must promote the mode just as PROMOTE_MODE does. */
emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "memcpy"), 0,
VOIDmode, 3, dest_reg, Pmode, src_reg, Pmode,
convert_to_mode (TYPE_MODE (sizetype), bytes_rtx,
- TREE_UNSIGNED (sizetype)),
+ TYPE_UNSIGNED (sizetype)),
TYPE_MODE (sizetype));
#else
emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "bcopy"), 0,
VOIDmode, 3, src_reg, Pmode, dest_reg, Pmode,
convert_to_mode (TYPE_MODE (integer_type_node), bytes_rtx,
- TREE_UNSIGNED (integer_type_node)),
+ TYPE_UNSIGNED (integer_type_node)),
TYPE_MODE (integer_type_node));
#endif
}
int unsignedp;
mode = TYPE_MODE (valtype);
- unsignedp = TREE_UNSIGNED (valtype);
+ unsignedp = TYPE_UNSIGNED (valtype);
/* Since we define TARGET_PROMOTE_FUNCTION_RETURN that returns
true, we must promote the mode just as PROMOTE_MODE does. */
switch (altivec_type)
{
case 'v':
- unsigned_p = TREE_UNSIGNED (type);
+ unsigned_p = TYPE_UNSIGNED (type);
switch (mode)
{
case SImode:
{
if (type)
{
- int unsignedp = TREE_UNSIGNED (type);
+ int unsignedp = TYPE_UNSIGNED (type);
mode = promote_mode (type, TYPE_MODE (type), &unsignedp, 1);
}
/* Carefully distinguish all the standard types of C,
without messing up if the language is not C. We do this by
- testing TYPE_PRECISION and TREE_UNSIGNED. The old code used to
+ testing TYPE_PRECISION and TYPE_UNSIGNED. The old code used to
look at both the names and the above fields, but that's redundant.
Any type whose size is between two C types will be considered
to be the wider of the two types. Also, we do not have a
size, but that's fine, since neither can the assembler. */
if (TYPE_PRECISION (type) <= CHAR_TYPE_SIZE)
- return (qualifiers | (TREE_UNSIGNED (type) ? 12 : 2));
+ return (qualifiers | (TYPE_UNSIGNED (type) ? 12 : 2));
else if (TYPE_PRECISION (type) <= SHORT_TYPE_SIZE)
- return (qualifiers | (TREE_UNSIGNED (type) ? 13 : 3));
+ return (qualifiers | (TYPE_UNSIGNED (type) ? 13 : 3));
else if (TYPE_PRECISION (type) <= INT_TYPE_SIZE)
- return (qualifiers | (TREE_UNSIGNED (type) ? 14 : 4));
+ return (qualifiers | (TYPE_UNSIGNED (type) ? 14 : 4));
else
- return (qualifiers | (TREE_UNSIGNED (type) ? 15 : 5));
+ return (qualifiers | (TYPE_UNSIGNED (type) ? 15 : 5));
case REAL_TYPE:
/* If this is a range type, consider it to be the underlying
conversion necessitates an explicit sign-extension. In
the signed-to-unsigned case the high-order bits have to
be cleared. */
- if (TREE_UNSIGNED (type) != TREE_UNSIGNED (TREE_TYPE (expr))
+ if (TYPE_UNSIGNED (type) != TYPE_UNSIGNED (TREE_TYPE (expr))
&& (TYPE_PRECISION (TREE_TYPE (expr))
!= GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (expr)))))
code = CONVERT_EXPR;
|| outprec != GET_MODE_BITSIZE (TYPE_MODE (type)))
return build1 (NOP_EXPR, type,
convert (lang_hooks.types.type_for_mode
- (TYPE_MODE (type), TREE_UNSIGNED (type)),
+ (TYPE_MODE (type), TYPE_UNSIGNED (type)),
expr));
/* Here detect when we can distribute the truncation down past some
the target type is unsigned. */
if (TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST
&& tree_int_cst_sgn (TREE_OPERAND (expr, 1)) >= 0
- && TREE_UNSIGNED (type)
+ && TYPE_UNSIGNED (type)
&& TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)
{
/* If shift count is less than the width of the truncated type,
&& outprec >= TYPE_PRECISION (TREE_TYPE (arg1))
/* If signedness of arg0 and arg1 don't match,
we can't necessarily find a type to compare them in. */
- && (TREE_UNSIGNED (TREE_TYPE (arg0))
- == TREE_UNSIGNED (TREE_TYPE (arg1))))
+ && (TYPE_UNSIGNED (TREE_TYPE (arg0))
+ == TYPE_UNSIGNED (TREE_TYPE (arg1))))
goto trunc1;
break;
}
so use an integer type that will hold the values. */
if (TREE_CODE (typex) == ENUMERAL_TYPE)
typex = lang_hooks.types.type_for_size
- (TYPE_PRECISION (typex), TREE_UNSIGNED (typex));
+ (TYPE_PRECISION (typex), TYPE_UNSIGNED (typex));
/* But now perhaps TYPEX is as wide as INPREC.
In that case, do nothing special here.
signed-overflow undefinedness.
And we may need to do it as unsigned
if we truncate to the original size. */
- if (TREE_UNSIGNED (TREE_TYPE (expr))
- || (TREE_UNSIGNED (TREE_TYPE (arg0))
- && (TREE_UNSIGNED (TREE_TYPE (arg1))
+ if (TYPE_UNSIGNED (TREE_TYPE (expr))
+ || (TYPE_UNSIGNED (TREE_TYPE (arg0))
+ && (TYPE_UNSIGNED (TREE_TYPE (arg1))
|| ex_form == LSHIFT_EXPR
|| ex_form == RSHIFT_EXPR
|| ex_form == LROTATE_EXPR
so use an integer type that will hold the values. */
if (TREE_CODE (typex) == ENUMERAL_TYPE)
typex = lang_hooks.types.type_for_size
- (TYPE_PRECISION (typex), TREE_UNSIGNED (typex));
+ (TYPE_PRECISION (typex), TYPE_UNSIGNED (typex));
/* But now perhaps TYPEX is as wide as INPREC.
In that case, do nothing special here.
{
/* Don't do unsigned arithmetic where signed was wanted,
or vice versa. */
- if (TREE_UNSIGNED (TREE_TYPE (expr)))
+ if (TYPE_UNSIGNED (TREE_TYPE (expr)))
typex = lang_hooks.types.unsigned_type (typex);
else
typex = lang_hooks.types.signed_type (typex);
+2004-03-31 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * call.c (joust): Use TYPE_UNSIGNED, not TREE_UNSIGNED.
+ * class.c (check_bitfield_decl): Likewise.
+ * cvt.c (type_promotes_to): Likewise.
+ * decl.c (finish_enum): Likewise.
+ * mangle.c (write_builtin_type): Likewise.
+ * semantics.c (finish_switch_cond, finish_unary_op_expr): Likewise.
+ * typeck.c (type_after_usual_arithmetic_conversions): Likewise.
+ (build_binary_op): Likewise.
+
2004-03-31 Jan Hubicka <jh@suse.cz>
* tree.h (optimize_function): Kill prototype.
&& TREE_CODE (t2->type) == INTEGER_TYPE
&& (TYPE_PRECISION (t1->type)
== TYPE_PRECISION (t2->type))
- && (TREE_UNSIGNED (t1->u.next->type)
+ && (TYPE_UNSIGNED (t1->u.next->type)
|| (TREE_CODE (t1->u.next->type)
== ENUMERAL_TYPE)))
{
else if (TREE_CODE (type) == ENUMERAL_TYPE
&& (0 > compare_tree_int (w,
min_precision (TYPE_MIN_VALUE (type),
- TREE_UNSIGNED (type)))
+ TYPE_UNSIGNED (type)))
|| 0 > compare_tree_int (w,
min_precision
(TYPE_MAX_VALUE (type),
- TREE_UNSIGNED (type)))))
+ TYPE_UNSIGNED (type)))))
cp_warning_at ("`%D' is too small to hold all values of `%#T'",
field, type);
}
return inits;
}
-/* Called from build_vtt_inits via dfs_walk. BINFO is the binfo
- for the base in most derived. DATA is a TREE_LIST who's
- TREE_CHAIN is the type of the base being
- constructed whilst this secondary vptr is live. The TREE_UNSIGNED
- flag of DATA indicates that this is a constructor vtable. The
+/* Called from build_vtt_inits via dfs_walk. BINFO is the binfo for the base
+ in most derived. DATA is a TREE_LIST who's TREE_CHAIN is the type of the
+ base being constructed whilst this secondary vptr is live. The
TREE_TOP_LEVEL flag indicates that this is the primary VTT. */
static tree
-dfs_build_secondary_vptr_vtt_inits (tree binfo, void* data)
+dfs_build_secondary_vptr_vtt_inits (tree binfo, void *data)
{
tree l;
tree t;
int precision = MAX (TYPE_PRECISION (type),
TYPE_PRECISION (integer_type_node));
tree totype = c_common_type_for_size (precision, 0);
- if (TREE_UNSIGNED (type)
+ if (TYPE_UNSIGNED (type)
&& ! int_fits_type_p (TYPE_MAX_VALUE (type), totype))
type = c_common_type_for_size (precision, 1);
else
else if (c_promoting_integer_type_p (type))
{
/* Retain unsignedness if really not getting bigger. */
- if (TREE_UNSIGNED (type)
+ if (TYPE_UNSIGNED (type)
&& TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))
type = unsigned_type_node;
else
{
underlying_type = integer_types[itk];
if (TYPE_PRECISION (underlying_type) >= precision
- && TREE_UNSIGNED (underlying_type) == unsignedp)
+ && TYPE_UNSIGNED (underlying_type) == unsignedp)
break;
}
if (itk == itk_none)
TYPE_MODE (enumtype) = TYPE_MODE (underlying_type);
TYPE_ALIGN (enumtype) = TYPE_ALIGN (underlying_type);
TYPE_USER_ALIGN (enumtype) = TYPE_USER_ALIGN (underlying_type);
- TREE_UNSIGNED (enumtype) = TREE_UNSIGNED (underlying_type);
+ TYPE_UNSIGNED (enumtype) = TYPE_UNSIGNED (underlying_type);
/* Convert each of the enumerators to the type of the underlying
type of the enumeration. */
TYPE_PRECISION (t) = TYPE_PRECISION (enumtype);
TYPE_ALIGN (t) = TYPE_ALIGN (enumtype);
TYPE_USER_ALIGN (t) = TYPE_USER_ALIGN (enumtype);
- TREE_UNSIGNED (t) = TREE_UNSIGNED (enumtype);
+ TYPE_UNSIGNED (t) = TYPE_UNSIGNED (enumtype);
}
/* Finish debugging output for this type. */
if (itk == itk_none)
{
tree t = c_common_type_for_mode (TYPE_MODE (type),
- TREE_UNSIGNED (type));
+ TYPE_UNSIGNED (type));
if (type == t)
{
if (TYPE_PRECISION (type) == 128)
- write_char (TREE_UNSIGNED (type) ? 'o' : 'n');
+ write_char (TYPE_UNSIGNED (type) ? 'o' : 'n');
else
/* Couldn't find this type. */
abort ();
because if we did, int_fits_type_p would do the wrong thing
when checking case values for being in range,
and it's too hard to do the right thing. */
- if (TREE_UNSIGNED (TREE_TYPE (cond))
- == TREE_UNSIGNED (TREE_TYPE (index)))
+ if (TYPE_UNSIGNED (TREE_TYPE (cond))
+ == TYPE_UNSIGNED (TREE_TYPE (index)))
cond = index;
}
}
setting TREE_NEGATED_INT. */
if (code == NEGATE_EXPR && TREE_CODE (expr) == INTEGER_CST
&& TREE_CODE (result) == INTEGER_CST
- && !TREE_UNSIGNED (TREE_TYPE (result))
+ && !TYPE_UNSIGNED (TREE_TYPE (result))
&& INT_CST_LT (result, integer_zero_node))
TREE_NEGATED_INT (result) = 1;
overflow_warning (result);
if (same_type_p (TYPE_MAIN_VARIANT (t1), long_long_integer_type_node)
|| same_type_p (TYPE_MAIN_VARIANT (t2), long_long_integer_type_node))
{
- tree t = ((TREE_UNSIGNED (t1) || TREE_UNSIGNED (t2))
+ tree t = ((TYPE_UNSIGNED (t1) || TYPE_UNSIGNED (t2))
? long_long_unsigned_type_node
: long_long_integer_type_node);
return build_type_attribute_variant (t, attributes);
if (same_type_p (TYPE_MAIN_VARIANT (t1), long_integer_type_node)
|| same_type_p (TYPE_MAIN_VARIANT (t2), long_integer_type_node))
{
- tree t = ((TREE_UNSIGNED (t1) || TREE_UNSIGNED (t2))
+ tree t = ((TYPE_UNSIGNED (t1) || TYPE_UNSIGNED (t2))
? long_unsigned_type_node : long_integer_type_node);
return build_type_attribute_variant (t, attributes);
}
/* Otherwise prefer the unsigned one. */
- if (TREE_UNSIGNED (t1))
+ if (TYPE_UNSIGNED (t1))
return build_type_attribute_variant (t1, attributes);
else
return build_type_attribute_variant (t2, attributes);
point, so we have to dig out the original type to find out if
it was unsigned. */
shorten = ((TREE_CODE (op0) == NOP_EXPR
- && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op0, 0))))
+ && TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op0, 0))))
|| (TREE_CODE (op1) == INTEGER_CST
&& ! integer_all_onesp (op1)));
quotient can't be represented in the computation mode. We shorten
only if unsigned or if dividing by something we know != -1. */
shorten = ((TREE_CODE (op0) == NOP_EXPR
- && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op0, 0))))
+ && TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op0, 0))))
|| (TREE_CODE (op1) == INTEGER_CST
&& ! integer_all_onesp (op1)));
common = 1;
tree arg0 = get_narrower (op0, &unsigned0);
tree arg1 = get_narrower (op1, &unsigned1);
/* UNS is 1 if the operation to be done is an unsigned one. */
- int uns = TREE_UNSIGNED (result_type);
+ int uns = TYPE_UNSIGNED (result_type);
tree type;
final_type = result_type;
but it *requires* conversion to FINAL_TYPE. */
if (op0 == arg0 && TREE_TYPE (op0) != final_type)
- unsigned0 = TREE_UNSIGNED (TREE_TYPE (op0));
+ unsigned0 = TYPE_UNSIGNED (TREE_TYPE (op0));
if (op1 == arg1 && TREE_TYPE (op1) != final_type)
- unsigned1 = TREE_UNSIGNED (TREE_TYPE (op1));
+ unsigned1 = TYPE_UNSIGNED (TREE_TYPE (op1));
/* Now UNSIGNED0 is 1 if ARG0 zero-extends to FINAL_TYPE. */
final_type = result_type;
if (arg0 == op0 && final_type == TREE_TYPE (op0))
- unsigned_arg = TREE_UNSIGNED (TREE_TYPE (op0));
+ unsigned_arg = TYPE_UNSIGNED (TREE_TYPE (op0));
if (TYPE_PRECISION (TREE_TYPE (arg0)) < TYPE_PRECISION (result_type)
/* We can shorten only if the shift count is less than the
ones made by sign-extension and bring in zeros.
We can't optimize that case at all, but in most machines
it never happens because available widths are 2**N. */
- && (!TREE_UNSIGNED (final_type)
+ && (!TYPE_UNSIGNED (final_type)
|| unsigned_arg
|| (((unsigned) 2 * TYPE_PRECISION (TREE_TYPE (arg0)))
<= TYPE_PRECISION (result_type))))
bound the ranges of the arguments until that point. */
&& !processing_template_decl)
{
- int op0_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op0));
- int op1_signed = ! TREE_UNSIGNED (TREE_TYPE (orig_op1));
+ int op0_signed = !TYPE_UNSIGNED (TREE_TYPE (orig_op0));
+ int op1_signed = !TYPE_UNSIGNED (TREE_TYPE (orig_op1));
int unsignedp0, unsignedp1;
tree primop0 = get_narrower (op0, &unsignedp0);
/* Do not warn if the comparison is being done in a signed type,
since the signed type will only be chosen if it can represent
all the values of the unsigned type. */
- if (! TREE_UNSIGNED (result_type))
+ if (!TYPE_UNSIGNED (result_type))
/* OK */;
/* Do not warn if both operands are unsigned. */
else if (op0_signed == op1_signed)
}
/* And warn about assigning a negative value to an unsigned
variable. */
- else if (TREE_UNSIGNED (type) && TREE_CODE (type) != BOOLEAN_TYPE)
+ else if (TYPE_UNSIGNED (type) && TREE_CODE (type) != BOOLEAN_TYPE)
{
- if (TREE_CODE (expr) == INTEGER_CST
- && TREE_NEGATED_INT (expr))
+ if (TREE_CODE (expr) == INTEGER_CST && TREE_NEGATED_INT (expr))
{
if (fndecl)
warning ("passing negative value `%E' for %s %P of `%D'",
break;
case INTEGER_TYPE:
- if (type == char_type_node && ! TREE_UNSIGNED (type))
+ if (type == char_type_node && ! TYPE_UNSIGNED (type))
{
/* Output the type `char' as a subrange of itself!
I don't understand this definition, just copied it
fprintf (asmfile, "r");
CHARS (1);
dbxout_type_index (char_type_node);
- fprintf (asmfile, ";0;%d;", TREE_UNSIGNED (type) ? 255 : 127);
+ fprintf (asmfile, ";0;%d;", TYPE_UNSIGNED (type) ? 255 : 127);
CHARS (7);
}
break;
&& TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST
&& (TYPE_PRECISION (type) > TYPE_PRECISION (integer_type_node)
|| ((TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))
- && TREE_UNSIGNED (type))
+ && TYPE_UNSIGNED (type))
|| TYPE_PRECISION (type) > HOST_BITS_PER_WIDE_INT
|| (TYPE_PRECISION (type) == HOST_BITS_PER_WIDE_INT
- && TREE_UNSIGNED (type))))
+ && TYPE_UNSIGNED (type))))
return TRUE;
else
return FALSE;
temp = copy_to_reg (temp);
}
do_compare_rtx_and_jump (temp, CONST0_RTX (GET_MODE (temp)),
- NE, TREE_UNSIGNED (TREE_TYPE (exp)),
+ NE, TYPE_UNSIGNED (TREE_TYPE (exp)),
GET_MODE (temp), NULL_RTX,
if_false_label, if_true_label);
}
rtx op0 = expand_expr (TREE_OPERAND (exp, swap), NULL_RTX, VOIDmode, 0);
rtx op1 = expand_expr (TREE_OPERAND (exp, !swap), NULL_RTX, VOIDmode, 0);
enum machine_mode mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
- int unsignedp = TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0)));
+ int unsignedp = TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0)));
- do_jump_by_parts_greater_rtx (mode, unsignedp, op0, op1, if_false_label, if_true_label);
+ do_jump_by_parts_greater_rtx (mode, unsignedp, op0, op1, if_false_label,
+ if_true_label);
}
/* Compare OP0 with OP1, word at a time, in mode MODE.
for (i = 0; i < nwords; i++)
do_compare_rtx_and_jump (operand_subword_force (op0, i, mode),
operand_subword_force (op1, i, mode),
- EQ, TREE_UNSIGNED (TREE_TYPE (exp)),
+ EQ, TYPE_UNSIGNED (TREE_TYPE (exp)),
word_mode, NULL_RTX, if_false_label, NULL_RTX);
if (if_true_label)
type = TREE_TYPE (TREE_OPERAND (exp, 1));
mode = TYPE_MODE (type);
}
- unsignedp = TREE_UNSIGNED (type);
+ unsignedp = TYPE_UNSIGNED (type);
code = unsignedp ? unsigned_code : signed_code;
#ifdef HAVE_canonicalize_funcptr_for_compare
|| ! strcmp (type_name, "signed char")
|| ! strcmp (type_name, "unsigned char"))))
{
- if (TREE_UNSIGNED (type))
+ if (TYPE_UNSIGNED (type))
encoding = DW_ATE_unsigned;
else
encoding = DW_ATE_signed;
case CHAR_TYPE:
/* GNU Pascal/Ada CHAR type. Not used in C. */
- if (TREE_UNSIGNED (type))
+ if (TYPE_UNSIGNED (type))
encoding = DW_ATE_unsigned_char;
else
encoding = DW_ATE_signed_char;
{
dw_loc_descr_ref ret, ret1;
int indirect_p = 0;
- int unsignedp = TREE_UNSIGNED (TREE_TYPE (loc));
+ int unsignedp = TYPE_UNSIGNED (TREE_TYPE (loc));
enum dwarf_location_atom op;
/* ??? Most of the time we do not take proper care for sign/zero
goto do_binop;
case LE_EXPR:
- if (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (loc, 0))))
+ if (TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (loc, 0))))
return 0;
op = DW_OP_le;
goto do_binop;
case GE_EXPR:
- if (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (loc, 0))))
+ if (TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (loc, 0))))
return 0;
op = DW_OP_ge;
goto do_binop;
case LT_EXPR:
- if (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (loc, 0))))
+ if (TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (loc, 0))))
return 0;
op = DW_OP_lt;
goto do_binop;
case GT_EXPR:
- if (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (loc, 0))))
+ if (TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (loc, 0))))
return 0;
op = DW_OP_gt;
add_name_attribute (enum_die,
IDENTIFIER_POINTER (TREE_PURPOSE (link)));
- if (host_integerp (value, TREE_UNSIGNED (TREE_TYPE (value))))
+ if (host_integerp (value, TYPE_UNSIGNED (TREE_TYPE (value))))
/* DWARF2 does not provide a way of indicating whether or
not enumeration constants are signed or unsigned. GDB
always assumes the values are signed, so we output all
{
case CONST_INT:
t = build_int_2 (INTVAL (x),
- (TREE_UNSIGNED (type)
- && (GET_MODE_BITSIZE (TYPE_MODE (type)) < HOST_BITS_PER_WIDE_INT))
+ (TYPE_UNSIGNED (type)
+ && (GET_MODE_BITSIZE (TYPE_MODE (type))
+ < HOST_BITS_PER_WIDE_INT))
|| INTVAL (x) >= 0 ? 0 : -1);
TREE_TYPE (t) = type;
return t;
if (GET_MODE (srcreg) != BLKmode
&& GET_MODE_SIZE (GET_MODE (srcreg)) < UNITS_PER_WORD)
- srcreg = convert_to_mode (word_mode, srcreg, TREE_UNSIGNED (type));
+ srcreg = convert_to_mode (word_mode, srcreg, TYPE_UNSIGNED (type));
/* If the structure doesn't take up a whole number of words, see whether
SRCREG is padded on the left or on the right. If it's on the left,
return (want_value ? convert_modes (TYPE_MODE (TREE_TYPE (to)),
TYPE_MODE (TREE_TYPE (from)),
result,
- TREE_UNSIGNED (TREE_TYPE (to)))
+ TYPE_UNSIGNED (TREE_TYPE (to)))
: NULL_RTX);
}
VOIDmode, 3, XEXP (to_rtx, 0), Pmode,
XEXP (from_rtx, 0), Pmode,
convert_to_mode (TYPE_MODE (sizetype),
- size, TREE_UNSIGNED (sizetype)),
+ size, TYPE_UNSIGNED (sizetype)),
TYPE_MODE (sizetype));
else
emit_library_call (bcopy_libfunc, LCT_NORMAL,
XEXP (to_rtx, 0), Pmode,
convert_to_mode (TYPE_MODE (integer_type_node),
size,
- TREE_UNSIGNED (integer_type_node)),
+ TYPE_UNSIGNED (integer_type_node)),
TYPE_MODE (integer_type_node));
preserve_temp_slots (to_rtx);
&& INTEGRAL_TYPE_P (TREE_TYPE (exp))
&& TREE_TYPE (TREE_TYPE (exp)) == 0)
{
- if (TREE_UNSIGNED (TREE_TYPE (exp))
+ if (TYPE_UNSIGNED (TREE_TYPE (exp))
!= SUBREG_PROMOTED_UNSIGNED_P (target))
exp = convert
(lang_hooks.types.signed_or_unsigned_type
&& TREE_CODE (exp) != ERROR_MARK
&& GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp)))
temp = convert_modes (GET_MODE (target), TYPE_MODE (TREE_TYPE (exp)),
- temp, TREE_UNSIGNED (TREE_TYPE (exp)));
+ temp, TYPE_UNSIGNED (TREE_TYPE (exp)));
/* If value was not generated in the target, store it there.
Convert the value to TARGET's type first if necessary and emit the
if (GET_MODE (temp) != GET_MODE (target)
&& GET_MODE (temp) != VOIDmode)
{
- int unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
+ int unsignedp = TYPE_UNSIGNED (TREE_TYPE (exp));
if (dont_return_target)
{
/* In this case, we will return TEMP,
/* Copy that much. */
copy_size_rtx = convert_to_mode (ptr_mode, copy_size_rtx,
- TREE_UNSIGNED (sizetype));
+ TYPE_UNSIGNED (sizetype));
emit_block_move (target, temp, copy_size_rtx,
(want_value & 2
? BLOCK_OP_CALL_PARM : BLOCK_OP_NORMAL));
#ifdef POINTERS_EXTEND_UNSIGNED
if (GET_MODE (copy_size_rtx) != Pmode)
copy_size_rtx = convert_to_mode (Pmode, copy_size_rtx,
- TREE_UNSIGNED (sizetype));
+ TYPE_UNSIGNED (sizetype));
#endif
target = offset_address (target, copy_size_rtx,
if (TYPE_PRECISION (type) < BITS_PER_WORD)
{
type = lang_hooks.types.type_for_size
- (BITS_PER_WORD, TREE_UNSIGNED (type));
+ (BITS_PER_WORD, TYPE_UNSIGNED (type));
value = convert (type, value);
}
if (cleared && is_zeros_p (value))
continue;
- unsignedp = TREE_UNSIGNED (elttype);
+ unsignedp = TYPE_UNSIGNED (elttype);
mode = TYPE_MODE (elttype);
if (mode == BLKmode)
bitsize = (host_integerp (TYPE_SIZE (elttype), 1)
expand_expr (hi_index, NULL_RTX, VOIDmode, 0);
loop_end = gen_label_rtx ();
- unsignedp = TREE_UNSIGNED (domain);
+ unsignedp = TYPE_UNSIGNED (domain);
index = build_decl (VAR_DECL, NULL_TREE, domain);
else
{
mode = TYPE_MODE (TREE_TYPE (exp));
- *punsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
+ *punsignedp = TYPE_UNSIGNED (TREE_TYPE (exp));
if (mode == BLKmode)
size_tree = TYPE_SIZE (TREE_TYPE (exp));
{
rtx op0, op1, temp;
tree type = TREE_TYPE (exp);
- int unsignedp = TREE_UNSIGNED (type);
+ int unsignedp;
enum machine_mode mode;
enum tree_code code = TREE_CODE (exp);
optab this_optab;
}
mode = TYPE_MODE (type);
+ unsignedp = TYPE_UNSIGNED (type);
+
/* Use subtarget as the target for operand 0 of a binary operation. */
subtarget = get_subtarget (target);
original_target = target;
enum machine_mode imode
= TYPE_MODE (TREE_TYPE (TREE_PURPOSE (elt)));
- if (TREE_UNSIGNED (TREE_TYPE (TREE_PURPOSE (elt))))
+ if (TYPE_UNSIGNED (TREE_TYPE (TREE_PURPOSE (elt))))
{
op1 = GEN_INT (((HOST_WIDE_INT) 1 << bitsize) - 1);
op0 = expand_and (imode, op0, op1, target);
tree set = TREE_OPERAND (exp, 0);
tree index = TREE_OPERAND (exp, 1);
- int iunsignedp = TREE_UNSIGNED (TREE_TYPE (index));
+ int iunsignedp = TYPE_UNSIGNED (TREE_TYPE (index));
tree set_type = TREE_TYPE (set);
tree set_low_bound = TYPE_MIN_VALUE (TYPE_DOMAIN (set_type));
tree set_high_bound = TYPE_MAX_VALUE (TYPE_DOMAIN (set_type));
/* If the signedness of the conversion differs and OP0 is
a promoted SUBREG, clear that indication since we now
have to do the proper extension. */
- if (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))) != unsignedp
+ if (TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))) != unsignedp
&& GET_CODE (op0) == SUBREG)
SUBREG_PROMOTED_VAR_P (op0) = 0;
inner_mode));
else
return convert_modes (mode, inner_mode, op0,
- TREE_UNSIGNED (inner_type));
+ TYPE_UNSIGNED (inner_type));
}
if (modifier == EXPAND_INITIALIZER)
if (target == 0)
return
convert_to_mode (mode, op0,
- TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
+ TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
else
convert_move (target, op0,
- TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
+ TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
return target;
case VIEW_CONVERT_EXPR:
|| exact_log2 (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))) < 0))
||
(TREE_CODE (TREE_OPERAND (exp, 1)) == NOP_EXPR
- && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
- ==
- TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))))
+ && (TYPE_PRECISION (TREE_TYPE
+ (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
+ == TYPE_PRECISION (TREE_TYPE
+ (TREE_OPERAND
+ (TREE_OPERAND (exp, 0), 0))))
/* If both operands are extended, they must either both
be zero-extended or both be sign-extended. */
- && (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
- ==
- TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))))))
+ && (TYPE_UNSIGNED (TREE_TYPE
+ (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
+ == TYPE_UNSIGNED (TREE_TYPE
+ (TREE_OPERAND
+ (TREE_OPERAND (exp, 0), 0)))))))
{
tree op0type = TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0));
enum machine_mode innermode = TYPE_MODE (op0type);
- bool zextend_p = TREE_UNSIGNED (op0type);
+ bool zextend_p = TYPE_UNSIGNED (op0type);
optab other_optab = zextend_p ? smul_widen_optab : umul_widen_optab;
this_optab = zextend_p ? umul_widen_optab : smul_widen_optab;
op0 = copy_to_mode_reg (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))),
op0);
expand_float (target, op0,
- TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
+ TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
return target;
case NEGATE_EXPR:
/* Unsigned abs is simply the operand. Testing here means we don't
risk generating incorrect code below. */
- if (TREE_UNSIGNED (type))
+ if (TYPE_UNSIGNED (type))
return op0;
return expand_abs (mode, op0, target, unsignedp,
/* Increment however we can. */
op1 = expand_binop (mode, this_optab, value, op1, op0,
- TREE_UNSIGNED (TREE_TYPE (exp)), OPTAB_LIB_WIDEN);
+ TYPE_UNSIGNED (TREE_TYPE (exp)), OPTAB_LIB_WIDEN);
/* Make sure the value is stored into OP0. */
if (op1 != op0)
type = TREE_TYPE (arg0);
operand_mode = TYPE_MODE (type);
- unsignedp = TREE_UNSIGNED (type);
+ unsignedp = TYPE_UNSIGNED (type);
/* We won't bother with BLKmode store-flag operations because it would mean
passing a lot of information to emit_store_flag. */
op_mode = insn_data[(int) CODE_FOR_casesi].operand[1].mode;
op1 = convert_modes (op_mode, TYPE_MODE (TREE_TYPE (minval)),
- op1, TREE_UNSIGNED (TREE_TYPE (minval)));
+ op1, TYPE_UNSIGNED (TREE_TYPE (minval)));
if (! (*insn_data[(int) CODE_FOR_casesi].operand[1].predicate)
(op1, op_mode))
op1 = copy_to_mode_reg (op_mode, op1);
op_mode = insn_data[(int) CODE_FOR_casesi].operand[2].mode;
op2 = convert_modes (op_mode, TYPE_MODE (TREE_TYPE (range)),
- op2, TREE_UNSIGNED (TREE_TYPE (range)));
+ op2, TYPE_UNSIGNED (TREE_TYPE (range)));
if (! (*insn_data[(int) CODE_FOR_casesi].operand[2].predicate)
(op2, op_mode))
op2 = copy_to_mode_reg (op_mode, op2);
TYPE_MODE (TREE_TYPE (range)),
expand_expr (range, NULL_RTX,
VOIDmode, 0),
- TREE_UNSIGNED (TREE_TYPE (range))),
+ TYPE_UNSIGNED (TREE_TYPE (range))),
table_label, default_label);
return 1;
}
+2004-03-31 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * com.c (ffecom_arrayref_): Use TYPE_UNSIGNED, not TREE_UNSIGNED.
+ (ffecom_expr_): Likewise.
+
2004-03-30 Zack Weinberg <zack@codesourcery.com>
* com.c: Use new shorter form of GTY markers.
if (tree_type
&& GET_MODE_CLASS (TYPE_MODE (tree_type)) == MODE_INT
&& TYPE_PRECISION (tree_type) < TYPE_PRECISION (sizetype))
- tree_type_x = (TREE_UNSIGNED (tree_type) ? usizetype : ssizetype);
+ tree_type_x = (TYPE_UNSIGNED (tree_type) ? usizetype : ssizetype);
if (TREE_TYPE (min) != tree_type_x)
min = convert (tree_type_x, min);
if (tree_type
&& GET_MODE_CLASS (TYPE_MODE (tree_type)) == MODE_INT
&& TYPE_PRECISION (tree_type) < TYPE_PRECISION (sizetype))
- tree_type_x = (TREE_UNSIGNED (tree_type) ? usizetype : ssizetype);
+ tree_type_x = (TYPE_UNSIGNED (tree_type) ? usizetype : ssizetype);
element = convert (tree_type_x, element);
if (widenp && tree_type
&& GET_MODE_CLASS (TYPE_MODE (tree_type)) == MODE_INT
&& TYPE_PRECISION (tree_type) < TYPE_PRECISION (sizetype))
- tree_type_x = (TREE_UNSIGNED (tree_type) ? usizetype : ssizetype);
+ tree_type_x = (TYPE_UNSIGNED (tree_type) ? usizetype : ssizetype);
switch (ffebld_op (expr))
{
/* Unsigned types do not suffer sign extension or overflow unless they
are a sizetype. */
- if (TREE_UNSIGNED (TREE_TYPE (t))
+ if (TYPE_UNSIGNED (TREE_TYPE (t))
&& ! (TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE
&& TYPE_IS_SIZETYPE (TREE_TYPE (t))))
return overflow;
switch (TREE_CODE (t))
{
case INTEGER_CST:
- if (TREE_UNSIGNED (type) || ! flag_trapv)
+ if (TYPE_UNSIGNED (type) || ! flag_trapv)
return true;
/* Check that -CST will not overflow type. */
TREE_OPERAND (t, 1));
case MULT_EXPR:
- if (TREE_UNSIGNED (TREE_TYPE (t)))
+ if (TYPE_UNSIGNED (TREE_TYPE (t)))
break;
/* Fall through. */
case INTEGER_CST:
tem = fold_negate_const (t, type);
if (! TREE_OVERFLOW (tem)
- || TREE_UNSIGNED (type)
+ || TYPE_UNSIGNED (type)
|| ! flag_trapv)
return tem;
break;
break;
case MULT_EXPR:
- if (TREE_UNSIGNED (TREE_TYPE (t)))
+ if (TYPE_UNSIGNED (TREE_TYPE (t)))
break;
/* Fall through. */
&& (unsigned HOST_WIDE_INT) (TYPE_PRECISION (type) - 1)
== TREE_INT_CST_LOW (op1))
{
- tree ntype = TREE_UNSIGNED (type)
+ tree ntype = TYPE_UNSIGNED (type)
? lang_hooks.types.signed_type (type)
: lang_hooks.types.unsigned_type (type);
tree temp = fold_convert (ntype, TREE_OPERAND (t, 0));
HOST_WIDE_INT garbageh;
tree t;
tree type = TREE_TYPE (arg1);
- int uns = TREE_UNSIGNED (type);
+ int uns = TYPE_UNSIGNED (type);
int is_sizetype
= (TREE_CODE (type) == INTEGER_TYPE && TYPE_IS_SIZETYPE (type));
int overflow = 0;
abort ();
/* If the type is already signed, just do the simple thing. */
- if (! TREE_UNSIGNED (type))
+ if (!TYPE_UNSIGNED (type))
return size_binop (MINUS_EXPR, arg0, arg1);
ctype = (type == bitsizetype || type == ubitsizetype
TREE_OVERFLOW (t)
= ((force_fit_type (t,
(TREE_INT_CST_HIGH (arg1) < 0
- && (TREE_UNSIGNED (type)
- < TREE_UNSIGNED (TREE_TYPE (arg1)))))
+ && (TYPE_UNSIGNED (type)
+ < TYPE_UNSIGNED (TREE_TYPE (arg1)))))
&& ! POINTER_TYPE_P (TREE_TYPE (arg1)))
|| TREE_OVERFLOW (arg1));
TREE_CONSTANT_OVERFLOW (t)
{
tree fndecl;
+ /* If either is ERROR_MARK, they aren't equal. */
+ if (TREE_CODE (arg0) == ERROR_MARK || TREE_CODE (arg1) == ERROR_MARK)
+ return 0;
+
/* If both types don't have the same signedness, then we can't consider
them equal. We must check this before the STRIP_NOPS calls
because they may change the signedness of the arguments. */
- if (TREE_UNSIGNED (TREE_TYPE (arg0)) != TREE_UNSIGNED (TREE_TYPE (arg1)))
+ if (TYPE_UNSIGNED (TREE_TYPE (arg0)) != TYPE_UNSIGNED (TREE_TYPE (arg1)))
return 0;
STRIP_NOPS (arg0);
case '1':
/* Two conversions are equal only if signedness and modes match. */
if ((TREE_CODE (arg0) == NOP_EXPR || TREE_CODE (arg0) == CONVERT_EXPR)
- && (TREE_UNSIGNED (TREE_TYPE (arg0))
- != TREE_UNSIGNED (TREE_TYPE (arg1))))
+ && (TYPE_UNSIGNED (TREE_TYPE (arg0))
+ != TYPE_UNSIGNED (TREE_TYPE (arg1))))
return 0;
return operand_equal_p (TREE_OPERAND (arg0, 0),
the outer type, then the outer type gives the signedness. Otherwise
(in case of a small bitfield) the signedness is unchanged. */
if (outer_type && *pbitsize == tree_low_cst (TYPE_SIZE (outer_type), 1))
- *punsignedp = TREE_UNSIGNED (outer_type);
+ *punsignedp = TYPE_UNSIGNED (outer_type);
/* Compute the mask to access the bitfield. */
unsigned_type = lang_hooks.types.type_for_size (*pbitsize, 1);
greater than or equal to zero. We base the range tests we make
on that fact, so we record it here so we can parse existing
range tests. */
- if (TREE_UNSIGNED (type) && (low == 0 || high == 0))
+ if (TYPE_UNSIGNED (type) && (low == 0 || high == 0))
{
if (! merge_ranges (&n_in_p, &n_low, &n_high, in_p, low, high,
1, fold_convert (type, integer_zero_node),
So we have to make sure that the original unsigned value will
be interpreted as positive. */
- if (TREE_UNSIGNED (type) && ! TREE_UNSIGNED (TREE_TYPE (exp)))
+ if (TYPE_UNSIGNED (type) && ! TYPE_UNSIGNED (TREE_TYPE (exp)))
{
tree equiv_type = lang_hooks.types.type_for_mode
(TYPE_MODE (type), 1);
if (integer_zerop (low))
{
- if (! TREE_UNSIGNED (etype))
+ if (! TYPE_UNSIGNED (etype))
{
etype = lang_hooks.types.unsigned_type (etype);
high = fold_convert (etype, high);
if (TREE_INT_CST_HIGH (high) == hi && TREE_INT_CST_LOW (high) == lo)
{
- if (TREE_UNSIGNED (etype))
+ if (TYPE_UNSIGNED (etype))
{
etype = lang_hooks.types.signed_type (etype);
exp = fold_convert (etype, exp);
do the type conversion here. At this point, the constant is either
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 (TREE_UNSIGNED (type))
+ if (TYPE_UNSIGNED (type))
temp = fold_convert (lang_hooks.types.signed_type (type), temp);
temp = const_binop (LSHIFT_EXPR, temp, size_int (modesize - 1), 0);
temp = const_binop (BIT_AND_EXPR, temp,
fold_convert (TREE_TYPE (c), mask), 0);
/* If necessary, convert the type back to match the type of C. */
- if (TREE_UNSIGNED (type))
+ if (TYPE_UNSIGNED (type))
temp = fold_convert (type, temp);
return fold_convert (type, const_binop (BIT_XOR_EXPR, c, temp, 0));
|| TREE_CODE_CLASS (TREE_CODE (op0)) == 'e')
/* ... and is unsigned, and its type is smaller than ctype,
then we cannot pass through as widening. */
- && ((TREE_UNSIGNED (TREE_TYPE (op0))
+ && ((TYPE_UNSIGNED (TREE_TYPE (op0))
&& ! (TREE_CODE (TREE_TYPE (op0)) == INTEGER_TYPE
&& TYPE_IS_SIZETYPE (TREE_TYPE (op0)))
&& (GET_MODE_SIZE (TYPE_MODE (ctype))
/* ... or signedness changes for division or modulus,
then we cannot pass through this conversion. */
|| (code != MULT_EXPR
- && (TREE_UNSIGNED (ctype)
- != TREE_UNSIGNED (TREE_TYPE (op0))))))
+ && (TYPE_UNSIGNED (ctype)
+ != TYPE_UNSIGNED (TREE_TYPE (op0))))))
break;
/* Pass the constant down and see if we can make a simplification. If
case MIN_EXPR: case MAX_EXPR:
/* If widening the type changes the signedness, then we can't perform
this optimization as that changes the result. */
- if (TREE_UNSIGNED (ctype) != TREE_UNSIGNED (type))
+ if (TYPE_UNSIGNED (ctype) != TYPE_UNSIGNED (type))
break;
/* MIN (a, b) / 5 -> MIN (a / 5, b / 5) */
/* If we have an unsigned type is not a sizetype, we cannot widen
the operation since it will change the result if the original
computation overflowed. */
- if (TREE_UNSIGNED (ctype)
+ if (TYPE_UNSIGNED (ctype)
&& ! (TREE_CODE (ctype) == INTEGER_TYPE && TYPE_IS_SIZETYPE (ctype))
&& ctype != type)
break;
If we have an unsigned type that is not a sizetype, we cannot do
this since it will change the result if the original computation
overflowed. */
- if ((! TREE_UNSIGNED (ctype)
+ if ((! TYPE_UNSIGNED (ctype)
|| (TREE_CODE (ctype) == INTEGER_TYPE && TYPE_IS_SIZETYPE (ctype)))
&& ! flag_wrapv
&& ((code == MULT_EXPR && tcode == EXACT_DIV_EXPR)
int inside_ptr = POINTER_TYPE_P (inside_type);
int inside_float = FLOAT_TYPE_P (inside_type);
unsigned int inside_prec = TYPE_PRECISION (inside_type);
- int inside_unsignedp = TREE_UNSIGNED (inside_type);
+ int inside_unsignedp = TYPE_UNSIGNED (inside_type);
int inter_int = INTEGRAL_TYPE_P (inter_type);
int inter_ptr = POINTER_TYPE_P (inter_type);
int inter_float = FLOAT_TYPE_P (inter_type);
unsigned int inter_prec = TYPE_PRECISION (inter_type);
- int inter_unsignedp = TREE_UNSIGNED (inter_type);
+ int inter_unsignedp = TYPE_UNSIGNED (inter_type);
int final_int = INTEGRAL_TYPE_P (type);
int final_ptr = POINTER_TYPE_P (type);
int final_float = FLOAT_TYPE_P (type);
unsigned int final_prec = TYPE_PRECISION (type);
- int final_unsignedp = TREE_UNSIGNED (type);
+ int final_unsignedp = TYPE_UNSIGNED (type);
/* In addition to the cases of two conversions in a row
handled below, if we are converting something to its own
tree and0 = TREE_OPERAND (and, 0), and1 = TREE_OPERAND (and, 1);
int change = 0;
- if (TREE_UNSIGNED (TREE_TYPE (and))
+ if (TYPE_UNSIGNED (TREE_TYPE (and))
|| (TYPE_PRECISION (type)
<= TYPE_PRECISION (TREE_TYPE (and))))
change = 1;
|| (code1 == RSHIFT_EXPR && code0 == LSHIFT_EXPR))
&& operand_equal_p (TREE_OPERAND (arg0, 0),
TREE_OPERAND (arg1, 0), 0)
- && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (arg0, 0))))
+ && TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (arg0, 0))))
{
tree tree01, tree11;
enum tree_code code01, code11;
return t1;
/* Simplify ((int)c & 0377) into (int)c, if c is unsigned char. */
if (TREE_CODE (arg1) == INTEGER_CST && TREE_CODE (arg0) == NOP_EXPR
- && TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (arg0, 0))))
+ && TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (arg0, 0))))
{
unsigned int prec
= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (arg0, 0)));
case RSHIFT_EXPR:
/* Optimize -1 >> x for arithmetic right shifts. */
- if (integer_all_onesp (arg0) && ! TREE_UNSIGNED (type))
+ if (integer_all_onesp (arg0) && !TYPE_UNSIGNED (type))
return omit_one_operand (type, arg0, arg1);
/* ... fall through ... */
signed_max = ((unsigned HOST_WIDE_INT) 1 << (width - 1)) - 1;
- if (TREE_UNSIGNED (TREE_TYPE (arg1)))
+ if (TYPE_UNSIGNED (TREE_TYPE (arg1)))
{
max = ((unsigned HOST_WIDE_INT) 2 << (width - 1)) - 1;
min = 0;
else if (TREE_INT_CST_HIGH (arg1) == 0
&& TREE_INT_CST_LOW (arg1) == signed_max
- && TREE_UNSIGNED (TREE_TYPE (arg1))
+ && TYPE_UNSIGNED (TREE_TYPE (arg1))
/* signed_type does not work on pointer types. */
&& INTEGRAL_TYPE_P (TREE_TYPE (arg1)))
{
&& TREE_CODE (arg0) == NOP_EXPR
&& (tem = get_unwidened (arg0, NULL_TREE)) != arg0
&& (code == EQ_EXPR || code == NE_EXPR
- || TREE_UNSIGNED (TREE_TYPE (arg0))
- == TREE_UNSIGNED (TREE_TYPE (tem)))
+ || TYPE_UNSIGNED (TREE_TYPE (arg0))
+ == TYPE_UNSIGNED (TREE_TYPE (tem)))
&& (t1 = get_unwidened (arg1, TREE_TYPE (tem))) != 0
&& (TREE_TYPE (t1) == TREE_TYPE (tem)
|| (TREE_CODE (t1) == INTEGER_CST
the MOD operation unsigned since it is simpler and equivalent. */
if ((code == NE_EXPR || code == EQ_EXPR)
&& integer_zerop (arg1)
- && ! TREE_UNSIGNED (TREE_TYPE (arg0))
+ && !TYPE_UNSIGNED (TREE_TYPE (arg0))
&& (TREE_CODE (arg0) == TRUNC_MOD_EXPR
|| TREE_CODE (arg0) == CEIL_MOD_EXPR
|| TREE_CODE (arg0) == FLOOR_MOD_EXPR
/* If X is unsigned, convert X < (1 << Y) into X >> Y == 0
and similarly for >= into !=. */
if ((code == LT_EXPR || code == GE_EXPR)
- && TREE_UNSIGNED (TREE_TYPE (arg0))
+ && TYPE_UNSIGNED (TREE_TYPE (arg0))
&& TREE_CODE (arg1) == LSHIFT_EXPR
&& integer_onep (TREE_OPERAND (arg1, 0)))
return build (code == LT_EXPR ? EQ_EXPR : NE_EXPR, type,
fold_convert (TREE_TYPE (arg0), integer_zero_node));
else if ((code == LT_EXPR || code == GE_EXPR)
- && TREE_UNSIGNED (TREE_TYPE (arg0))
+ && TYPE_UNSIGNED (TREE_TYPE (arg0))
&& (TREE_CODE (arg1) == NOP_EXPR
|| TREE_CODE (arg1) == CONVERT_EXPR)
&& TREE_CODE (TREE_OPERAND (arg1, 0)) == LSHIFT_EXPR
return pedantic_non_lvalue (fold_convert (type, arg1));
case GE_EXPR:
case GT_EXPR:
- if (TREE_UNSIGNED (TREE_TYPE (arg1)))
+ if (TYPE_UNSIGNED (TREE_TYPE (arg1)))
arg1 = fold_convert (lang_hooks.types.signed_type
(TREE_TYPE (arg1)), arg1);
arg1 = fold (build1 (ABS_EXPR, TREE_TYPE (arg1), arg1));
return pedantic_non_lvalue (fold_convert (type, arg1));
case LE_EXPR:
case LT_EXPR:
- if (TREE_UNSIGNED (TREE_TYPE (arg1)))
+ if (TYPE_UNSIGNED (TREE_TYPE (arg1)))
arg1 = fold_convert (lang_hooks.types.signed_type
(TREE_TYPE (arg1)), arg1);
arg1 = fold (build1 (ABS_EXPR, TREE_TYPE (arg1), arg1));
case INTEGER_CST:
if (TREE_CODE (bottom) != INTEGER_CST
- || (TREE_UNSIGNED (type)
+ || (TYPE_UNSIGNED (type)
&& (tree_int_cst_sgn (top) < 0
|| tree_int_cst_sgn (bottom) < 0)))
return 0;
{
tree inner1 = TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 0), 0));
tree inner2 = TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 1), 0));
- if (TREE_CODE (inner1) == INTEGER_TYPE && TREE_UNSIGNED (inner1)
- && TREE_CODE (inner2) == INTEGER_TYPE && TREE_UNSIGNED (inner2))
+ if (TREE_CODE (inner1) == INTEGER_TYPE && TYPE_UNSIGNED (inner1)
+ && TREE_CODE (inner2) == INTEGER_TYPE && TYPE_UNSIGNED (inner2))
{
unsigned int prec = MAX (TYPE_PRECISION (inner1),
TYPE_PRECISION (inner2)) + 1;
{
tree inner1 = TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 0), 0));
tree inner2 = TREE_TYPE (TREE_OPERAND (TREE_OPERAND (t, 1), 0));
- if (TREE_CODE (inner1) == INTEGER_TYPE && TREE_UNSIGNED (inner1)
- && TREE_CODE (inner2) == INTEGER_TYPE && TREE_UNSIGNED (inner2))
+ if (TREE_CODE (inner1) == INTEGER_TYPE && TYPE_UNSIGNED (inner1)
+ && TREE_CODE (inner2) == INTEGER_TYPE && TYPE_UNSIGNED (inner2))
return TYPE_PRECISION (inner1) + TYPE_PRECISION (inner2)
< TYPE_PRECISION (TREE_TYPE (t));
}
return tree_expr_nonnegative_p (TREE_OPERAND (t, 0));
if (TREE_CODE (inner_type) == INTEGER_TYPE)
{
- if (TREE_UNSIGNED (inner_type))
+ if (TYPE_UNSIGNED (inner_type))
return 1;
return tree_expr_nonnegative_p (TREE_OPERAND (t, 0));
}
return tree_expr_nonnegative_p (TREE_OPERAND (t,0));
if (TREE_CODE (inner_type) == INTEGER_TYPE)
return TYPE_PRECISION (inner_type) < TYPE_PRECISION (outer_type)
- && TREE_UNSIGNED (inner_type);
+ && TYPE_UNSIGNED (inner_type);
}
}
break;
switch (TREE_CODE (t))
{
case ABS_EXPR:
- if (!TREE_UNSIGNED (type) && !flag_wrapv)
+ if (!TYPE_UNSIGNED (type) && !flag_wrapv)
return tree_expr_nonzero_p (TREE_OPERAND (t, 0));
case INTEGER_CST:
return !integer_zerop (t);
case PLUS_EXPR:
- if (!TREE_UNSIGNED (type) && !flag_wrapv)
+ if (!TYPE_UNSIGNED (type) && !flag_wrapv)
{
/* With the presence of negative values it is hard
to say something. */
break;
case MULT_EXPR:
- if (!TREE_UNSIGNED (type) && !flag_wrapv)
+ if (!TYPE_UNSIGNED (type) && !flag_wrapv)
{
return (tree_expr_nonzero_p (TREE_OPERAND (t, 0))
&& tree_expr_nonzero_p (TREE_OPERAND (t, 1)));
TREE_TYPE (t) = type;
TREE_OVERFLOW (t)
= (TREE_OVERFLOW (arg0)
- | force_fit_type (t, overflow && !TREE_UNSIGNED (type)));
+ | force_fit_type (t, overflow && !TYPE_UNSIGNED (type)));
TREE_CONSTANT_OVERFLOW (t)
= TREE_OVERFLOW (t) | TREE_CONSTANT_OVERFLOW (arg0);
}
{
/* If the value is unsigned, then the absolute value is
the same as the ordinary value. */
- if (TREE_UNSIGNED (type))
+ if (TYPE_UNSIGNED (type))
return arg0;
/* Similarly, if the value is non-negative. */
else if (INT_CST_LT (integer_minus_one_node, arg0))
if (code == EQ_EXPR)
tem = build_int_2 (tree_int_cst_equal (op0, op1), 0);
else
- tem = build_int_2 ((TREE_UNSIGNED (TREE_TYPE (op0))
+ tem = build_int_2 ((TYPE_UNSIGNED (TREE_TYPE (op0))
? INT_CST_LT_UNSIGNED (op0, op1)
: INT_CST_LT (op0, op1)),
0);
mode = TYPE_MODE (type);
#ifndef PROMOTE_FOR_CALL_ONLY
- unsignedp = TREE_UNSIGNED (type);
+ unsignedp = TYPE_UNSIGNED (type);
#endif
if (mode == BLKmode || memory_required)
schedule_fixup_var_refs (struct function *function, rtx reg, tree type,
enum machine_mode promoted_mode, htab_t ht)
{
- int unsigned_p = type ? TREE_UNSIGNED (type) : 0;
+ int unsigned_p = type ? TYPE_UNSIGNED (type) : 0;
if (function != 0)
{
if (rescan
&& (TREE_USED (decl) || (DECL_P (decl) && DECL_INITIAL (decl) != 0)))
- fixup_var_refs (reg, GET_MODE (reg), TREE_UNSIGNED (type), reg, 0);
+ fixup_var_refs (reg, GET_MODE (reg), TYPE_UNSIGNED (type), reg, 0);
}
else if (rescan)
{
if (targetm.calls.promote_function_args (TREE_TYPE (fndecl)))
{
/* Compute the mode in which the arg is actually extended to. */
- unsignedp = TREE_UNSIGNED (passed_type);
- promoted_mode = promote_mode (passed_type, promoted_mode, &unsignedp, 1);
+ unsignedp = TYPE_UNSIGNED (passed_type);
+ promoted_mode = promote_mode (passed_type, promoted_mode,
+ &unsignedp, 1);
}
/* Let machine desc say which reg (if any) the parm arrives in.
rtx parmreg;
unsigned int regno, regnoi = 0, regnor = 0;
- unsignedp = TREE_UNSIGNED (TREE_TYPE (parm));
+ unsignedp = TYPE_UNSIGNED (TREE_TYPE (parm));
promoted_nominal_mode
= promote_mode (TREE_TYPE (parm), nominal_mode, &unsignedp, 0);
if (GET_MODE (parmreg) != GET_MODE (DECL_RTL (parm)))
{
rtx tempreg = gen_reg_rtx (GET_MODE (DECL_RTL (parm)));
- int unsigned_p = TREE_UNSIGNED (TREE_TYPE (parm));
+ int unsigned_p = TYPE_UNSIGNED (TREE_TYPE (parm));
push_to_sequence (conversion_insns);
emit_move_insn (tempreg, DECL_RTL (parm));
SET_DECL_RTL (parm,
push_to_sequence (conversion_insns);
entry_parm = convert_to_mode (nominal_mode, tempreg,
- TREE_UNSIGNED (TREE_TYPE (parm)));
+ TYPE_UNSIGNED (TREE_TYPE (parm)));
if (stack_parm)
/* ??? This may need a big-endian conversion on sparc64. */
stack_parm = adjust_address (stack_parm, nominal_mode, 0);
&& TYPE_MODE (DECL_ARG_TYPE (arg)) == TYPE_MODE (TREE_TYPE (arg)))
{
enum machine_mode mode = TYPE_MODE (TREE_TYPE (arg));
- int unsignedp = TREE_UNSIGNED (TREE_TYPE (arg));
+ int unsignedp = TYPE_UNSIGNED (TREE_TYPE (arg));
mode = promote_mode (TREE_TYPE (arg), mode, &unsignedp, 1);
if (mode == GET_MODE (DECL_INCOMING_RTL (arg))
extension. */
if (GET_MODE (real_decl_rtl) != GET_MODE (decl_rtl))
{
- int unsignedp = TREE_UNSIGNED (TREE_TYPE (decl_result));
+ int unsignedp = TYPE_UNSIGNED (TREE_TYPE (decl_result));
if (targetm.calls.promote_function_return (TREE_TYPE (current_function_decl)))
promote_mode (TREE_TYPE (decl_result), GET_MODE (decl_rtl),
{
if (GET_MODE (loc) != TYPE_MODE (TREE_TYPE (arg)))
{
- int unsignedp = TREE_UNSIGNED (TREE_TYPE (formal));
+ int unsignedp = TYPE_UNSIGNED (TREE_TYPE (formal));
enum machine_mode pmode = TYPE_MODE (TREE_TYPE (formal));
pmode = promote_mode (TREE_TYPE (formal), pmode,
+2004-03-31 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * jcf-write.c (generate_bytecode_insns): Use TYPE_UNSIGNED.
+
2004-03-31 Andrew Haley <aph@redhat.com>
PR java/14104
/* Already converted to int, if needed. */
if (TYPE_PRECISION (dst_type) <= 8)
OP1 (OPCODE_i2b);
- else if (TREE_UNSIGNED (dst_type))
+ else if (TYPE_UNSIGNED (dst_type))
OP1 (OPCODE_i2c);
else
OP1 (OPCODE_i2s);
{
switch (GET_MODE_BITSIZE (TYPE_MODE (type)))
{
- case 8: c = TREE_UNSIGNED (type) ? 'C' : 'c'; break;
- case 16: c = TREE_UNSIGNED (type) ? 'S' : 's'; break;
+ case 8: c = TYPE_UNSIGNED (type) ? 'C' : 'c'; break;
+ case 16: c = TYPE_UNSIGNED (type) ? 'S' : 's'; break;
case 32:
if (type == long_unsigned_type_node
|| type == long_integer_type_node)
- c = TREE_UNSIGNED (type) ? 'L' : 'l';
+ c = TYPE_UNSIGNED (type) ? 'L' : 'l';
else
- c = TREE_UNSIGNED (type) ? 'I' : 'i';
+ c = TYPE_UNSIGNED (type) ? 'I' : 'i';
break;
- case 64: c = TREE_UNSIGNED (type) ? 'Q' : 'q'; break;
+ case 64: c = TYPE_UNSIGNED (type) ? 'Q' : 'q'; break;
default: abort ();
}
obstack_1grow (&util_obstack, c);
result_mode = TYPE_MODE (integer_type_node);
cmp_mode = TYPE_MODE (length_type);
size = convert_to_mode (TYPE_MODE (length_type), size,
- TREE_UNSIGNED (length_type));
+ TYPE_UNSIGNED (length_type));
result = emit_library_call_value (libfunc, 0, LCT_PURE_MAKE_BLOCK,
result_mode, 3,
}
if (size == INT_TYPE_SIZE)
- return (TREE_UNSIGNED (type) ? T_UINT : T_INT);
+ return (TYPE_UNSIGNED (type) ? T_UINT : T_INT);
if (size == CHAR_TYPE_SIZE)
- return (TREE_UNSIGNED (type) ? T_UCHAR : T_CHAR);
+ return (TYPE_UNSIGNED (type) ? T_UCHAR : T_CHAR);
if (size == SHORT_TYPE_SIZE)
- return (TREE_UNSIGNED (type) ? T_USHORT : T_SHORT);
+ return (TYPE_UNSIGNED (type) ? T_USHORT : T_SHORT);
if (size == LONG_TYPE_SIZE)
- return (TREE_UNSIGNED (type) ? T_ULONG : T_LONG);
+ return (TYPE_UNSIGNED (type) ? T_ULONG : T_LONG);
if (size == LONG_LONG_TYPE_SIZE) /* better than nothing */
- return (TREE_UNSIGNED (type) ? T_ULONG : T_LONG);
+ return (TYPE_UNSIGNED (type) ? T_ULONG : T_LONG);
return 0;
}
tree type = TREE_TYPE (DECL_RESULT (current_function_decl));
if (targetm.calls.promote_function_return (TREE_TYPE (current_function_decl)))
{
- int unsignedp = TREE_UNSIGNED (type);
+ int unsignedp = TYPE_UNSIGNED (type);
enum machine_mode old_mode
= DECL_MODE (DECL_RESULT (current_function_decl));
enum machine_mode mode
else
{
rtx tmp = argvec[i];
- int unsignedp = TREE_UNSIGNED (TREE_TYPE (TREE_VALUE (a)));
+ int unsignedp = TYPE_UNSIGNED (TREE_TYPE (TREE_VALUE (a)));
promote_mode(TREE_TYPE (TREE_VALUE (a)), GET_MODE (tmp),
&unsignedp, 0);
if (DECL_MODE (f) != GET_MODE (DECL_RTL (f)))
&& (DECL_REGISTER (decl) || DECL_ARTIFICIAL (decl) || optimize))
{
/* Automatic variable that can go in a register. */
- int unsignedp = TREE_UNSIGNED (type);
+ int unsignedp = TYPE_UNSIGNED (type);
enum machine_mode reg_mode
= promote_mode (type, DECL_MODE (decl), &unsignedp, 0);
index_expr = thiscase->data.case_stmt.index_expr;
index_type = TREE_TYPE (index_expr);
- unsignedp = TREE_UNSIGNED (index_type);
+ unsignedp = TYPE_UNSIGNED (index_type);
if (orig_type == NULL)
orig_type = TREE_TYPE (orig_index);
tree index_type)
{
/* If INDEX has an unsigned type, we must make unsigned branches. */
- int unsignedp = TREE_UNSIGNED (index_type);
+ int unsignedp = TYPE_UNSIGNED (index_type);
enum machine_mode mode = GET_MODE (index);
enum machine_mode imode = TYPE_MODE (index_type);
size in bytes from the size in bits. If we have already set the mode,
don't set it again since we can be called twice for FIELD_DECLs. */
- TREE_UNSIGNED (decl) = TREE_UNSIGNED (type);
+ TREE_UNSIGNED (decl) = TYPE_UNSIGNED (type);
if (DECL_MODE (decl) == VOIDmode)
DECL_MODE (decl) = TYPE_MODE (type);
case CHAR_TYPE:
if (TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST
&& tree_int_cst_sgn (TYPE_MIN_VALUE (type)) >= 0)
- TREE_UNSIGNED (type) = 1;
+ TYPE_UNSIGNED (type) = 1;
TYPE_MODE (type) = smallest_mode_for_size (TYPE_PRECISION (type),
MODE_INT);
break;
case COMPLEX_TYPE:
- TREE_UNSIGNED (type) = TREE_UNSIGNED (TREE_TYPE (type));
+ TYPE_UNSIGNED (type) = TYPE_UNSIGNED (TREE_TYPE (type));
TYPE_MODE (type)
= mode_for_size (2 * TYPE_PRECISION (TREE_TYPE (type)),
- (TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE
- ? MODE_COMPLEX_INT : MODE_COMPLEX_FLOAT),
+ (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE
+ ? MODE_COMPLEX_FLOAT : MODE_COMPLEX_INT),
0);
TYPE_SIZE (type) = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (type)));
TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (TYPE_MODE (type)));
break;
case VECTOR_TYPE:
- {
- tree subtype;
-
- subtype = TREE_TYPE (type);
- TREE_UNSIGNED (type) = TREE_UNSIGNED (subtype);
- TYPE_SIZE (type) = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (type)));
- TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (TYPE_MODE (type)));
- }
+ TYPE_UNSIGNED (type) = TYPE_UNSIGNED (TREE_TYPE (type));
+ TYPE_SIZE (type) = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (type)));
+ TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (TYPE_MODE (type)));
break;
case VOID_TYPE:
TYPE_SIZE (type) = bitsize_int (nbits);
TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (mode));
- TREE_UNSIGNED (type) = 1;
+ TYPE_UNSIGNED (type) = 1;
TYPE_PRECISION (type) = nbits;
}
break;
sure the size is never negative. We should really do this
if *either* bound is non-constant, but this is the best
compromise between C and Ada. */
- if (! TREE_UNSIGNED (sizetype)
+ if (!TYPE_UNSIGNED (sizetype)
&& TREE_CODE (TYPE_MIN_VALUE (index)) != INTEGER_CST
&& TREE_CODE (TYPE_MAX_VALUE (index)) != INTEGER_CST)
length = size_binop (MAX_EXPR, length, size_zero_node);
TYPE_USER_ALIGN (t) = 0;
TYPE_SIZE (t) = build_int_2 (GET_MODE_BITSIZE (SImode), 0);
TYPE_SIZE_UNIT (t) = build_int_2 (GET_MODE_SIZE (SImode), 0);
- TREE_UNSIGNED (t) = 1;
+ TYPE_UNSIGNED (t) = 1;
TYPE_PRECISION (t) = GET_MODE_BITSIZE (SImode);
TYPE_MIN_VALUE (t) = build_int_2 (0, 0);
TYPE_IS_SIZETYPE (t) = 1;
TYPE_PRECISION (bitsizetype) = precision;
TYPE_IS_SIZETYPE (bitsizetype) = 1;
- if (TREE_UNSIGNED (type))
+ if (TYPE_UNSIGNED (type))
fixup_unsigned_type (bitsizetype);
else
fixup_signed_type (bitsizetype);
layout_type (bitsizetype);
- if (TREE_UNSIGNED (type))
+ if (TYPE_UNSIGNED (type))
{
usizetype = sizetype;
ubitsizetype = bitsizetype;
case INTEGER_TYPE:
case ENUMERAL_TYPE:
dump_int (di, "prec", TYPE_PRECISION (t));
- if (TREE_UNSIGNED (t))
+ if (TYPE_UNSIGNED (t))
dump_string (di, "unsigned");
dump_child ("min", TYPE_MIN_VALUE (t));
dump_child ("max", TYPE_MAX_VALUE (t));
real_from_integer (&d, type ? TYPE_MODE (type) : VOIDmode,
TREE_INT_CST_LOW (i), TREE_INT_CST_HIGH (i),
- TREE_UNSIGNED (TREE_TYPE (i)));
+ TYPE_UNSIGNED (TREE_TYPE (i)));
return d;
}
|| TREE_CONSTANT_OVERFLOW (expr))
return 0;
- uns = TREE_UNSIGNED (TREE_TYPE (expr));
+ uns = TYPE_UNSIGNED (TREE_TYPE (expr));
if (!uns)
return (TREE_INT_CST_LOW (expr) == ~(unsigned HOST_WIDE_INT) 0
&& TREE_INT_CST_HIGH (expr) == -1);
if (t1 == t2)
return 0;
- if (TREE_UNSIGNED (TREE_TYPE (t1)) != TREE_UNSIGNED (TREE_TYPE (t2)))
+ if (TYPE_UNSIGNED (TREE_TYPE (t1)) != TYPE_UNSIGNED (TREE_TYPE (t2)))
{
int t1_sgn = tree_int_cst_sgn (t1);
int t2_sgn = tree_int_cst_sgn (t2);
unsigned just in case one of them would overflow a signed
type. */
}
- else if (! TREE_UNSIGNED (TREE_TYPE (t1)))
+ else if (!TYPE_UNSIGNED (TREE_TYPE (t1)))
return INT_CST_LT (t1, t2);
return INT_CST_LT_UNSIGNED (t1, t2);
&& (HOST_WIDE_INT) TREE_INT_CST_LOW (t) >= 0)
|| (! pos && TREE_INT_CST_HIGH (t) == -1
&& (HOST_WIDE_INT) TREE_INT_CST_LOW (t) < 0
- && ! TREE_UNSIGNED (TREE_TYPE (t)))
+ && !TYPE_UNSIGNED (TREE_TYPE (t)))
|| (pos && TREE_INT_CST_HIGH (t) == 0)));
}
{
if (TREE_INT_CST_LOW (t) == 0 && TREE_INT_CST_HIGH (t) == 0)
return 0;
- else if (TREE_UNSIGNED (TREE_TYPE (t)))
+ else if (TYPE_UNSIGNED (TREE_TYPE (t)))
return 1;
else if (TREE_INT_CST_HIGH (t) < 0)
return -1;
int uns
= (for_type != 0 && for_type != type
&& final_prec > TYPE_PRECISION (type)
- && TREE_UNSIGNED (type));
+ && TYPE_UNSIGNED (type));
tree win = op;
while (TREE_CODE (op) == NOP_EXPR)
{
if (! uns || final_prec <= TYPE_PRECISION (TREE_TYPE (op)))
win = op;
- /* TREE_UNSIGNED says whether this is a zero-extension.
+ /* TYPE_UNSIGNED says whether this is a zero-extension.
Let's avoid computing it if it does not affect WIN
and if UNS will not be needed again. */
if ((uns || TREE_CODE (op) == NOP_EXPR)
- && TREE_UNSIGNED (TREE_TYPE (op)))
+ && TYPE_UNSIGNED (TREE_TYPE (op)))
{
uns = 1;
win = op;
unsigned int innerprec
= tree_low_cst (DECL_SIZE (TREE_OPERAND (op, 1)), 1);
int unsignedp = (TREE_UNSIGNED (TREE_OPERAND (op, 1))
- || TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op, 1))));
+ || TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op, 1))));
type = lang_hooks.types.type_for_size (innerprec, unsignedp);
/* We can get this structure field in the narrowest type it fits in.
/* An extension: the outermost one can be stripped,
but remember whether it is zero or sign extension. */
if (first)
- uns = TREE_UNSIGNED (TREE_TYPE (op));
+ uns = TYPE_UNSIGNED (TREE_TYPE (op));
/* Otherwise, if a sign extension has been stripped,
only sign extensions can now be stripped;
if a zero extension has been stripped, only zero-extensions. */
- else if (uns != TREE_UNSIGNED (TREE_TYPE (op)))
+ else if (uns != TYPE_UNSIGNED (TREE_TYPE (op)))
break;
first = 0;
}
/* A change in nominal type can always be stripped, but we must
preserve the unsignedness. */
if (first)
- uns = TREE_UNSIGNED (TREE_TYPE (op));
+ uns = TYPE_UNSIGNED (TREE_TYPE (op));
first = 0;
op = TREE_OPERAND (op, 0);
}
unsigned HOST_WIDE_INT innerprec
= tree_low_cst (DECL_SIZE (TREE_OPERAND (op, 1)), 1);
int unsignedp = (TREE_UNSIGNED (TREE_OPERAND (op, 1))
- || TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op, 1))));
+ || TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op, 1))));
tree type = lang_hooks.types.type_for_size (innerprec, unsignedp);
/* We can get this structure field in a narrower type that fits it,
/* Perform some generic filtering first, which may allow making a decision
even if the bounds are not constant. First, negative integers never fit
in unsigned types, */
- if ((TREE_UNSIGNED (type) && tree_int_cst_sgn (c) < 0)
+ if ((TYPE_UNSIGNED (type) && tree_int_cst_sgn (c) < 0)
/* Also, unsigned integers with top bit set never fit signed types. */
- || (! TREE_UNSIGNED (type)
- && TREE_UNSIGNED (TREE_TYPE (c)) && tree_int_cst_msb (c)))
+ || (! TYPE_UNSIGNED (type)
+ && TYPE_UNSIGNED (TREE_TYPE (c)) && tree_int_cst_msb (c)))
return 0;
/* If at least one bound of the type is a constant integer, we can check
t = make_node (VECTOR_TYPE);
TREE_TYPE (t) = innertype;
TYPE_MODE (t) = mode;
- TREE_UNSIGNED (t) = TREE_UNSIGNED (innertype);
finish_vector_type (t);
return t;
}
unsigned_flag:
+ TYPE_UNSIGNED in
+ all types
TREE_UNSIGNED in
- INTEGER_TYPE, ENUMERAL_TYPE, FIELD_DECL
+ FIELD_DECL
SAVE_EXPR_NOPLACEHOLDER in
SAVE_EXPR
&& TREE_OPERAND (EXP, 0) != error_mark_node \
&& (TYPE_MODE (TREE_TYPE (EXP)) \
== TYPE_MODE (TREE_TYPE (TREE_OPERAND (EXP, 0)))) \
- && (TREE_UNSIGNED (TREE_TYPE (EXP)) \
- == TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (EXP, 0))))) \
+ && (TYPE_UNSIGNED (TREE_TYPE (EXP)) \
+ == TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (EXP, 0))))) \
(EXP) = TREE_OPERAND (EXP, 0)
/* Like STRIP_NOPS, but don't alter the TREE_TYPE main variant either. */
In FIELD_DECL nodes, means an unsigned bit field. */
#define TREE_UNSIGNED(NODE) ((NODE)->common.unsigned_flag)
+/* In integral and pointer types, means an unsigned type. */
+#define TYPE_UNSIGNED(NODE) (TYPE_CHECK (NODE)->common.unsigned_flag)
+
#define TYPE_TRAP_SIGNED(NODE) \
- (flag_trapv && ! TREE_UNSIGNED (TYPE_CHECK (NODE)))
+ (flag_trapv && ! TYPE_UNSIGNED (NODE))
/* Nonzero in a VAR_DECL means assembler code has been written.
Nonzero in a FUNCTION_DECL means that the function has been compiled.
#define SAVE_EXPR_CONTEXT(NODE) TREE_OPERAND_CHECK_CODE (NODE, SAVE_EXPR, 1)
#define SAVE_EXPR_RTL(NODE) TREE_RTL_OPERAND_CHECK (NODE, SAVE_EXPR, 2)
-#define SAVE_EXPR_NOPLACEHOLDER(NODE) TREE_UNSIGNED (SAVE_EXPR_CHECK (NODE))
+#define SAVE_EXPR_NOPLACEHOLDER(NODE) \
+ (SAVE_EXPR_CHECK (NODE)->common.unsigned_flag)
+
/* Nonzero if the SAVE_EXPRs value should be kept, even if it occurs
both in normal code and in a handler. (Normally, in a handler, all
SAVE_EXPRs are unsaved, meaning that their values are
+2004-03-31 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * treetree.c (tree_lang_signed_or_unsigned_type): Use TYPE_UNSIGNED,
+ not TREE_UNSIGNED.
+
2004-03-21 Joseph S. Myers <jsm@polyomino.org.uk>
* treelang.texi: Update link to "G++ and GCC".
static tree
tree_lang_signed_or_unsigned_type (int unsignedp, tree type)
{
- if (! INTEGRAL_TYPE_P (type) || TREE_UNSIGNED (type) == unsignedp)
+ if (! INTEGRAL_TYPE_P (type) || TYPE_UNSIGNED (type) == unsignedp)
return type;
else
return tree_lang_type_for_size (TYPE_PRECISION (type), unsignedp);