aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/tree.c25
-rw-r--r--gcc/tree.h9
3 files changed, 28 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1327cf9..b491918 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2010-05-18 Anatoly Sokolov <aesok@post.ru>
+
+ * tree.h (build_int_cstu): Implement as static inline.
+ * tree.c (build_int_cstu): Remove function.
+ (double_int_to_tree, double_int_fits_to_tree_p): Handle size types as
+ sign extended.
+
2010-05-18 Richard Guenther <rguenther@suse.de>
PR lto/44143
diff --git a/gcc/tree.c b/gcc/tree.c
index f00f82e..76be316 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1041,14 +1041,6 @@ build_int_cst (tree type, HOST_WIDE_INT low)
return build_int_cst_wide (type, low, low < 0 ? -1 : 0);
}
-/* Create an INT_CST node with a LOW value zero extended. */
-
-tree
-build_int_cstu (tree type, unsigned HOST_WIDE_INT low)
-{
- return build_int_cst_wide (type, low, 0);
-}
-
/* Create an INT_CST node with a LOW value in TYPE. The value is sign extended
if it is negative. This function is similar to build_int_cst, but
the extra bits outside of the type precision are cleared. Constants
@@ -1088,7 +1080,12 @@ build_int_cst_wide_type (tree type,
tree
double_int_to_tree (tree type, double_int cst)
{
- cst = double_int_ext (cst, TYPE_PRECISION (type), TYPE_UNSIGNED (type));
+ /* Size types *are* sign extended. */
+ bool sign_extended_type = (!TYPE_UNSIGNED (type)
+ || (TREE_CODE (type) == INTEGER_TYPE
+ && TYPE_IS_SIZETYPE (type)));
+
+ cst = double_int_ext (cst, TYPE_PRECISION (type), !sign_extended_type);
return build_int_cst_wide (type, cst.low, cst.high);
}
@@ -1099,9 +1096,13 @@ double_int_to_tree (tree type, double_int cst)
bool
double_int_fits_to_tree_p (const_tree type, double_int cst)
{
- double_int ext = double_int_ext (cst,
- TYPE_PRECISION (type),
- TYPE_UNSIGNED (type));
+ /* Size types *are* sign extended. */
+ bool sign_extended_type = (!TYPE_UNSIGNED (type)
+ || (TREE_CODE (type) == INTEGER_TYPE
+ && TYPE_IS_SIZETYPE (type)));
+
+ double_int ext
+ = double_int_ext (cst, TYPE_PRECISION (type), !sign_extended_type);
return double_int_equal_p (cst, ext);
}
diff --git a/gcc/tree.h b/gcc/tree.h
index 5808827..e2f54a3 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4001,9 +4001,16 @@ tree_to_double_int (const_tree cst)
extern tree double_int_to_tree (tree, double_int);
extern bool double_int_fits_to_tree_p (const_tree, double_int);
+/* Create an INT_CST node with a CST value zero extended. */
+
+static inline tree
+build_int_cstu (tree type, unsigned HOST_WIDE_INT cst)
+{
+ return double_int_to_tree (type, uhwi_to_double_int (cst));
+}
+
extern tree build_int_cst (tree, HOST_WIDE_INT);
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);