+2007-01-08 Richard Guenther <rguenther@suse.de>
+
+ * tree.h (build_int_cst_wide_type): Export.
+ * tree.c (build_int_cst_wide_type): New function.
+ (build_int_cst_wide): Fix comment.
+ * builtins.c (fold_builtin_object_size): Use build_int_cst
+ to build -1 or 0 of the correct type. Use fit_double_type
+ to check for overflow.
+ * fold-const.c (optimize_bit_field_compare): Use build_int_cst_type
+ to build the mask.
+ (decode_field_reference): Likewise.
+ (all_ones_mask_p): Likewise.
+ (native_interpret_int): Use build_int_cst_wide_type.
+ (fold_binary): Use build_int_cst_type to build an all-ones
+ value.
+ * stor-layout.c (set_sizetype): Use build_int_cst_wide_type.
+
2007-01-08 Daniel Jacobowitz <dan@codesourcery.com>
* config/pa/t-pa64 (libgcc_stub.a): Use $(T).
+2007-01-08 Richard Guenther <rguenther@suse.de>
+
+ * cuintp.c (build_cst_from_int): Use built_int_cst_type.
+ * trans.c (gnat_to_gnu): Likewise.
+
2006-12-07 Geoffrey Keating <geoffk@apple.com>
* Makefile.in: Replace CROSS_COMPILE with CROSS_DIRECTORY_STRUCTURE.
if (TREE_CODE (type) == REAL_TYPE)
return convert (type, build_int_cst (NULL_TREE, low));
else
- return force_fit_type (build_int_cst (type, low), false, false, false);
+ return build_int_cst_type (type, low);
}
/* Similar to UI_To_Int, but return a GCC INTEGER_CST or REAL_CST node,
gnu_result = DECL_INITIAL (get_gnu_tree (Entity (gnat_node)));
else
gnu_result
- = force_fit_type
- (build_int_cst
- (gnu_result_type, UI_To_CC (Char_Literal_Value (gnat_node))),
- false, false, false);
+ = build_int_cst_type
+ (gnu_result_type, UI_To_CC (Char_Literal_Value (gnat_node)));
break;
case N_Real_Literal:
if there are any side-effects, it returns (size_t) -1 for types 0 and 1
and (size_t) 0 for types 2 and 3. */
if (TREE_SIDE_EFFECTS (ptr))
- return fold_convert (size_type_node,
- object_size_type < 2
- ? integer_minus_one_node : integer_zero_node);
+ return build_int_cst_type (size_type_node, object_size_type < 2 ? -1 : 0);
if (TREE_CODE (ptr) == ADDR_EXPR)
ret = build_int_cstu (size_type_node,
- compute_builtin_object_size (ptr, object_size_type));
+ compute_builtin_object_size (ptr, object_size_type));
else if (TREE_CODE (ptr) == SSA_NAME)
{
if (ret)
{
- ret = force_fit_type (ret, -1, false, false);
- if (TREE_CONSTANT_OVERFLOW (ret))
- ret = 0;
+ unsigned HOST_WIDE_INT low = TREE_INT_CST_LOW (ret);
+ HOST_WIDE_INT high = TREE_INT_CST_HIGH (ret);
+ if (fit_double_type (low, high, &low, &high, TREE_TYPE (ret)))
+ ret = NULL_TREE;
}
return ret;
+2007-01-08 Richard Guenther <rguenther@suse.de>
+
+ * cvt.c (cp_convert_to_pointer): Use build_int_cst_type.
+
2007-01-08 Mark Shinwell <shinwell@codesourcery.com>
* call.c (standard_conversion): Pass flag to
{
/* A NULL pointer-to-member is represented by -1, not by
zero. */
- expr = build_int_cst (type, -1);
- /* Fix up the representation of -1 if appropriate. */
- expr = force_fit_type (expr, 0, false, false);
+ expr = build_int_cst_type (type, -1);
}
else
expr = build_int_cst (type, 0);
lbitpos = nbitsize - lbitsize - lbitpos;
/* Make the mask to be used against the extracted field. */
- mask = build_int_cst (unsigned_type, -1);
- mask = force_fit_type (mask, 0, false, false);
- mask = fold_convert (unsigned_type, mask);
+ mask = build_int_cst_type (unsigned_type, -1);
mask = const_binop (LSHIFT_EXPR, mask, size_int (nbitsize - lbitsize), 0);
mask = const_binop (RSHIFT_EXPR, mask,
size_int (nbitsize - lbitsize - lbitpos), 0);
unsigned_type = lang_hooks.types.type_for_size (*pbitsize, 1);
precision = TYPE_PRECISION (unsigned_type);
- mask = build_int_cst (unsigned_type, -1);
- mask = force_fit_type (mask, 0, false, false);
+ mask = build_int_cst_type (unsigned_type, -1);
mask = const_binop (LSHIFT_EXPR, mask, size_int (precision - *pbitsize), 0);
mask = const_binop (RSHIFT_EXPR, mask, size_int (precision - *pbitsize), 0);
unsigned int precision = TYPE_PRECISION (type);
tree tmask;
- tmask = build_int_cst (lang_hooks.types.signed_type (type), -1);
- tmask = force_fit_type (tmask, 0, false, false);
+ tmask = build_int_cst_type (lang_hooks.types.signed_type (type), -1);
return
tree_int_cst_equal (mask,
<< (bitpos - HOST_BITS_PER_WIDE_INT);
}
- return force_fit_type (build_int_cst_wide (type, lo, hi),
- 0, false, false);
+ return build_int_cst_wide_type (type, lo, hi);
}
&& operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0)
&& !TYPE_TRAP_SIGNED (type))
{
- t1 = build_int_cst (type, -1);
- t1 = force_fit_type (t1, 0, false, false);
+ t1 = build_int_cst_type (type, -1);
return omit_one_operand (type, t1, arg1);
}
&& operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0)
&& !TYPE_TRAP_SIGNED (type))
{
- t1 = build_int_cst (type, -1);
- t1 = force_fit_type (t1, 0, false, false);
+ t1 = build_int_cst_type (type, -1);
return omit_one_operand (type, t1, arg0);
}
if (TREE_CODE (arg0) == BIT_NOT_EXPR
&& operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0))
{
- t1 = build_int_cst (type, -1);
- t1 = force_fit_type (t1, 0, false, false);
+ t1 = build_int_cst_type (type, -1);
return omit_one_operand (type, t1, arg1);
}
if (TREE_CODE (arg1) == BIT_NOT_EXPR
&& operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0))
{
- t1 = build_int_cst (type, -1);
- t1 = force_fit_type (t1, 0, false, false);
+ t1 = build_int_cst_type (type, -1);
return omit_one_operand (type, t1, arg0);
}
if (TREE_CODE (arg0) == BIT_NOT_EXPR
&& operand_equal_p (TREE_OPERAND (arg0, 0), arg1, 0))
{
- t1 = build_int_cst (type, -1);
- t1 = force_fit_type (t1, 0, false, false);
+ t1 = build_int_cst_type (type, -1);
return omit_one_operand (type, t1, arg1);
}
if (TREE_CODE (arg1) == BIT_NOT_EXPR
&& operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0))
{
- t1 = build_int_cst (type, -1);
- t1 = force_fit_type (t1, 0, false, false);
+ t1 = build_int_cst_type (type, -1);
return omit_one_operand (type, t1, arg0);
}
+2007-01-08 Richard Guenther <rguenther@suse.de>
+
+ * lex.c (do_java_lex): Use build_int_cst_wide_type.
+ * jcf-parse.c (get_constant): Likewise.
+
2006-11-12 Jan Hubicka <jh@suse.cz>
* resource.c (compile_resource_data): Update for new varpool names.
lshift_double (num, 0, 32, 64, &lo, &hi, 0);
num = JPOOL_UINT (jcf, index+1);
add_double (lo, hi, num, 0, &lo, &hi);
- value = build_int_cst_wide (long_type_node, lo, hi);
- value = force_fit_type (value, 0, false, false);
+ value = build_int_cst_wide_type (long_type_node, lo, hi);
break;
}
}
/* Sign extend the value. */
- value = build_int_cst_wide (long_suffix ? long_type_node : int_type_node,
- low, high);
- value = force_fit_type (value, 0, false, false);
+ value = build_int_cst_wide_type (long_suffix ? long_type_node
+ : int_type_node, low, high);
if (radix != 10)
{
orig_max = TYPE_MAX_VALUE (sizetype);
- /* Build a new node with the same values, but a different type. */
- new_max = build_int_cst_wide (sizetype,
- TREE_INT_CST_LOW (orig_max),
- TREE_INT_CST_HIGH (orig_max));
-
- /* Now sign extend it using force_fit_type to ensure
- consistency. */
- new_max = force_fit_type (new_max, 0, 0, 0);
+ /* Build a new node with the same values, but a different type.
+ Sign extend it to ensure consistency. */
+ new_max = build_int_cst_wide_type (sizetype,
+ TREE_INT_CST_LOW (orig_max),
+ TREE_INT_CST_HIGH (orig_max));
TYPE_MAX_VALUE (sizetype) = new_max;
}
}
return build_int_cst_wide (type, low1, hi);
}
+/* Create an INT_CST node of TYPE and value HI:LOW. The value is truncated
+ and sign extended according to the value range of TYPE. */
+
+tree
+build_int_cst_wide_type (tree type,
+ unsigned HOST_WIDE_INT low, HOST_WIDE_INT high)
+{
+ fit_double_type (low, high, &low, &high, type);
+ return build_int_cst_wide (type, low, high);
+}
+
/* These are the hash table functions for the hash table of INTEGER_CST
nodes of a sizetype. */
&& TREE_INT_CST_LOW (xt) == TREE_INT_CST_LOW (yt));
}
-/* Create an INT_CST node of TYPE and value HI:LOW. If TYPE is NULL,
- integer_type_node is used. The returned node is always shared.
- For small integers we use a per-type vector cache, for larger ones
- we use a single hash table. */
+/* Create an INT_CST node of TYPE and value HI:LOW.
+ The returned node is always shared. For small integers we use a
+ per-type vector cache, for larger ones we use a single hash table. */
tree
build_int_cst_wide (tree type, unsigned HOST_WIDE_INT low, HOST_WIDE_INT hi)
extern tree build_int_cst_type (tree, HOST_WIDE_INT);
extern tree build_int_cstu (tree, unsigned HOST_WIDE_INT);
extern tree build_int_cst_wide (tree, unsigned HOST_WIDE_INT, HOST_WIDE_INT);
+extern tree build_int_cst_wide_type (tree,
+ unsigned HOST_WIDE_INT, HOST_WIDE_INT);
extern tree build_vector (tree, tree);
extern tree build_vector_from_ctor (tree, VEC(constructor_elt,gc) *);
extern tree build_constructor (tree, VEC(constructor_elt,gc) *);