From a14865dbe011d40552b95f646dd4172a81188601 Mon Sep 17 00:00:00 2001 From: Zdenek Dvorak Date: Mon, 11 Dec 2006 00:34:20 +0100 Subject: loop.texi: Document number_of_latch_executions and number_of_cond_exit_executions. * doc/loop.texi: Document number_of_latch_executions and number_of_cond_exit_executions. * tree-scalar-evolution.c (compute_overall_effect_of_inner_loop, chrec_is_positive, number_of_iterations_for_all_loops, scev_const_prop): Use number_of_latch_executions. (set_nb_iterations_in_loop): Do not increase the value of the number of iterations. (number_of_iterations_in_loop): Renamed to ... (number_of_latch_executions): ... this. (number_of_exit_cond_executions): New function. * tree-scalar-evolution.h (number_of_iterations_in_loop): Declaration removed. (number_of_latch_executions, number_of_exit_cond_executions): Declare. * tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables): Use number_of_latch_executions. * tree-data-ref.c (get_number_of_iters_for_loop): Use number_of_exit_cond_executions. * tree-vect-analyze.c (vect_get_loop_niters): Ditto. * cfgloop.h (struct loop): Improve description of the nb_iterations field. * gcc.dg/tree-ssa/loop-17.c: Update outcome. From-SVN: r119718 --- gcc/doc/loop.texi | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'gcc/doc/loop.texi') diff --git a/gcc/doc/loop.texi b/gcc/doc/loop.texi index 354241f..1b189c7 100644 --- a/gcc/doc/loop.texi +++ b/gcc/doc/loop.texi @@ -397,13 +397,15 @@ calculations. @cindex Number of iterations analysis Both on GIMPLE and on RTL, there are functions available to determine -the number of iterations of a loop, with a similar interface. In many -cases, it is not possible to determine number of iterations -unconditionally -- the determined number is correct only if some -assumptions are satisfied. The analysis tries to verify these -conditions using the information contained in the program; if it fails, -the conditions are returned together with the result. The following -information and conditions are provided by the analysis: +the number of iterations of a loop, with a similar interface. The +number of iterations of a loop in GCC is defined as the number of +executions of the loop latch. In many cases, it is not possible to +determine the number of iterations unconditionally -- the determined +number is correct only if some assumptions are satisfied. The analysis +tries to verify these conditions using the information contained in the +program; if it fails, the conditions are returned together with the +result. The following information and conditions are provided by the +analysis: @itemize @item @code{assumptions}: If this condition is false, the rest of @@ -431,16 +433,16 @@ number of iterations -- @code{find_loop_niter} on GIMPLE and @code{find_simple_exit} on RTL. Finally, there are functions that provide the same information, but additionally cache it, so that repeated calls to number of iterations are not so costly -- -@code{number_of_iterations_in_loop} on GIMPLE and -@code{get_simple_loop_desc} on RTL. +@code{number_of_latch_executions} on GIMPLE and @code{get_simple_loop_desc} +on RTL. Note that some of these functions may behave slightly differently than others -- some of them return only the expression for the number of iterations, and fail if there are some assumptions. The function -@code{number_of_iterations_in_loop} works only for single-exit loops, -and it returns the value for number of iterations higher by one with -respect to all other functions (i.e., it returns number of executions of -the exit statement, not of the loop latch). +@code{number_of_latch_executions} works only for single-exit loops. +The function @code{number_of_cond_exit_executions} can be used to +determine number of executions of the exit condition of a single-exit +loop (i.e., the @code{number_of_latch_executions} increased by one). @node Dependency analysis @section Data Dependency Analysis -- cgit v1.1