Line data Source code
1 : /* A bundle of information for use when determining if a symbolic::value_node
2 : is implicitly live.
3 :
4 : Copyright (C) 2026 Free Software Foundation, Inc.
5 : Contributed by David Malcolm <dmalcolm@redhat.com>.
6 :
7 : This file is part of GCC.
8 :
9 : GCC is free software; you can redistribute it and/or modify it
10 : under the terms of the GNU General Public License as published by
11 : the Free Software Foundation; either version 3, or (at your option)
12 : any later version.
13 :
14 : GCC is distributed in the hope that it will be useful, but
15 : WITHOUT ANY WARRANTY; without even the implied warranty of
16 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 : General Public License for more details.
18 :
19 : You should have received a copy of the GNU General Public License
20 : along with GCC; see the file COPYING3. If not see
21 : <http://www.gnu.org/licenses/>. */
22 :
23 : #ifndef GCC_ANALYZER_LIVENESS_CONTEXT
24 : #define GCC_ANALYZER_LIVENESS_CONTEXT
25 :
26 : namespace ana {
27 : namespace symbolic {
28 :
29 : /* A bundle of information for use when determining if a symbolic::value_node
30 : is implicitly live. */
31 :
32 : class liveness_context
33 : {
34 : public:
35 : liveness_context (const value_set &known_live_values,
36 : const region_model &model);
37 :
38 : bool node_live_p (const value_node &n);
39 : bool bits_live_p (const bit_vector_from_ubc &);
40 :
41 1344323 : const region_model *get_model () const { return &m_model; }
42 :
43 : std::unique_ptr<text_art::tree_widget>
44 : make_dump_widget (symbolic::node_dump_state &nds) const;
45 :
46 : void dump_to_pp (pretty_printer *pp) const;
47 :
48 : DEBUG_FUNCTION void dump () const;
49 :
50 : bool known_live_ptr_to_base_region_p (const region &base_reg) const;
51 :
52 : private:
53 : void
54 : set_known_liveness_for_node (const symbolic::value_node &n,
55 : bool is_live);
56 :
57 : std::map<const symbolic::value_node *, bool> m_known_liveness;
58 :
59 : /* A set of base regions for which m_known_liveness has a live
60 : pointer_svalue pointing to that region, so that we can then treat
61 : (T*)ptr as being implicitly live for all T. */
62 : std::set<const region *> m_known_base_regions;
63 :
64 : const region_model &m_model;
65 : };
66 :
67 : } // namespace ana::symbolic
68 : } // namespace ana
69 :
70 : #endif /* GCC_ANALYZER_LIVENESS_CONTEXT */
|