GCC Middle and Back End API Reference
tree-ssa-loop.h
Go to the documentation of this file.
1/* Header file for SSA loop optimizations.
2 Copyright (C) 2013-2026 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
15
16You should have received a copy of the GNU General Public License
17along 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
27{
28 /* Iv = BASE + STEP * i. */
30
31 /* True if this iv does not overflow. */
33
34 /* Upper bound for the number of loop iterations for which this IV
35 does not wrap. */
37};
38
39/* Description of number of iterations of a loop. All the expressions inside
40 the structure can be evaluated at the end of the loop's preheader
41 (and due to ssa form, also anywhere inside the body of the loop). */
42
44{
45public:
46 tree assumptions; /* The boolean expression. If this expression evaluates
47 to false, then the other fields in this structure
48 should not be used; there is no guarantee that they
49 will be correct. */
50 tree may_be_zero; /* The boolean expression. If it evaluates to true,
51 the loop will exit in the first iteration (i.e.
52 its latch will not be executed), even if the niter
53 field says otherwise. */
54 tree niter; /* The expression giving the number of iterations of
55 a loop (provided that assumptions == true and
56 may_be_zero == false), more precisely the number
57 of executions of the latch of the loop. */
58 widest_int max; /* The upper bound on the number of iterations of
59 the loop. If niter is constant, then these values
60 must agree. */
61
62 /* The simplified shape of the exit condition. This information is used by
63 loop unrolling. If CMP is ERROR_MARK, then the loop cannot be unrolled.
64 Otherwise, the loop exits if CONTROL CMP BOUND is false, where CMP is one
65 of NE_EXPR, LT_EXPR, or GT_EXPR, and CONTROL.STEP is positive if CMP is
66 LT_EXPR and negative if CMP is GT_EXPR. */
70};
71
72extern bool for_each_index (tree *, bool (*) (tree, tree *, void *), void *);
73extern char *get_lsm_tmp_name (tree ref, unsigned n, const char *suffix = NULL);
74extern unsigned tree_num_loop_insns (class loop *, struct eni_weights *);
75
76/* Returns the loop of the statement STMT. */
77
78inline class loop *
80{
81 basic_block bb = gimple_bb (stmt);
82 if (!bb)
83 return NULL;
84
85 return bb->loop_father;
86}
87
88#endif /* GCC_TREE_SSA_LOOP_H */
Definition cfgloop.h:120
Definition tree-ssa-loop.h:44
tree may_be_zero
Definition tree-ssa-loop.h:50
tree assumptions
Definition tree-ssa-loop.h:46
widest_int max
Definition tree-ssa-loop.h:58
tree niter
Definition tree-ssa-loop.h:54
enum tree_code cmp
Definition tree-ssa-loop.h:69
affine_iv control
Definition tree-ssa-loop.h:67
tree bound
Definition tree-ssa-loop.h:68
struct basic_block_def * basic_block
Definition coretypes.h:359
union tree_node * tree
Definition coretypes.h:97
tree_code
Definition genmatch.cc:1011
basic_block gimple_bb(const gimple *g)
Definition gimple.h:1869
Definition tree-ssa-loop.h:27
tree base
Definition tree-ssa-loop.h:29
tree nowrap_bound
Definition tree-ssa-loop.h:36
bool no_overflow
Definition tree-ssa-loop.h:32
tree step
Definition tree-ssa-loop.h:29
class loop * loop_father
Definition basic-block.h:126
Definition tree-inline.h:186
Definition gimple.h:224
#define NULL
Definition system.h:55
char * get_lsm_tmp_name(tree ref, unsigned n, const char *suffix)
Definition tree-ssa-loop.cc:712
bool for_each_index(tree *addr_p, bool(*cbck)(tree, tree *, void *), void *data)
Definition tree-ssa-loop.cc:540
unsigned tree_num_loop_insns(class loop *loop, eni_weights *weights)
Definition tree-ssa-loop.cc:733
class loop * loop_containing_stmt(gimple *stmt)
Definition tree-ssa-loop.h:79
generic_wide_int< widest_int_storage< WIDEST_INT_MAX_PRECISION > > widest_int
Definition wide-int.h:345