compiler: only build thunk struct type when it is needed
[official-gcc.git] / gcc / value-range-equiv.h
blob1a8014df8342d12ac57c16adcbe961df96440b96
1 /* Support routines for value ranges with equivalences.
2 Copyright (C) 2020-2022 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
11 GCC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License 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_VALUE_RANGE_EQUIV_H
21 #define GCC_VALUE_RANGE_EQUIV_H
23 #include "value-range.h"
25 /* Note value_range_equiv cannot currently be used with GC memory,
26 only value_range is fully set up for this. */
27 class GTY((user)) value_range_equiv : public value_range
29 public:
30 value_range_equiv () : value_range () { m_equiv = NULL; }
31 value_range_equiv (const value_range &);
32 /* Deep-copies equiv bitmap argument. */
33 value_range_equiv (tree, tree, bitmap = NULL, value_range_kind = VR_RANGE);
35 /* Shallow-copies equiv bitmap. */
36 value_range_equiv (const value_range_equiv &) /* = delete */;
37 /* Shallow-copies equiv bitmap. */
38 value_range_equiv& operator=(const value_range_equiv &) /* = delete */;
40 /* Virtual destructor. */
41 virtual ~value_range_equiv () = default;
43 /* Move equiv bitmap from source range. */
44 void move (value_range_equiv *);
46 /* Leaves equiv bitmap alone. */
47 virtual void set (tree, tree, value_range_kind = VR_RANGE) override;
48 void update (tree, tree, value_range_kind = VR_RANGE);
49 /* Deep-copies equiv bitmap argument. */
50 void set (tree, tree, bitmap, value_range_kind = VR_RANGE);
51 void set (tree);
53 bool operator== (const value_range_equiv &) const /* = delete */;
54 bool operator!= (const value_range_equiv &) const /* = delete */;
55 void legacy_verbose_intersect (const value_range_equiv *);
56 void legacy_verbose_union_ (const value_range_equiv *);
57 bool equal_p (const value_range_equiv &, bool ignore_equivs) const;
59 /* Types of value ranges. */
60 void set_undefined () override;
61 void set_varying (tree) override;
63 /* Equivalence bitmap methods. */
64 bitmap equiv () const { return m_equiv; }
65 void equiv_clear ();
66 void equiv_add (const_tree, const value_range_equiv *,
67 bitmap_obstack * = NULL);
69 /* Misc methods. */
70 void deep_copy (const value_range_equiv *);
71 void dump (FILE *) const;
72 void dump () const;
73 static bool supports_p (tree type)
75 return INTEGRAL_TYPE_P (type) || POINTER_TYPE_P (type);
78 private:
79 /* Deep-copies bitmap argument. */
80 void set_equiv (bitmap);
81 void check ();
83 /* Set of SSA names whose value ranges are equivalent to this one.
84 This set is only valid when TYPE is VR_RANGE or VR_ANTI_RANGE. */
85 bitmap m_equiv;
88 extern void dump_value_range (FILE *, const value_range_equiv *);
90 #endif // GCC_VALUE_RANGE_EQUIV_H