xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/tree-ssa-loop.h (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
11debfc3dSmrg /* Header file for SSA loop optimizations.
2*8feb0f0bSmrg    Copyright (C) 2013-2020 Free Software Foundation, Inc.
31debfc3dSmrg 
41debfc3dSmrg This file is part of GCC.
51debfc3dSmrg 
61debfc3dSmrg GCC is free software; you can redistribute it and/or modify it under
71debfc3dSmrg the terms of the GNU General Public License as published by the Free
81debfc3dSmrg Software Foundation; either version 3, or (at your option) any later
91debfc3dSmrg version.
101debfc3dSmrg 
111debfc3dSmrg GCC is distributed in the hope that it will be useful, but WITHOUT ANY
121debfc3dSmrg WARRANTY; without even the implied warranty of MERCHANTABILITY or
131debfc3dSmrg FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
141debfc3dSmrg  for more details.
151debfc3dSmrg 
161debfc3dSmrg You should have received a copy of the GNU General Public License
171debfc3dSmrg along with GCC; see the file COPYING3.  If not see
181debfc3dSmrg <http://www.gnu.org/licenses/>.  */
191debfc3dSmrg 
201debfc3dSmrg #ifndef GCC_TREE_SSA_LOOP_H
211debfc3dSmrg #define GCC_TREE_SSA_LOOP_H
221debfc3dSmrg 
231debfc3dSmrg 
241debfc3dSmrg /* Affine iv.  */
251debfc3dSmrg 
261debfc3dSmrg struct affine_iv
271debfc3dSmrg {
281debfc3dSmrg   /* Iv = BASE + STEP * i.  */
291debfc3dSmrg   tree base, step;
301debfc3dSmrg 
311debfc3dSmrg   /* True if this iv does not overflow.  */
321debfc3dSmrg   bool no_overflow;
331debfc3dSmrg };
341debfc3dSmrg 
351debfc3dSmrg /* Description of number of iterations of a loop.  All the expressions inside
361debfc3dSmrg    the structure can be evaluated at the end of the loop's preheader
371debfc3dSmrg    (and due to ssa form, also anywhere inside the body of the loop).  */
381debfc3dSmrg 
39*8feb0f0bSmrg class tree_niter_desc
401debfc3dSmrg {
41*8feb0f0bSmrg public:
421debfc3dSmrg   tree assumptions;	/* The boolean expression.  If this expression evaluates
431debfc3dSmrg 			   to false, then the other fields in this structure
441debfc3dSmrg 			   should not be used; there is no guarantee that they
451debfc3dSmrg 			   will be correct.  */
461debfc3dSmrg   tree may_be_zero;	/* The boolean expression.  If it evaluates to true,
471debfc3dSmrg 			   the loop will exit in the first iteration (i.e.
481debfc3dSmrg 			   its latch will not be executed), even if the niter
491debfc3dSmrg 			   field says otherwise.  */
501debfc3dSmrg   tree niter;		/* The expression giving the number of iterations of
511debfc3dSmrg 			   a loop (provided that assumptions == true and
521debfc3dSmrg 			   may_be_zero == false), more precisely the number
531debfc3dSmrg 			   of executions of the latch of the loop.  */
541debfc3dSmrg   widest_int max;	/* The upper bound on the number of iterations of
551debfc3dSmrg 			   the loop.  */
561debfc3dSmrg 
571debfc3dSmrg   /* The simplified shape of the exit condition.  The loop exits if
581debfc3dSmrg      CONTROL CMP BOUND is false, where CMP is one of NE_EXPR,
591debfc3dSmrg      LT_EXPR, or GT_EXPR, and step of CONTROL is positive if CMP is
601debfc3dSmrg      LE_EXPR and negative if CMP is GE_EXPR.  This information is used
611debfc3dSmrg      by loop unrolling.  */
621debfc3dSmrg   affine_iv control;
631debfc3dSmrg   tree bound;
641debfc3dSmrg   enum tree_code cmp;
651debfc3dSmrg };
661debfc3dSmrg 
671debfc3dSmrg extern bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
681debfc3dSmrg extern char *get_lsm_tmp_name (tree ref, unsigned n, const char *suffix = NULL);
69*8feb0f0bSmrg extern unsigned tree_num_loop_insns (class loop *, struct eni_weights *);
701debfc3dSmrg 
711debfc3dSmrg /* Returns the loop of the statement STMT.  */
721debfc3dSmrg 
73*8feb0f0bSmrg static inline class loop *
loop_containing_stmt(gimple * stmt)741debfc3dSmrg loop_containing_stmt (gimple *stmt)
751debfc3dSmrg {
761debfc3dSmrg   basic_block bb = gimple_bb (stmt);
771debfc3dSmrg   if (!bb)
781debfc3dSmrg     return NULL;
791debfc3dSmrg 
801debfc3dSmrg   return bb->loop_father;
811debfc3dSmrg }
821debfc3dSmrg 
831debfc3dSmrg #endif /* GCC_TREE_SSA_LOOP_H */
84