diff options
author | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-01 03:50:43 +0000 |
---|---|---|
committer | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-04-01 03:50:43 +0000 |
commit | 78a8ed037318d1db259d761729af92e1f4697a0b (patch) | |
tree | cdd0771bc6e7a796038424b013a8a89e08667dea /gcc | |
parent | dd070f65d892ec426fc9dc013cfc04645043e6bc (diff) | |
download | gcc-78a8ed037318d1db259d761729af92e1f4697a0b.tar.gz |
* 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.
* cp/call.c (joust): Use TYPE_UNSIGNED, not TREE_UNSIGNED.
* cp/class.c (check_bitfield_decl): Likewise.
* cp/cvt.c (type_promotes_to): Likewise.
* cp/decl.c (finish_enum): Likewise.
* cp/mangle.c (write_builtin_type): Likewise.
* cp/semantics.c (finish_switch_cond, finish_unary_op_expr): Likewise.
* cp/typeck.c (type_after_usual_arithmetic_conversions): Likewise.
(build_binary_op): Likewise.
* f/com.c (ffecom_arrayref_): Use TYPE_UNSIGNED, not TREE_UNSIGNED.
(ffecom_expr_): Likewise.
* java/jcf-write.c (generate_bytecode_insns): Use TYPE_UNSIGNED.
* treelang/treetree.c (tree_lang_signed_or_unsigned_type):
Use TYPE_UNSIGNED, not TREE_UNSIGNED.
* ada/decl.c (gnat_to_gnu_entity, make_type_from_size):
Use TYPE_UNSIGNED, not TREE_UNSIGNED.
* ada/trans.c (tree_transform, convert_with_check): Likewise.
* ada/utils.c (gnat_signed_or_unsigned_type): Likewise.
(build_vms_descriptor, unchecked_convert): Likewise.
* ada/utils2.c (nonbinary_modular_operation): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@80287 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
53 files changed, 389 insertions, 322 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0e3fad075aa..c35a9cf1625 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,26 @@ 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 Andrew Pinski <pinskia@physics.uc.edu> diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 26c8ef5099a..5fe33e42659 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,12 @@ +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 diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index bb79af73be4..c7b66c7f15e 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -1221,7 +1221,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) = 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); @@ -1299,8 +1299,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) /* 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) @@ -1806,7 +1806,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) 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 @@ -2081,8 +2081,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) = 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); @@ -6010,8 +6010,8 @@ make_type_from_size (tree type, tree size_tree, int biased_p) = ((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; diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c index dc34b725cf6..efa99fe0169 100644 --- a/gcc/ada/trans.c +++ b/gcc/ada/trans.c @@ -1886,10 +1886,10 @@ tree_transform (Node_Id gnat_node) /* 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) @@ -4729,17 +4729,17 @@ convert_with_check (Entity_Id gnat_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 diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c index 1c012fe9f3b..3fba0c08487 100644 --- a/gcc/ada/utils.c +++ b/gcc/ada/utils.c @@ -2118,7 +2118,7 @@ gnat_signed_type (tree type_node) 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); @@ -2355,19 +2355,19 @@ build_vms_descriptor (tree type, Mechanism_Type mech, Entity_Id gnat_entity) 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; @@ -3388,15 +3388,15 @@ unchecked_convert (tree type, tree expr, int notrunc_p) && 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, diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c index a0d33db6580..453841b8ecc 100644 --- a/gcc/ada/utils2.c +++ b/gcc/ada/utils2.c @@ -512,7 +512,7 @@ nonbinary_modular_operation (enum tree_code op_code, /* 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)); diff --git a/gcc/builtins.c b/gcc/builtins.c index 0622014bd45..33df5eca684 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -3166,7 +3166,7 @@ expand_builtin_memcmp (tree exp ATTRIBUTE_UNUSED, tree arglist, rtx target, 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. */ diff --git a/gcc/c-aux-info.c b/gcc/c-aux-info.c index 2ef7324dd14..70c85a225d8 100644 --- a/gcc/c-aux-info.c +++ b/gcc/c-aux-info.c @@ -430,7 +430,7 @@ gen_type (const char *ret_val, tree t, formals_style style) 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; diff --git a/gcc/c-common.c b/gcc/c-common.c index c7b73ccd69a..a3904cac7c0 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1248,7 +1248,7 @@ unsigned_conversion_warning (tree result, tree operand) 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)) { @@ -1292,13 +1292,13 @@ convert_and_check (tree type, tree expr) 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) @@ -1963,7 +1963,7 @@ tree 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 @@ -2148,9 +2148,9 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr, 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; @@ -2222,7 +2222,7 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr, 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, @@ -2379,7 +2379,7 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr, { 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. */ @@ -2401,7 +2401,7 @@ shorten_compare (tree *op0_ptr, tree *op1_ptr, tree *restype_ptr, primop1 = op1; if (!real1 && !real2 && integer_zerop (primop1) - && TREE_UNSIGNED (*restype_ptr)) + && TYPE_UNSIGNED (*restype_ptr)) { tree value = 0; switch (code) @@ -2502,7 +2502,7 @@ pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop) /* 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))))) { @@ -2522,9 +2522,9 @@ pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop) 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 @@ -2821,7 +2821,7 @@ c_common_get_alias_set (tree t) /* 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); @@ -3220,7 +3220,7 @@ c_common_nodes_and_builtins (void) 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); @@ -4608,7 +4608,7 @@ handle_mode_attribute (tree *node, tree name, tree args ATTRIBUTE_UNUSED, 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); diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c index 8573b8c5a46..84bd6f5f909 100644 --- a/gcc/c-cppbuiltin.c +++ b/gcc/c-cppbuiltin.c @@ -401,7 +401,7 @@ c_cpp_builtins (cpp_reader *pfile) 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. */ @@ -581,8 +581,8 @@ builtin_define_type_max (const char *macro, tree type, int is_long) 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); diff --git a/gcc/c-decl.c b/gcc/c-decl.c index a2cd9cb5042..871592a357f 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3295,8 +3295,9 @@ check_bitfield_type_and_width (tree *type, tree *width, const char *orig_name) 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); } @@ -4910,7 +4911,7 @@ xref_tag (enum tree_code code, tree name) 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); @@ -5427,7 +5428,7 @@ finish_enum (tree enumtype, tree values, tree attributes) 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); @@ -5479,7 +5480,7 @@ finish_enum (tree enumtype, tree values, tree attributes) 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. */ @@ -5551,7 +5552,7 @@ build_enumerator (tree name, tree value) 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); @@ -5770,7 +5771,7 @@ start_function (tree declspecs, tree declarator, tree attributes) 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; diff --git a/gcc/c-format.c b/gcc/c-format.c index 9da4200d3b4..3a51c6b63b4 100644 --- a/gcc/c-format.c +++ b/gcc/c-format.c @@ -2390,7 +2390,7 @@ check_format_types (int *status, format_wanted_type *types) 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; diff --git a/gcc/c-opts.c b/gcc/c-opts.c index ac2fe976156..7aa21c4458f 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -1193,7 +1193,7 @@ c_common_init (void) 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 diff --git a/gcc/c-pretty-print.c b/gcc/c-pretty-print.c index 51e34e77208..5673d73c7c1 100644 --- a/gcc/c-pretty-print.c +++ b/gcc/c-pretty-print.c @@ -291,7 +291,7 @@ pp_c_type_specifier (c_pretty_printer *pp, tree t) 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; @@ -767,7 +767,7 @@ pp_c_integer_constant (c_pretty_printer *pp, tree i) 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'); @@ -785,8 +785,8 @@ pp_c_character_constant (c_pretty_printer *pp, tree c) 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); diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 64b568cc218..9bd63e571a2 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -180,7 +180,7 @@ c_type_promotes_to (tree type) 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; @@ -286,7 +286,7 @@ common_type (tree t1, tree t2) { /* 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; @@ -301,7 +301,7 @@ common_type (tree t1, tree t2) /* 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); @@ -477,9 +477,9 @@ comptypes (tree type1, tree type2, int flags) 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; @@ -1189,7 +1189,7 @@ default_conversion (tree exp) TYPE_PRECISION (integer_type_node)), ((TYPE_PRECISION (type) >= TYPE_PRECISION (integer_type_node)) - && TREE_UNSIGNED (type))); + && TYPE_UNSIGNED (type))); return convert (type, exp); } @@ -1205,7 +1205,7 @@ default_conversion (tree 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); @@ -1908,7 +1908,7 @@ convert_arguments (tree typelist, tree values, tree name, tree fundecl) ; 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 @@ -1930,9 +1930,9 @@ convert_arguments (tree typelist, tree values, tree name, tree fundecl) 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); @@ -2701,15 +2701,15 @@ build_conditional_expr (tree ifexp, tree op1, tree op2) 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 @@ -5281,7 +5281,7 @@ set_nonincremental_init_from_string (tree str) } } - if (!TREE_UNSIGNED (type)) + if (!TYPE_UNSIGNED (type)) { bitpos = ((wchar_bytes - 1) * charwidth) + HOST_BITS_PER_CHAR; if (bitpos < HOST_BITS_PER_WIDE_INT) @@ -6512,7 +6512,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, 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; @@ -6539,7 +6539,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, 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; @@ -6828,7 +6828,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, 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; @@ -6839,11 +6839,11 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, 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. */ @@ -6898,14 +6898,14 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, 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 @@ -6941,8 +6941,8 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, 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); @@ -6961,7 +6961,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, 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) diff --git a/gcc/calls.c b/gcc/calls.c index 0d429f65767..d8ffb058cb5 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -1195,7 +1195,7 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED, } 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); @@ -3346,7 +3346,7 @@ expand_call (tree exp, rtx target, int ignore) && 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. */ diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c index 07934ee60b0..41d4a0e1797 100644 --- a/gcc/config/iq2000/iq2000.c +++ b/gcc/config/iq2000/iq2000.c @@ -2657,7 +2657,7 @@ iq2000_function_value (tree valtype, tree func ATTRIBUTE_UNUSED) { 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. */ diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index 3a6ae8561dc..734d75743c1 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -2758,13 +2758,13 @@ block_move_call (rtx dest_reg, rtx src_reg, rtx bytes_rtx) 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 } diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index cbd248e022b..de0d9874f4a 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -7509,7 +7509,7 @@ mips_function_value (tree valtype, tree func ATTRIBUTE_UNUSED, 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. */ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index bd649fa5695..f92a12c85b4 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -14916,7 +14916,7 @@ rs6000_handle_altivec_attribute (tree *node, tree name, tree args, switch (altivec_type) { case 'v': - unsigned_p = TREE_UNSIGNED (type); + unsigned_p = TYPE_UNSIGNED (type); switch (mode) { case SImode: diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 5340775dba5..63fc3e57c9a 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -6127,7 +6127,7 @@ s390_function_value (tree type, enum machine_mode mode) { if (type) { - int unsignedp = TREE_UNSIGNED (type); + int unsignedp = TYPE_UNSIGNED (type); mode = promote_mode (type, TYPE_MODE (type), &unsignedp, 1); } diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 8113f4b1142..bdb9ed40eef 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -7323,7 +7323,7 @@ sparc_type_code (register tree type) /* 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 @@ -7333,16 +7333,16 @@ sparc_type_code (register tree type) 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 diff --git a/gcc/convert.c b/gcc/convert.c index 397c54228db..dcab84a9aa9 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -397,7 +397,7 @@ convert_to_integer (tree type, tree expr) 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; @@ -415,7 +415,7 @@ convert_to_integer (tree type, tree 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 @@ -456,7 +456,7 @@ convert_to_integer (tree type, tree expr) 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, @@ -498,8 +498,8 @@ convert_to_integer (tree type, tree expr) && 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; } @@ -527,7 +527,7 @@ convert_to_integer (tree type, tree 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. @@ -545,9 +545,9 @@ convert_to_integer (tree type, tree expr) 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 @@ -576,7 +576,7 @@ convert_to_integer (tree type, tree 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. @@ -585,7 +585,7 @@ convert_to_integer (tree type, tree expr) { /* 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); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dc05a91798d..077fcef0985 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,14 @@ +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. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 06070fed130..56e089dd2e4 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5922,7 +5922,7 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn) && 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))) { diff --git a/gcc/cp/class.c b/gcc/cp/class.c index de0517f5b09..fe49e267eae 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -2710,11 +2710,11 @@ check_bitfield_decl (tree field) 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); } @@ -6906,15 +6906,13 @@ build_vtt_inits (tree binfo, tree t, tree* inits, tree* index) 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; diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index ada58888178..bf906fd969e 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -1116,7 +1116,7 @@ type_promotes_to (tree type) 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 @@ -1125,7 +1125,7 @@ type_promotes_to (tree type) 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 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index ce530fa4709..4570d8b7549 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9759,7 +9759,7 @@ finish_enum (tree enumtype) { 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) @@ -9796,7 +9796,7 @@ finish_enum (tree enumtype) 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. */ @@ -9822,7 +9822,7 @@ finish_enum (tree enumtype) 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. */ diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index d8c615b7848..81ac4ad1b22 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -1693,11 +1693,11 @@ write_builtin_type (tree 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 (); diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 3a1fcb48a96..6e15e611317 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -766,8 +766,8 @@ finish_switch_cond (tree cond, tree switch_stmt) 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; } } @@ -1838,7 +1838,7 @@ finish_unary_op_expr (enum tree_code code, tree expr) 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); diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index edd86ea9926..a0145a0d0ad 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -347,7 +347,7 @@ type_after_usual_arithmetic_conversions (tree t1, tree t2) 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); @@ -361,12 +361,12 @@ type_after_usual_arithmetic_conversions (tree t1, tree t2) 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); @@ -2872,7 +2872,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, 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))); @@ -2901,7 +2901,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_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; @@ -3160,7 +3160,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, 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; @@ -3169,9 +3169,9 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, 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. */ @@ -3223,7 +3223,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, 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 @@ -3236,7 +3236,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, 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)))) @@ -3278,8 +3278,8 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, 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); @@ -3303,7 +3303,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, /* 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) @@ -5557,10 +5557,9 @@ dubious_conversion_warnings (tree type, tree expr, } /* 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'", diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 99d2767d962..1118a182690 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -1384,7 +1384,7 @@ dbxout_type (tree type, int full) 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 @@ -1492,7 +1492,7 @@ dbxout_type (tree type, int full) 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; @@ -1914,10 +1914,10 @@ print_int_cst_bounds_in_octal_p (tree type) && 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; diff --git a/gcc/dojump.c b/gcc/dojump.c index f19cbcc3d91..eb98e76e4a8 100644 --- a/gcc/dojump.c +++ b/gcc/dojump.c @@ -642,7 +642,7 @@ do_jump (tree exp, rtx if_false_label, rtx if_true_label) 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); } @@ -672,9 +672,10 @@ do_jump_by_parts_greater (tree exp, int swap, rtx if_false_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. @@ -747,7 +748,7 @@ do_jump_by_parts_equality (tree exp, rtx if_false_label, rtx if_true_label) 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) @@ -1017,7 +1018,7 @@ do_compare_and_jump (tree exp, enum rtx_code signed_code, 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 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 9181546052f..86512a4f8f5 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -7853,7 +7853,7 @@ base_type_die (tree type) || ! 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; @@ -7863,7 +7863,7 @@ base_type_die (tree type) 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; @@ -8729,7 +8729,7 @@ loc_descriptor_from_tree (tree loc, int addressp) { 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 @@ -8988,28 +8988,28 @@ loc_descriptor_from_tree (tree loc, int addressp) 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; @@ -10904,7 +10904,7 @@ gen_enumeration_type_die (tree type, dw_die_ref context_die) 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 diff --git a/gcc/expmed.c b/gcc/expmed.c index 208e947ea6b..5d213c38b3d 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -4176,8 +4176,9 @@ make_tree (tree type, rtx x) { 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; diff --git a/gcc/expr.c b/gcc/expr.c index fd129c115b2..3365aef2e10 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -2151,7 +2151,7 @@ copy_blkmode_from_reg (rtx tgtblk, rtx srcreg, tree type) 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, @@ -3881,7 +3881,7 @@ expand_assignment (tree to, tree from, int want_value) 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); } @@ -3971,7 +3971,7 @@ expand_assignment (tree to, tree from, int want_value) 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, @@ -3979,7 +3979,7 @@ expand_assignment (tree to, tree from, int want_value) 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); @@ -4149,7 +4149,7 @@ store_expr (tree exp, rtx target, int want_value) && 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 @@ -4238,7 +4238,7 @@ store_expr (tree exp, rtx target, int want_value) && 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 @@ -4279,7 +4279,7 @@ store_expr (tree exp, rtx target, int want_value) 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, @@ -4320,7 +4320,7 @@ store_expr (tree exp, rtx target, int want_value) /* 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)); @@ -4342,7 +4342,7 @@ store_expr (tree exp, rtx target, int want_value) #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, @@ -4685,7 +4685,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) 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); } @@ -4848,7 +4848,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) 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) @@ -4906,7 +4906,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) 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); @@ -5450,7 +5450,7 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize, 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)); @@ -6160,7 +6160,7 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode, { 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; @@ -6178,6 +6178,8 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode, } 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; @@ -6918,7 +6920,7 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode, 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); @@ -7277,7 +7279,7 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode, 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)); @@ -7475,7 +7477,7 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode, /* 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; @@ -7498,7 +7500,7 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode, inner_mode)); else return convert_modes (mode, inner_mode, op0, - TREE_UNSIGNED (inner_type)); + TYPE_UNSIGNED (inner_type)); } if (modifier == EXPAND_INITIALIZER) @@ -7507,10 +7509,10 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode, 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: @@ -7804,18 +7806,22 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode, || 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; @@ -7924,7 +7930,7 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode, 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: @@ -7951,7 +7957,7 @@ expand_expr_real (tree exp, rtx target, enum machine_mode tmode, /* 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, @@ -9286,7 +9292,7 @@ expand_increment (tree exp, int post, int ignore) /* 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) @@ -9346,7 +9352,7 @@ do_store_flag (tree exp, rtx target, enum machine_mode mode, int only_cheap) 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. */ @@ -9619,7 +9625,7 @@ try_casesi (tree index_type, tree index_expr, tree minval, tree range, 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); @@ -9628,7 +9634,7 @@ try_casesi (tree index_type, tree index_expr, tree minval, tree range, 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); @@ -9742,7 +9748,7 @@ try_tablejump (tree index_type, tree index_expr, tree minval, tree range, 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; } diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index c2eefad81cd..f81e5a38367 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,8 @@ +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. diff --git a/gcc/f/com.c b/gcc/f/com.c index e81d844d156..178326b0ea8 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -912,7 +912,7 @@ ffecom_arrayref_ (tree item, ffebld expr, int want_ptr) 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); @@ -958,7 +958,7 @@ ffecom_arrayref_ (tree item, ffebld expr, int want_ptr) 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); @@ -2955,7 +2955,7 @@ ffecom_expr_ (ffebld expr, tree dest_tree, ffebld dest, bool *dest_used, 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)) { diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 9be1ceae023..78fb2789d87 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -224,7 +224,7 @@ force_fit_type (tree t, int overflow) /* 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; @@ -853,7 +853,7 @@ negate_expr_p (tree t) 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. */ @@ -897,7 +897,7 @@ negate_expr_p (tree t) TREE_OPERAND (t, 1)); case MULT_EXPR: - if (TREE_UNSIGNED (TREE_TYPE (t))) + if (TYPE_UNSIGNED (TREE_TYPE (t))) break; /* Fall through. */ @@ -962,7 +962,7 @@ negate_expr (tree t) case INTEGER_CST: tem = fold_negate_const (t, type); if (! TREE_OVERFLOW (tem) - || TREE_UNSIGNED (type) + || TYPE_UNSIGNED (type) || ! flag_trapv) return tem; break; @@ -1021,7 +1021,7 @@ negate_expr (tree t) break; case MULT_EXPR: - if (TREE_UNSIGNED (TREE_TYPE (t))) + if (TYPE_UNSIGNED (TREE_TYPE (t))) break; /* Fall through. */ @@ -1077,7 +1077,7 @@ negate_expr (tree t) && (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)); @@ -1241,7 +1241,7 @@ int_const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc) 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; @@ -1682,7 +1682,7 @@ size_diffop (tree arg0, tree arg1) 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 @@ -1751,8 +1751,8 @@ fold_convert_const (enum tree_code code, tree type, tree arg1) 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) @@ -2159,10 +2159,14 @@ operand_equal_p (tree arg0, tree arg1, int only_const) { 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); @@ -2253,8 +2257,8 @@ operand_equal_p (tree arg0, tree arg1, int only_const) 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), @@ -3057,7 +3061,7 @@ decode_field_reference (tree exp, HOST_WIDE_INT *pbitsize, 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); @@ -3377,7 +3381,7 @@ make_range (tree exp, int *pin_p, tree *plow, tree *phigh) 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), @@ -3481,7 +3485,7 @@ make_range (tree exp, int *pin_p, tree *plow, tree *phigh) 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); @@ -3582,7 +3586,7 @@ build_range_check (tree type, tree exp, int in_p, tree low, tree high) if (integer_zerop (low)) { - if (! TREE_UNSIGNED (etype)) + if (! TYPE_UNSIGNED (etype)) { etype = lang_hooks.types.unsigned_type (etype); high = fold_convert (etype, high); @@ -3612,7 +3616,7 @@ build_range_check (tree type, tree exp, int in_p, tree low, tree 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); @@ -3866,7 +3870,7 @@ unextend (tree c, int p, int unsignedp, tree mask) 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); @@ -3875,7 +3879,7 @@ unextend (tree c, int p, int unsignedp, tree mask) 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)); @@ -4504,7 +4508,7 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type) || 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)) @@ -4516,8 +4520,8 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type) /* ... 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 @@ -4540,7 +4544,7 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type) 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) */ @@ -4631,7 +4635,7 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type) /* 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; @@ -4696,7 +4700,7 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type) 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) @@ -5631,17 +5635,17 @@ fold (tree 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 @@ -5733,7 +5737,7 @@ fold (tree expr) 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; @@ -6087,7 +6091,7 @@ fold (tree expr) || (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; @@ -6668,7 +6672,7 @@ fold (tree expr) 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))); @@ -6938,7 +6942,7 @@ fold (tree expr) 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 ... */ @@ -7413,7 +7417,7 @@ fold (tree expr) 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; @@ -7502,7 +7506,7 @@ fold (tree expr) 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))) { @@ -7559,8 +7563,8 @@ fold (tree expr) && 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 @@ -7631,7 +7635,7 @@ fold (tree expr) 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 @@ -7706,7 +7710,7 @@ fold (tree 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, @@ -7715,7 +7719,7 @@ fold (tree expr) 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 @@ -8001,14 +8005,14 @@ fold (tree 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)); @@ -8655,7 +8659,7 @@ multiple_of_p (tree type, tree top, tree bottom) 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; @@ -8696,8 +8700,8 @@ tree_expr_nonnegative_p (tree t) { 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; @@ -8724,8 +8728,8 @@ tree_expr_nonnegative_p (tree t) { 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)); } @@ -8767,7 +8771,7 @@ tree_expr_nonnegative_p (tree 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)); } @@ -8778,7 +8782,7 @@ tree_expr_nonnegative_p (tree t) 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; @@ -8916,14 +8920,14 @@ tree_expr_nonzero_p (tree t) 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. */ @@ -8937,7 +8941,7 @@ tree_expr_nonzero_p (tree t) 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))); @@ -9068,7 +9072,7 @@ fold_negate_const (tree arg0, tree type) 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); } @@ -9096,7 +9100,7 @@ fold_abs_const (tree arg0, tree type) { /* 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)) @@ -9180,7 +9184,7 @@ fold_relational_const (enum tree_code code, tree type, tree op0, tree op1) 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); diff --git a/gcc/function.c b/gcc/function.c index 0f4807d28f3..90de28400e5 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -852,7 +852,7 @@ assign_temp (tree type_or_decl, int keep, int memory_required, mode = TYPE_MODE (type); #ifndef PROMOTE_FOR_CALL_ONLY - unsignedp = TREE_UNSIGNED (type); + unsignedp = TYPE_UNSIGNED (type); #endif if (mode == BLKmode || memory_required) @@ -1488,7 +1488,7 @@ static void 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) { @@ -2882,7 +2882,7 @@ gen_mem_addressof (rtx reg, tree decl, int rescan) 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) { @@ -4476,8 +4476,9 @@ assign_parms (tree fndecl) 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. @@ -4901,7 +4902,7 @@ assign_parms (tree fndecl) 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); @@ -5001,7 +5002,7 @@ assign_parms (tree fndecl) 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, @@ -5194,7 +5195,7 @@ assign_parms (tree fndecl) 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); @@ -5442,7 +5443,7 @@ promoted_input_arg (unsigned int regno, enum machine_mode *pmode, int *punsigned && 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)) @@ -7135,7 +7136,7 @@ expand_function_end (void) 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), diff --git a/gcc/integrate.c b/gcc/integrate.c index d715ef26222..567cd9317ca 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -761,7 +761,7 @@ expand_inline_function (tree fndecl, tree parms, rtx target, int ignore, { 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, diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 11d090d3b7d..b63afb35923 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,7 @@ +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 diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index 9492396bc87..36a21d3f740 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -2241,7 +2241,7 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state) /* 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); diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index ae0a98e5371..8c65f08257b 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -7342,16 +7342,16 @@ encode_type (tree type, int curtype, int format) { 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); diff --git a/gcc/optabs.c b/gcc/optabs.c index 0dfc093a7c1..1091cc81201 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -3644,7 +3644,7 @@ prepare_cmp_insn (rtx *px, rtx *py, enum rtx_code *pcomparison, rtx size, 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, diff --git a/gcc/sdbout.c b/gcc/sdbout.c index 7f6a398edcc..a6dda215685 100644 --- a/gcc/sdbout.c +++ b/gcc/sdbout.c @@ -538,15 +538,15 @@ plain_type_1 (tree type, int level) } 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; } diff --git a/gcc/stmt.c b/gcc/stmt.c index a28a01484d7..aee57444195 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -3002,7 +3002,7 @@ expand_value_return (rtx val) 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 @@ -3359,7 +3359,7 @@ tail_recursion_args (tree actuals, tree formals) 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))) @@ -3945,7 +3945,7 @@ expand_decl (tree decl) && (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); @@ -5344,7 +5344,7 @@ expand_end_case_type (tree orig_index, tree orig_type) 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); @@ -6145,7 +6145,7 @@ emit_case_nodes (rtx index, case_node_ptr node, rtx default_label, 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); diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index ab5345cf0d1..340608fc1dd 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -364,7 +364,7 @@ layout_decl (tree decl, unsigned int known_align) 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); @@ -1529,7 +1529,7 @@ layout_type (tree 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); @@ -1544,25 +1544,20 @@ layout_type (tree type) 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: @@ -1602,7 +1597,7 @@ layout_type (tree 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; @@ -1652,7 +1647,7 @@ layout_type (tree type) 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); @@ -1851,7 +1846,7 @@ initialize_sizetypes (void) 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; @@ -1895,14 +1890,14 @@ set_sizetype (tree type) 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; diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c index c00cc5fe2eb..e0dd6f1e437 100644 --- a/gcc/tree-dump.c +++ b/gcc/tree-dump.c @@ -409,7 +409,7 @@ dequeue_and_dump (dump_info_p di) 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)); diff --git a/gcc/tree.c b/gcc/tree.c index eca5f20dd7b..be153225cf0 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -499,7 +499,7 @@ real_value_from_int_cst (tree type, tree i) 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; } @@ -630,7 +630,7 @@ integer_all_onesp (tree expr) || 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); @@ -3473,7 +3473,7 @@ tree_int_cst_lt (tree t1, tree t2) 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); @@ -3486,7 +3486,7 @@ tree_int_cst_lt (tree t1, tree 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); @@ -3519,7 +3519,7 @@ host_integerp (tree t, int pos) && (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))); } @@ -3562,7 +3562,7 @@ tree_int_cst_sgn (tree t) { 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; @@ -4364,7 +4364,7 @@ get_unwidened (tree op, tree for_type) 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) @@ -4394,11 +4394,11 @@ get_unwidened (tree op, tree for_type) { 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; @@ -4416,7 +4416,7 @@ get_unwidened (tree op, tree for_type) 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. @@ -4471,11 +4471,11 @@ get_narrower (tree op, int *unsignedp_ptr) /* 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; } @@ -4484,7 +4484,7 @@ get_narrower (tree op, int *unsignedp_ptr) /* 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); } @@ -4501,7 +4501,7 @@ get_narrower (tree op, int *unsignedp_ptr) 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, @@ -4542,10 +4542,10 @@ int_fits_type_p (tree c, tree type) /* 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 @@ -5356,7 +5356,6 @@ build_vector_type_for_mode (tree innertype, enum machine_mode mode) 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; } diff --git a/gcc/tree.h b/gcc/tree.h index 8af963fd4c7..d57e4abf410 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -262,8 +262,10 @@ struct tree_common GTY(()) unsigned_flag: + TYPE_UNSIGNED in + all types TREE_UNSIGNED in - INTEGER_TYPE, ENUMERAL_TYPE, FIELD_DECL + FIELD_DECL SAVE_EXPR_NOPLACEHOLDER in SAVE_EXPR @@ -516,8 +518,8 @@ extern void tree_operand_check_failed (int, enum tree_code, && 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. */ @@ -712,8 +714,11 @@ extern void tree_operand_check_failed (int, enum tree_code, 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. @@ -903,7 +908,9 @@ struct tree_vec GTY(()) #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 diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog index 5c5ca9a1b46..06a962bdae5 100644 --- a/gcc/treelang/ChangeLog +++ b/gcc/treelang/ChangeLog @@ -1,3 +1,8 @@ +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". diff --git a/gcc/treelang/treetree.c b/gcc/treelang/treetree.c index 7697e3c49e5..c8be057ddac 100644 --- a/gcc/treelang/treetree.c +++ b/gcc/treelang/treetree.c @@ -1027,7 +1027,7 @@ tree_lang_signed_type (tree type_node) 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); |