aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2007-01-08 22:53:20 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2007-01-08 22:53:20 +0000
commit2ac7cbb53296e6006d7c113d81175dd455fd570b (patch)
treec7ad9e6d3d7b86c201aaecf9a0017fb8badea1c3 /gcc/tree.c
parent1c61ff294690d6ce7c9e958f62ab48a441943844 (diff)
downloadgcc-2ac7cbb53296e6006d7c113d81175dd455fd570b.zip
gcc-2ac7cbb53296e6006d7c113d81175dd455fd570b.tar.gz
gcc-2ac7cbb53296e6006d7c113d81175dd455fd570b.tar.bz2
tree.h (build_int_cst_wide_type): Export.
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. java/ * lex.c (do_java_lex): Use build_int_cst_wide_type. * jcf-parse.c (get_constant): Likewise. cp/ * cvt.c (cp_convert_to_pointer): Use build_int_cst_type. ada/ * cuintp.c (build_cst_from_int): Use built_int_cst_type. * trans.c (gnat_to_gnu): Likewise. From-SVN: r120596
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 348d288..a3577c4 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -789,6 +789,17 @@ build_int_cst_type (tree type, HOST_WIDE_INT low)
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. */
@@ -817,10 +828,9 @@ int_cst_hash_eq (const void *x, const void *y)
&& 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)