* gcc.target/i386/387-3.c, gcc.target/i386/387-4.c,
[official-gcc.git] / gcc / tree-ssa-loop.h
blob4684cda6dfacc99262ff9cbe215fe6c48d116006
1 /* Header file for SSA loop optimizations.
2 Copyright (C) 2013-2014 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_TREE_SSA_LOOP_H
21 #define GCC_TREE_SSA_LOOP_H
23 /* Affine iv. */
25 struct affine_iv
27 /* Iv = BASE + STEP * i. */
28 tree base, step;
30 /* True if this iv does not overflow. */
31 bool no_overflow;
34 /* Description of number of iterations of a loop. All the expressions inside
35 the structure can be evaluated at the end of the loop's preheader
36 (and due to ssa form, also anywhere inside the body of the loop). */
38 struct tree_niter_desc
40 tree assumptions; /* The boolean expression. If this expression evaluates
41 to false, then the other fields in this structure
42 should not be used; there is no guarantee that they
43 will be correct. */
44 tree may_be_zero; /* The boolean expression. If it evaluates to true,
45 the loop will exit in the first iteration (i.e.
46 its latch will not be executed), even if the niter
47 field says otherwise. */
48 tree niter; /* The expression giving the number of iterations of
49 a loop (provided that assumptions == true and
50 may_be_zero == false), more precisely the number
51 of executions of the latch of the loop. */
52 double_int max; /* The upper bound on the number of iterations of
53 the loop. */
55 /* The simplified shape of the exit condition. The loop exits if
56 CONTROL CMP BOUND is false, where CMP is one of NE_EXPR,
57 LT_EXPR, or GT_EXPR, and step of CONTROL is positive if CMP is
58 LE_EXPR and negative if CMP is GE_EXPR. This information is used
59 by loop unrolling. */
60 affine_iv control;
61 tree bound;
62 enum tree_code cmp;
65 extern bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
66 extern char *get_lsm_tmp_name (tree ref, unsigned n, const char *suffix = NULL);
67 extern unsigned tree_num_loop_insns (struct loop *, struct eni_weights_d *);
69 /* Returns the loop of the statement STMT. */
71 static inline struct loop *
72 loop_containing_stmt (gimple stmt)
74 basic_block bb = gimple_bb (stmt);
75 if (!bb)
76 return NULL;
78 return bb->loop_father;
81 #endif /* GCC_TREE_SSA_LOOP_H */