111
|
1 /* Header file for SSA loop optimizations.
|
145
|
2 Copyright (C) 2013-2020 Free Software Foundation, Inc.
|
111
|
3
|
|
4 This file is part of GCC.
|
|
5
|
|
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.
|
|
10
|
|
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.
|
|
15
|
|
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/>. */
|
|
19
|
|
20 #ifndef GCC_TREE_SSA_LOOP_H
|
|
21 #define GCC_TREE_SSA_LOOP_H
|
|
22
|
|
23
|
|
24 /* Affine iv. */
|
|
25
|
|
26 struct affine_iv
|
|
27 {
|
|
28 /* Iv = BASE + STEP * i. */
|
|
29 tree base, step;
|
|
30
|
|
31 /* True if this iv does not overflow. */
|
|
32 bool no_overflow;
|
|
33 };
|
|
34
|
|
35 /* Description of number of iterations of a loop. All the expressions inside
|
|
36 the structure can be evaluated at the end of the loop's preheader
|
|
37 (and due to ssa form, also anywhere inside the body of the loop). */
|
|
38
|
145
|
39 class tree_niter_desc
|
111
|
40 {
|
145
|
41 public:
|
111
|
42 tree assumptions; /* The boolean expression. If this expression evaluates
|
|
43 to false, then the other fields in this structure
|
|
44 should not be used; there is no guarantee that they
|
|
45 will be correct. */
|
|
46 tree may_be_zero; /* The boolean expression. If it evaluates to true,
|
|
47 the loop will exit in the first iteration (i.e.
|
|
48 its latch will not be executed), even if the niter
|
|
49 field says otherwise. */
|
|
50 tree niter; /* The expression giving the number of iterations of
|
|
51 a loop (provided that assumptions == true and
|
|
52 may_be_zero == false), more precisely the number
|
|
53 of executions of the latch of the loop. */
|
|
54 widest_int max; /* The upper bound on the number of iterations of
|
|
55 the loop. */
|
|
56
|
|
57 /* The simplified shape of the exit condition. The loop exits if
|
|
58 CONTROL CMP BOUND is false, where CMP is one of NE_EXPR,
|
|
59 LT_EXPR, or GT_EXPR, and step of CONTROL is positive if CMP is
|
|
60 LE_EXPR and negative if CMP is GE_EXPR. This information is used
|
|
61 by loop unrolling. */
|
|
62 affine_iv control;
|
|
63 tree bound;
|
|
64 enum tree_code cmp;
|
|
65 };
|
|
66
|
|
67 extern bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
|
|
68 extern char *get_lsm_tmp_name (tree ref, unsigned n, const char *suffix = NULL);
|
145
|
69 extern unsigned tree_num_loop_insns (class loop *, struct eni_weights *);
|
111
|
70
|
|
71 /* Returns the loop of the statement STMT. */
|
|
72
|
145
|
73 static inline class loop *
|
111
|
74 loop_containing_stmt (gimple *stmt)
|
|
75 {
|
|
76 basic_block bb = gimple_bb (stmt);
|
|
77 if (!bb)
|
|
78 return NULL;
|
|
79
|
|
80 return bb->loop_father;
|
|
81 }
|
|
82
|
|
83 #endif /* GCC_TREE_SSA_LOOP_H */
|