GCC Middle and Back End API Reference
exploded-path.h
Go to the documentation of this file.
1/* Paths within an exploded_graph.
2 Copyright (C) 2019-2026 Free Software Foundation, Inc.
3 Contributed by David Malcolm <dmalcolm@redhat.com>.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it
8under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful, but
13WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21#ifndef GCC_ANALYZER_EXPLODED_PATH_H
22#define GCC_ANALYZER_EXPLODED_PATH_H
23
27
28namespace ana {
29
30/* A path within an exploded_graph: a sequence of edges. */
31
33{
34public:
35 struct element_t
36 {
37 element_t (const exploded_edge *eedge)
38 : m_eedge (eedge)
39 {
40 }
41 element_t (const element_t &other)
42 : m_eedge (other.m_eedge),
45 m_state_transition (nullptr)
46 {
47 if (other.m_state_transition)
48 m_state_transition = other.m_state_transition->clone ();
49 }
50
51 element_t (element_t &&other) = default;
52
54 {
55 m_eedge = other.m_eedge;
56 m_state_at_src = other.m_state_at_src;
57 m_state_at_dst = other.m_state_at_dst;
58 m_state_transition = (other.m_state_transition
59 ? other.m_state_transition->clone ()
60 : nullptr);
61 return *this;
62 }
63
67 std::unique_ptr<state_transition> m_state_transition;
68 };
69
70 exploded_path () = default;
71 exploded_path (const exploded_path &other) = default;
72
73 unsigned length () const { return m_elements.size (); }
74
75 bool find_stmt_backwards (const gimple *search_stmt,
76 int *out_idx) const;
77
79
81 const extrinsic_state *ext_state) const;
82 void dump (FILE *fp, const extrinsic_state *ext_state) const;
83 void dump (const extrinsic_state *ext_state = nullptr) const;
84 void dump_to_file (const char *filename,
85 const extrinsic_state &ext_state) const;
86
87 void maybe_log (logger *logger, const char *desc) const;
88
89 bool feasible_p (logger *logger, std::unique_ptr<feasibility_problem> *out,
90 engine *eng, const exploded_graph *eg) const;
91
92 void
94 {
95 m_elements.push_back (edge);
96 }
97
98 void
100
101 std::vector<element_t> m_elements;
102};
103
104/* Finding the shortest exploded_path within an exploded_graph. */
105
107
108} // namespace ana
109
110#endif /* GCC_ANALYZER_EXPLODED_PATH_H */
Definition region-model.h:1314
Definition exploded-graph.h:335
Definition exploded-graph.h:794
Definition exploded-graph.h:206
std::vector< element_t > m_elements
Definition exploded-path.h:101
void dump(const extrinsic_state *ext_state=nullptr) const
unsigned length() const
Definition exploded-path.h:73
void maybe_log(logger *logger, const char *desc) const
exploded_path(const exploded_path &other)=default
exploded_node * get_final_enode() const
void dump(FILE *fp, const extrinsic_state *ext_state) const
bool find_stmt_backwards(const gimple *search_stmt, int *out_idx) const
bool feasible_p(logger *logger, std::unique_ptr< feasibility_problem > *out, engine *eng, const exploded_graph *eg) const
void append_edge(const exploded_edge *edge)
Definition exploded-path.h:93
exploded_path()=default
void dump_to_file(const char *filename, const extrinsic_state &ext_state) const
void dump_to_pp(pretty_printer *pp, const extrinsic_state *ext_state) const
Definition program-state.h:34
Definition analyzer-logging.h:36
Definition ree.cc:583
Definition pretty-print.h:241
Definition shortest-paths.h:49
class edge_def * edge
Definition coretypes.h:369
Definition access-diagram.h:30
shortest_paths< eg_traits, exploded_path > shortest_exploded_paths
Definition exploded-path.h:106
Definition common.h:387
element_t(const exploded_edge *eedge)
Definition exploded-path.h:37
diagnostic_state m_state_at_src
Definition exploded-path.h:65
diagnostic_state m_state_at_dst
Definition exploded-path.h:66
element_t(element_t &&other)=default
std::unique_ptr< state_transition > m_state_transition
Definition exploded-path.h:67
const exploded_edge * m_eedge
Definition exploded-path.h:64
element_t(const element_t &other)
Definition exploded-path.h:41
element_t & operator=(const element_t &other)
Definition exploded-path.h:53
Definition gimple.h:224