GCC Middle and Back End API Reference
tree-ssa-loop-niter.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

tree expand_simple_operations (tree)
bool loop_only_exit_p (const struct loop *, const_edge)
bool number_of_iterations_exit (struct loop *, edge, struct tree_niter_desc *niter, bool, bool every_iteration=true)
tree find_loop_niter (struct loop *, edge *)
bool finite_loop_p (struct loop *)
tree loop_niter_by_eval (struct loop *, edge)
tree find_loop_niter_by_eval (struct loop *, edge *)
bool estimated_loop_iterations (struct loop *, double_int *)
HOST_WIDE_INT estimated_loop_iterations_int (struct loop *)
bool max_loop_iterations (struct loop *, double_int *)
HOST_WIDE_INT max_loop_iterations_int (struct loop *)
HOST_WIDE_INT max_stmt_executions_int (struct loop *)
HOST_WIDE_INT estimated_stmt_executions_int (struct loop *)
bool max_stmt_executions (struct loop *, double_int *)
bool estimated_stmt_executions (struct loop *, double_int *)
void estimate_numbers_of_iterations (void)
bool stmt_dominates_stmt_p (gimple, gimple)
bool nowrap_type_p (tree)
bool scev_probably_wraps_p (tree, tree, gimple, struct loop *, bool)
void free_numbers_of_iterations_estimates_loop (struct loop *)
void free_numbers_of_iterations_estimates (void)
void substitute_in_loop_info (struct loop *, tree, tree)

Function Documentation

void estimate_numbers_of_iterations ( void  )

Records estimates on numbers of iterations of loops.

We don't want to issue signed overflow warnings while getting loop iteration estimates.

bool estimated_loop_iterations ( struct loop ,
double_int  
)
HOST_WIDE_INT estimated_loop_iterations_int ( struct loop )
bool estimated_stmt_executions ( struct loop ,
double_int  
)
HOST_WIDE_INT estimated_stmt_executions_int ( struct loop )
tree expand_simple_operations ( tree  )

Header file for loop interation estimates. Copyright (C) 2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

tree find_loop_niter ( struct loop ,
edge  
)
tree find_loop_niter_by_eval ( struct loop ,
edge  
)
bool finite_loop_p ( struct loop )
void free_numbers_of_iterations_estimates ( void  )

Frees the information on upper bounds on numbers of iterations of loops.

void free_numbers_of_iterations_estimates_loop ( struct loop )
tree loop_niter_by_eval ( struct loop ,
edge   
)
bool loop_only_exit_p ( const struct loop ,
const_edge   
)
bool max_loop_iterations ( struct loop ,
double_int  
)
HOST_WIDE_INT max_loop_iterations_int ( struct loop )
bool max_stmt_executions ( struct loop ,
double_int  
)
HOST_WIDE_INT max_stmt_executions_int ( struct loop )
bool nowrap_type_p ( tree  )
bool number_of_iterations_exit ( struct loop loop,
edge  exit,
struct tree_niter_desc niter,
bool  warn,
bool  every_iteration 
)

Stores description of number of iterations of LOOP derived from EXIT (an exit edge of the LOOP) in NITER. Returns true if some useful information could be derived (and fields of NITER has meaning described in comments at struct tree_niter_desc declaration), false otherwise. If WARN is true and -Wunsafe-loop-optimizations was given, warn if the optimizer is going to use potentially unsafe assumptions. When EVERY_ITERATION is true, only tests that are known to be executed every iteration are considered (i.e. only test that alone bounds the loop).

 We want the condition for staying inside loop.   
 We don't want to see undefined signed overflow warnings while
 computing the number of iterations.   
 If NITER has simplified into a constant, update MAX.   
 With -funsafe-loop-optimizations we assume that nothing bad can happen.
 But if we can prove that there is overflow or some other source of weird
 behavior, ignore the loop even with -funsafe-loop-optimizations.   
     We can provide a more specific warning if one of the operator is
     constant and the other advances by +1 or -1.   

References gettext, gimple_location(), input_location, integer_all_onesp(), integer_onep(), integer_zerop(), LOCATION_LINE, N_, affine_iv_d::step, and warning_at().

Referenced by loop_has_vector_phi_nodes().

bool scev_probably_wraps_p ( tree  base,
tree  step,
gimple  at_stmt,
struct loop loop,
bool  use_overflow_semantics 
)

Return false only when the induction variable BASE + STEP * I is known to not overflow: i.e. when the number of iterations is small enough with respect to the step and initial condition in order to keep the evolution confined in TYPEs bounds. Return true when the iv is known to overflow or when the property is not computable.

USE_OVERFLOW_SEMANTICS is true if this function should assume that the rules for overflow of the given language apply (e.g., that signed arithmetics in C does not overflow).

 FIXME: We really need something like
 http://gcc.gnu.org/ml/gcc-patches/2005-06/msg02025.html.

 We used to test for the following situation that frequently appears
 during address arithmetics:

   D.1621_13 = (long unsigned intD.4) D.1620_12;
   D.1622_14 = D.1621_13 * 8;
   D.1623_15 = (doubleD.29 *) D.1622_14;

 And derived that the sequence corresponding to D_14
 can be proved to not wrap because it is used for computing a
 memory access; however, this is not really the case – for example,
 if D_12 = (unsigned char) [254,+,1], then D_14 has values
 2032, 2040, 0, 8, ..., but the code is still legal.   
 If we can use the fact that signed and pointer arithmetics does not
 wrap, we are done.   
 To be able to use estimates on number of iterations of the loop,
 we must have an upper bound on the absolute value of the step.   
 Don't issue signed overflow warnings.   
 Otherwise, compute the number of iterations before we reach the
 bound of the type, and verify that the loop is exited before this
 occurs.   
 At this point we still don't have a proof that the iv does not
 overflow: give up.   
bool stmt_dominates_stmt_p ( gimple  ,
gimple   
)
void substitute_in_loop_info ( struct loop ,
tree  ,
tree   
)