diff options
author | Anatoly Sokolov <aesok@post.ru> | 2010-05-19 00:54:59 +0400 |
---|---|---|
committer | Anatoly Sokolov <aesok@gcc.gnu.org> | 2010-05-19 00:54:59 +0400 |
commit | abdbbf16d4e2366c55975b86998ae7a7c3bccab2 (patch) | |
tree | 55578260d871250a02af221648451770f28d925a /gcc/tree.c | |
parent | f8a02aacf19d0e9c7c4daea13c5a598d5ea11cab (diff) | |
download | gcc-abdbbf16d4e2366c55975b86998ae7a7c3bccab2.zip gcc-abdbbf16d4e2366c55975b86998ae7a7c3bccab2.tar.gz gcc-abdbbf16d4e2366c55975b86998ae7a7c3bccab2.tar.bz2 |
tree.h (build_int_cstu): Implement as static inline.
* 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.
From-SVN: r159544
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -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); } |