Daily bump.
[official-gcc.git] / gcc / analyzer / complexity.h
blob85c03721e3a6acbda6ab853dead9baeeff495a5e
1 /* Measuring the complexity of svalues/regions.
2 Copyright (C) 2020-2021 Free Software Foundation, Inc.
3 Contributed by David Malcolm <dmalcolm@redhat.com>.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
12 GCC is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #ifndef GCC_ANALYZER_COMPLEXITY_H
22 #define GCC_ANALYZER_COMPLEXITY_H
24 namespace ana {
26 /* A measurement of the complexity of an svalue or region, so that
27 we can impose bounds on the growth of these tree-like structures
28 and thus avoid infinite chains of analysis. */
30 struct complexity
32 complexity (unsigned num_nodes, unsigned max_depth)
33 : m_num_nodes (num_nodes), m_max_depth (max_depth)
36 complexity (const region *reg);
37 complexity (const svalue *sval);
38 static complexity from_pair (const complexity &c1, const complexity &c);
39 static complexity from_vec_svalue (const vec<const svalue *> &vec);
41 /* The total number of svalues and regions in the tree of this
42 entity, including the entity itself. */
43 unsigned m_num_nodes;
45 /* The maximum depth of the tree of this entity, including the
46 entity itself. */
47 unsigned m_max_depth;
50 } // namespace ana
52 #endif /* GCC_ANALYZER_COMPLEXITY_H */