aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2000-03-07 11:41:32 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2000-03-07 06:41:32 -0500
commit05bccae2efd712562a20afadfc2889d87323e7ca (patch)
treeeedf389b906e1f6d1fda0e405c46b8b47fb6d064 /gcc/cp
parentddf0fc6c9f1eb8747c9cf6b69e48f11f779632d2 (diff)
downloadgcc-05bccae2efd712562a20afadfc2889d87323e7ca.zip
gcc-05bccae2efd712562a20afadfc2889d87323e7ca.tar.gz
gcc-05bccae2efd712562a20afadfc2889d87323e7ca.tar.bz2
tree.h (INT_CST_LT, [...]): Remove unneeded casts.
* tree.h (INT_CST_LT, INT_CST_LT_UNSIGNED): Remove unneeded casts. (struct tree_int_cst): int_cst_low is now unsigned HOST_WIDE_INT. (attribute_hash_list, type_hash_canon): hashcode is now unsigned. (type_hash_lookup, type_hash_add, type_hash_list): Likewise. (min_precision): Result is unsignd. (add_double, neg_double, mul_double): Low word is unsigned. (lshift_double, rshift_double, lrotate_double): Likewise. (rrotate_double, div_and_round_double): Likewise. (tree_floor_log2, compare_tree_int): New functions. (preserve_rtl_expr_temps): New declaration. * c-common.c (declare_hidden_char_array): Use compare_tree_int. (decl_attributes): Use tree_log2 to find alignment. Check for TREE_INT_CST_HIGH for format args. (min_precision): Now unsigned. Use tree_floor_log2. (truthvalue_conversion): Delete long-disabled code. * c-decl.c (finish_struct): Clean up tests on field width. (finish_function): Use compare_tree_int. * c-pragma.c (handle_pragma_token): Use tree_log2 for alignment. * c-typeck.c (comptypes): Use tree_int_cst_equal. (default_conversion, digest_init): Use compare_tree_int. (build_binary_op): Use integer_all_onesp and compare_tree_int. Fix type errors in forming masks. * calls.c (initialize_argument_information): Use compare_tree_int. * dbxout.c (dbxout_type): Cast TREE_INT_CST_LOW to HOST_WIDE_INT. * except.c (expand_eh_region_start_tree): Use compare_tree_int. * expr.c (is_zeros_p, case INTEGER_CST): Use integer_zerop. (store_field): Use compare_tree_int. (expand_expr, case CONSTRUCTOR): Use TYPE_SIZE_UNIT. (expand_expr, case ARRAY_REF): Use compare_tree_int. (do_jump, case BIT_AND_EXPR): Use tree_floor_log2. (do_store_flag): Use compare_tree_int. * fold-const.c (encode, decode): Low part is always unsigned. (force_fit_type, add_double, neg_double, mul_double): Likewise. (lshift_double, rshift_double, lrotate_double): Likewise. (rrotate_double, div_and_round_double, int_const_binop): Likewise. (fold_convert): Use compare_tree_int. (operand_equal_p, case INTEGER_CST): Use tree_int_cst_equal. (invert_truthvalue, case INTEGER_CST): Likewise. (fold): Use compare_tree_int; add casts for unsigned TREE_INT_CST_LOW. * mkdeps.c (deps_dummy_targets): Make I unsigned. * rtl.h (add_double, neg_double, mul_double): Low words are unsigned. (lshift_double, rshift_double, lrotate_double, rrotate_double): Likewise. * stmt.c (expand_decl): Use compare_tree_int and mode_for_size_tree. (expand_end_case): Use compare_tree_int. (estimate_case_costs): Cast TREE_INT_CST_LOW to HOST_WIDE_INT. * stor-layout.c (mode_for_size_tree): Use compare_tree_int. (layout_decl): Likewise. (layout_record, layout_union): Make sizes unsigned. (layout_type, case VOID_TYPE): TYPE_SIZE must be bitsizetype. (layout_type, case QUAL_UNION_TYPE): Use compare_tree_int. * tree.c (struct type_hash): hashcode is unsigned. (build_type_attribute_variant, type_hash_list): Likewise. (type_hash_lookup, type_hash_add, type_hash_canon): Likewise. (attribute_hash_list, build_array_type, build_method_type): Likewise. (build_complex_type): Likewise. (real_value_from_int_cst): Remove unneeded casts. (integer_all_onesp): Add casts. (tree_floor_log2, compare_tree_int): New functions. (build_index_type): Use tree_int_cst_sgn. * varasm.c (assemble_variable): Use compare_tree_int. * ch/actions.c (chill_convert_for_assignment): INDEX is unsigned HOST_WIDE_INT. * ch/ch-tree.h (DECL_NESTING_LEVEL): Use TREE_INT_CST_HIGH since unsigned. * ch/except.c (chill_handle_on_labels): ALTERNATIVE is unsigned. Use compare_tree_int. (expand_goto_except_cleanup): Likewise. * cp/class.c (dfs_modify_vtables): I is now unsigned. (check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int. (build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT. * cp/error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned. * cp/init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT. * cp/method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned. * cp/typeck.c (build_binary_op, case TRUNC_DIV_EXPR): Call integer_all_onesp. * cp/typeck2.c (process_init_constructor): Use compare_tree_int. * f/com.c (ffecom_f2c_set_lio_code_): Use compare_tree_int. (ffecom_sym_transform_, ffecom_transform_common_): Likewise. (ffecom_transform_equiv_): Likewise. * java/decl.c (emit_init_test_initialization): Mark KEY as unused. * java/expr.c (build_newarray): Cast TREE_INT_CST_LOW to HOST_WIDE_INT. (build_anewarray): Likewise. * java/parse.y (patch_newarray): Likewise. * java/parse.c: Regenerated. From-SVN: r32383
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/class.c35
-rw-r--r--gcc/cp/error.c5
-rw-r--r--gcc/cp/init.c5
-rw-r--r--gcc/cp/method.c6
-rw-r--r--gcc/cp/typeck.c7
-rw-r--r--gcc/cp/typeck2.c12
7 files changed, 47 insertions, 33 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 05c2158..e6f17ea 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -5,6 +5,16 @@
Mon Mar 6 08:46:47 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+ * class.c (dfs_modify_vtables): I is now unsigned.
+ (check_bitfield_decl): Use tree_int_cst_sgn and compare_tree_int.
+ (build_base_field): Add casts of TREE_INT_CST_LOW to HOST_WIDE_INT.
+ * error.c (dump_expr): Cast TREE_INT_CST_HIGH to unsigned.
+ * init.c (build_vec_init): Cast TREE_INT_CST_LOW to HOST_WIDE_INT.
+ * method.c (build_overload_int): Cast TREE_INT_CST_HIGH to unsigned.
+ * typeck.c (build_binary_op, case TRUNC_DIV_EXPR):
+ Call integer_all_onesp.
+ * typeck2.c (process_init_constructor): Use compare_tree_int.
+
* lang-specs.h (as): Don't call if -syntax-only.
2000-03-06 Mark Mitchell <mark@codesourcery.com>
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index c76146a..d19172a 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3108,7 +3108,7 @@ dfs_modify_vtables (binfo, data)
tree overrider;
tree vindex;
tree delta;
- HOST_WIDE_INT i;
+ unsigned HOST_WIDE_INT i;
/* Find the function which originally caused this vtable
entry to be present. */
@@ -3627,7 +3627,6 @@ check_bitfield_decl (field)
if (DECL_INITIAL (field))
{
tree w = DECL_INITIAL (field);
- register int width = 0;
/* Avoid the non_lvalue wrapper added by fold for PLUS_EXPRs. */
STRIP_NOPS (w);
@@ -3644,19 +3643,19 @@ check_bitfield_decl (field)
field);
DECL_INITIAL (field) = NULL_TREE;
}
- else if (width = TREE_INT_CST_LOW (w),
- width < 0)
+ else if (tree_int_cst_sgn (w) < 0)
{
DECL_INITIAL (field) = NULL;
cp_error_at ("negative width in bit-field `%D'", field);
}
- else if (width == 0 && DECL_NAME (field) != 0)
+ else if (integer_zerop (w) && DECL_NAME (field) != 0)
{
DECL_INITIAL (field) = NULL;
cp_error_at ("zero width for bit-field `%D'", field);
}
- else if (width
- > TYPE_PRECISION (long_long_unsigned_type_node))
+ else if (0 < compare_tree_int (w,
+ TYPE_PRECISION
+ (long_long_unsigned_type_node)))
{
/* The backend will dump if you try to use something too
big; avoid that. */
@@ -3665,25 +3664,28 @@ check_bitfield_decl (field)
TYPE_PRECISION (long_long_unsigned_type_node));
cp_error_at (" in declaration of `%D'", field);
}
- else if (width > TYPE_PRECISION (type)
+ else if (compare_tree_int (w, TYPE_PRECISION (type)) > 0
&& TREE_CODE (type) != ENUMERAL_TYPE
&& TREE_CODE (type) != BOOLEAN_TYPE)
cp_warning_at ("width of `%D' exceeds its type", field);
else if (TREE_CODE (type) == ENUMERAL_TYPE
- && ((min_precision (TYPE_MIN_VALUE (type),
- TREE_UNSIGNED (type)) > width)
- || (min_precision (TYPE_MAX_VALUE (type),
- TREE_UNSIGNED (type)) > width)))
+ && (0 > compare_tree_int (w,
+ min_precision (TYPE_MIN_VALUE (type),
+ TREE_UNSIGNED (type)))
+ || 0 > compare_tree_int (w,
+ min_precision
+ (TYPE_MAX_VALUE (type),
+ TREE_UNSIGNED (type)))))
cp_warning_at ("`%D' is too small to hold all values of `%#T'",
field, type);
if (DECL_INITIAL (field))
{
DECL_INITIAL (field) = NULL_TREE;
- DECL_SIZE (field) = bitsize_int (width);
+ DECL_SIZE (field) = bitsize_int (TREE_INT_CST_LOW (w));
DECL_BIT_FIELD (field) = 1;
- if (width == 0)
+ if (integer_zerop (w))
{
#ifdef EMPTY_FIELD_BOUNDARY
DECL_ALIGN (field) = MAX (DECL_ALIGN (field),
@@ -4164,10 +4166,11 @@ build_base_field (t, binfo, empty_p, saw_empty_p, base_align)
here. */
*base_align = MAX (*base_align, DECL_ALIGN (decl));
DECL_SIZE (decl)
- = size_int (MAX (TREE_INT_CST_LOW (DECL_SIZE (decl)),
+ = size_int (MAX ((HOST_WIDE_INT) TREE_INT_CST_LOW (DECL_SIZE (decl)),
(int) (*base_align)));
DECL_SIZE_UNIT (decl)
- = size_int (MAX (TREE_INT_CST_LOW (DECL_SIZE_UNIT (decl)),
+ = size_int (MAX (((HOST_WIDE_INT) TREE_INT_CST_LOW
+ (DECL_SIZE_UNIT (decl))),
(int) *base_align / BITS_PER_UNIT));
}
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index ae6b511..0a26384 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -1490,11 +1490,12 @@ dump_expr (t, flags)
dump_char (TREE_INT_CST_LOW (t));
OB_PUTC ('\'');
}
- else if (TREE_INT_CST_HIGH (t)
+ else if ((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (t)
!= (TREE_INT_CST_LOW (t) >> (HOST_BITS_PER_WIDE_INT - 1)))
{
tree val = t;
- if (TREE_INT_CST_HIGH (val) < 0)
+
+ if (tree_int_cst_sgn (val) < 0)
{
OB_PUTC ('-');
val = build_int_2 (~TREE_INT_CST_LOW (val),
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index fb6c4e6..a2e0d22 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -2873,8 +2873,9 @@ build_vec_init (decl, base, maxindex, init, from_array)
if (from_array
|| (TYPE_NEEDS_CONSTRUCTING (type)
- && !(TREE_CODE (maxindex) == INTEGER_CST
- && num_initialized_elts == TREE_INT_CST_LOW (maxindex) + 1)))
+ && ! (TREE_CODE (maxindex) == INTEGER_CST
+ && (num_initialized_elts
+ == (HOST_WIDE_INT) TREE_INT_CST_LOW (maxindex) + 1))))
{
/* If the ITERATOR is equal to -1, then we don't have to loop;
we've already initialized all the elements. */
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 6fd98df..4a41e5a 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -600,7 +600,7 @@ build_overload_int (value, flags)
/* If the high-order word is not merely a sign-extension of the
low-order word, we must use a special output routine that can
deal with this. */
- if (TREE_INT_CST_HIGH (value)
+ if ((unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (value)
!= (TREE_INT_CST_LOW (value) >> (HOST_BITS_PER_WIDE_INT - 1)))
{
multiple_words_p = 1;
@@ -608,8 +608,8 @@ build_overload_int (value, flags)
multiple_digits_p = 1;
}
else
- multiple_digits_p = (TREE_INT_CST_LOW (value) > 9
- || TREE_INT_CST_LOW (value) < -9);
+ multiple_digits_p = ((HOST_WIDE_INT) TREE_INT_CST_LOW (value) > 9
+ || (HOST_WIDE_INT) TREE_INT_CST_LOW (value) < -9);
/* If necessary, add a leading underscore. */
if (multiple_digits_p && (flags & mf_use_underscores_around_value))
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 135378d..a47b088 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -3436,8 +3436,8 @@ build_binary_op (code, orig_op0, orig_op1)
shorten = ((TREE_CODE (op0) == NOP_EXPR
&& TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op0, 0))))
|| (TREE_CODE (op1) == INTEGER_CST
- && (TREE_INT_CST_LOW (op1) != -1
- || TREE_INT_CST_HIGH (op1) != -1)));
+ && ! integer_all_onesp (op1)));
+
common = 1;
}
break;
@@ -3491,8 +3491,7 @@ build_binary_op (code, orig_op0, orig_op1)
shorten = ((TREE_CODE (op0) == NOP_EXPR
&& TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op0, 0))))
|| (TREE_CODE (op1) == INTEGER_CST
- && (TREE_INT_CST_LOW (op1) != -1
- || TREE_INT_CST_HIGH (op1) != -1)));
+ && ! integer_all_onesp (op1)));
common = 1;
}
break;
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 88ddc89..9c1a33e 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -754,7 +754,7 @@ process_init_constructor (type, init, elts)
{
if (TREE_PURPOSE (tail)
&& (TREE_CODE (TREE_PURPOSE (tail)) != INTEGER_CST
- || TREE_INT_CST_LOW (TREE_PURPOSE (tail)) != i))
+ || compare_tree_int (TREE_PURPOSE (tail), i) != 0))
sorry ("non-trivial labeled initializers");
if (TREE_VALUE (tail) != 0)
@@ -1305,19 +1305,19 @@ enum_name_string (value, type)
tree type;
{
register tree values = TYPE_VALUES (type);
- register HOST_WIDE_INT intval = TREE_INT_CST_LOW (value);
my_friendly_assert (TREE_CODE (type) == ENUMERAL_TYPE, 324);
- while (values
- && TREE_INT_CST_LOW (TREE_VALUE (values)) != intval)
+
+ while (values && ! tree_int_cst_equal (TREE_VALUE (values), value))
values = TREE_CHAIN (values);
+
if (values == NULL_TREE)
{
- char *buf = (char *)oballoc (16 + TYPE_NAME_LENGTH (type));
+ char *buf = (char *) oballoc (16 + TYPE_NAME_LENGTH (type));
/* Value must have been cast. */
sprintf (buf, "(enum %s)%ld",
- TYPE_NAME_STRING (type), (long) intval);
+ TYPE_NAME_STRING (type), (long) TREE_INT_CST_LOW (value));
return buf;
}
return IDENTIFIER_POINTER (TREE_PURPOSE (values));