summaryrefslogtreecommitdiff
path: root/gcc/double-int.c
diff options
context:
space:
mode:
authorZdenek Dvorak <dvorakz@suse.cz>2006-11-12 20:58:05 +0100
committerZdenek Dvorak <rakdver@gcc.gnu.org>2006-11-12 19:58:05 +0000
commit946e1bc7575f0676faf87b8f9937e3a2a8b828af (patch)
treecbab0d80fb90aa9c79c2f4bb40c468f14e9b8cb3 /gcc/double-int.c
parent47eb5b329bf8e6ab2e939a4cedf5533d02a6c7f1 (diff)
downloadgcc-946e1bc7575f0676faf87b8f9937e3a2a8b828af.tar.gz
Makefile.in (tree-data-ref.o): Add langhooks.h dependency.
* Makefile.in (tree-data-ref.o): Add langhooks.h dependency. * tree-ssa-loop-niter.c (derive_constant_upper_bound): Follow ud-chains. Handle AND_EXPR. (record_estimate): Record whether the estimate is realistic and whether it is derived from a loop exit. (record_nonwrapping_iv, idx_infer_loop_bounds, infer_loop_bounds_from_ref, infer_loop_bounds_from_array, infer_loop_bounds_from_signedness): New functions. (compute_estimated_nb_iterations): Take only realistic bounds into account. Set estimate_state. Use double_ints. (infer_loop_bounds_from_undefined): Call infer_loop_bounds_from_array and infer_loop_bounds_from_signedness. Do not consider basic blocks that do not have to be always executed. (estimate_numbers_of_iterations_loop): Set estimate_state, and use it to determine whether to call infer_loop_bounds_from_undefined and compute_estimated_nb_iterations. (n_of_executions_at_most): Use double_ints. (free_numbers_of_iterations_estimates_loop): Set estimate_state. (substitute_in_loop_info): Do not replace in estimated_nb_iterations. * double-int.c (double_int_to_tree): Improve comment. (double_int_fits_to_tree_p): New function. * double-int.h (double_int_fits_to_tree_p): Declare. * tree-data-ref.c: Include langhooks.h. (estimate_niter_from_size_of_data, estimate_iters_using_array): Removed. (analyze_array_indexes): Do not call estimate_niter_from_size_of_data. (analyze_array): Do not pass estimate_only argument to analyze_array_indexes. (get_number_of_iters_for_loop): Build tree from the stored double_int value. (get_references_in_stmt, find_data_references_in_stmt): New functions. (find_data_references_in_loop): Use find_data_references_in_stmt. * tree-data-ref.h (struct data_ref_loc_d): New. (get_references_in_stmt): Declare. (estimate_iters_using_array): Declaration removed. * cfgloop.h (struct nb_iter_bound): Change type of bound to double_int. Improve comments. Add is_exit and realistic fields. (struct loop): Changed type of estimated_nb_iterations to double_int. Added estimate_state field. (record_estimate): Declaration removed. From-SVN: r118729
Diffstat (limited to 'gcc/double-int.c')
-rw-r--r--gcc/double-int.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/gcc/double-int.c b/gcc/double-int.c
index 3be0abf4f3a..f1824da8ff4 100644
--- a/gcc/double-int.c
+++ b/gcc/double-int.c
@@ -290,7 +290,8 @@ double_int_umod (double_int a, double_int b, unsigned code)
return double_int_mod (a, b, true, code);
}
-/* Constructs tree in type TYPE from with value given by CST. */
+/* Constructs tree in type TYPE from with value given by CST. Signedness of CST
+ is assumed to be the same as the signedness of TYPE. */
tree
double_int_to_tree (tree type, double_int cst)
@@ -300,6 +301,19 @@ double_int_to_tree (tree type, double_int cst)
return build_int_cst_wide (type, cst.low, cst.high);
}
+/* Returns true if CST fits into range of TYPE. Signedness of CST is assumed
+ to be the same as the signedness of TYPE. */
+
+bool
+double_int_fits_to_tree_p (tree type, double_int cst)
+{
+ double_int ext = double_int_ext (cst,
+ TYPE_PRECISION (type),
+ TYPE_UNSIGNED (type));
+
+ return double_int_equal_p (cst, ext);
+}
+
/* Returns true if CST is negative. Of course, CST is considered to
be signed. */