diff options
author | aesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-05 18:45:40 +0000 |
---|---|---|
committer | aesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-07-05 18:45:40 +0000 |
commit | a6caa15fd850657e54b7503695521137c0d55dff (patch) | |
tree | 57d6c25d9e2e26c53247cf44ec59628e7d5a7f44 /gcc/builtins.c | |
parent | 7550e1d169bd31dd06508c252f3962e94b46cb16 (diff) | |
download | gcc-a6caa15fd850657e54b7503695521137c0d55dff.tar.gz |
* double-int.h (fit_double_type): Remove declaration.
* double-int.c (fit_double_type): Remove function.
* tree.h (int_fits_type_p): Adjust prototype.
* tree.c (int_fits_type_p): Return bool. Use double_int_fits_to_tree_p
instead of fit_double_type.
(build_int_cst_type): Use double_int_to_tree and shwi_to_double_int
instead of fit_double_type and build_int_cst_wide.
* builtins.c (): Use double_int_fits_to_tree_p and double_int_to_tree
instead of fit_double_type and build_int_cst_wide.
(fold_builtin_object_size): Use double_int_fits_to_tree_p instead
of fit_double_type.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161847 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 8598becd8c9..046593e08bb 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -7626,8 +7626,7 @@ fold_builtin_int_roundingfn (location_t loc, tree fndecl, tree arg) { tree itype = TREE_TYPE (TREE_TYPE (fndecl)); tree ftype = TREE_TYPE (arg); - unsigned HOST_WIDE_INT lo2; - HOST_WIDE_INT hi, lo; + double_int val; REAL_VALUE_TYPE r; switch (DECL_FUNCTION_CODE (fndecl)) @@ -7651,9 +7650,9 @@ fold_builtin_int_roundingfn (location_t loc, tree fndecl, tree arg) gcc_unreachable (); } - REAL_VALUE_TO_INT (&lo, &hi, r); - if (!fit_double_type (lo, hi, &lo2, &hi, itype)) - return build_int_cst_wide (itype, lo2, hi); + real_to_integer2 ((HOST_WIDE_INT *)&val.low, &val.high, &r); + if (double_int_fits_to_tree_p (itype, val)) + return double_int_to_tree (itype, val); } } @@ -12036,7 +12035,7 @@ maybe_emit_free_warning (tree exp) tree fold_builtin_object_size (tree ptr, tree ost) { - tree ret = NULL_TREE; + unsigned HOST_WIDE_INT bytes; int object_size_type; if (!validate_arg (ptr, POINTER_TYPE) @@ -12059,31 +12058,25 @@ fold_builtin_object_size (tree ptr, tree ost) 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)); - + { + bytes = compute_builtin_object_size (ptr, object_size_type); + if (double_int_fits_to_tree_p (size_type_node, + uhwi_to_double_int (bytes))) + return build_int_cstu (size_type_node, bytes); + } else if (TREE_CODE (ptr) == SSA_NAME) { - unsigned HOST_WIDE_INT bytes; - /* If object size is not known yet, delay folding until later. Maybe subsequent passes will help determining it. */ bytes = compute_builtin_object_size (ptr, object_size_type); - if (bytes != (unsigned HOST_WIDE_INT) (object_size_type < 2 - ? -1 : 0)) - ret = build_int_cstu (size_type_node, bytes); + if (bytes != (unsigned HOST_WIDE_INT) (object_size_type < 2 ? -1 : 0) + && double_int_fits_to_tree_p (size_type_node, + uhwi_to_double_int (bytes))) + return build_int_cstu (size_type_node, bytes); } - if (ret) - { - 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; + return NULL_TREE; } /* Fold a call to the __mem{cpy,pcpy,move,set}_chk builtin. |