GCC Middle and Back End API Reference
trimmed-graph.h
Go to the documentation of this file.
1/* Trimming an exploded graph to a subset of nodes and edges.
2 Copyright (C) 2021-2024 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_TRIMMED_GRAPH_H
22#define GCC_ANALYZER_TRIMMED_GRAPH_H
23
24namespace ana {
25
26/* Forward decls. */
27
28class trimmed_node;
29class trimmed_edge;
30class trimmed_graph;
31class trimmed_cluster;
32
33/* A traits class for trimming a digraph to a subset of nodes and edges. */
34
53
54/* A node within the trimmed_graph, corresponding to an "inner node"
55 within the original exploded_graph. */
56
57class trimmed_node : public dnode<tg_traits>
58{
59public:
62
64 const dump_args_t &args) const final override;
65
66private:
68};
69
70/* An edge within the trimmed_graph, corresponding to an "inner edge"
71 within the original exploded_graph. */
72
73class trimmed_edge : public dedge<tg_traits>
74{
75 public:
78
80 const dump_args_t &args) const final override;
81
82 private:
84};
85
86/* A digraph for trimming an exploded_graph to the subset of nodes and edges
87 from which paths reach INNER_DST_NODE (along with a precanned way to print
88 these in .dot form). */
89
90class trimmed_graph : public digraph <tg_traits>
91{
92 public:
95
96 bool contains_p (const exploded_edge *eedge) const
97 {
100 return mut.contains (eedge);
101 }
102
103 void log_stats (logger *logger) const;
104
105 private:
106 /* The subset of nodes in the inner graph that are in the
107 trimmed graph. */
109 /* Likewise for edges. */
111
114};
115
116class trimmed_cluster : public cluster <tg_traits>
117{
118};
119
120} // namespace ana
121
122#endif /* GCC_ANALYZER_TRIMMED_GRAPH_H */
Definition exploded-graph.h:381
Definition exploded-graph.h:791
Definition exploded-graph.h:203
Definition analyzer-logging.h:34
Definition trimmed-graph.h:117
Definition trimmed-graph.h:74
trimmed_edge(trimmed_node *src, trimmed_node *dest, const exploded_edge *inner_edge)
void dump_dot(graphviz_out *gv, const dump_args_t &args) const final override
const exploded_edge * m_inner_edge
Definition trimmed-graph.h:83
Definition trimmed-graph.h:91
hash_set< const exploded_edge * > m_eedges
Definition trimmed-graph.h:110
trimmed_graph(const exploded_graph &inner_graph, const exploded_node *inner_dst_node)
hash_set< const exploded_node * > m_enodes
Definition trimmed-graph.h:108
hash_map< const exploded_node *, trimmed_node * > map_t
Definition trimmed-graph.h:112
map_t m_map_from_enode_to_tnode
Definition trimmed-graph.h:113
bool contains_p(const exploded_edge *eedge) const
Definition trimmed-graph.h:96
void log_stats(logger *logger) const
Definition trimmed-graph.h:58
void dump_dot(graphviz_out *gv, const dump_args_t &args) const final override
const exploded_node * m_inner_node
Definition trimmed-graph.h:67
trimmed_node(const exploded_node *inner_node)
Definition trimmed-graph.h:60
Definition digraph.h:127
Definition digraph.h:59
GraphTraits::dump_args_t dump_args_t
Definition digraph.h:62
Definition digraph.h:81
Definition digraph.h:43
GraphTraits::dump_args_t dump_args_t
Definition digraph.h:46
Definition graphviz.h:29
Definition hash-map.h:40
T * ggc_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:184
Definition access-diagram.h:30
Definition exploded-graph.h:184
Definition trimmed-graph.h:41
const inner_args_t & m_inner_args
Definition trimmed-graph.h:49
dump_args_t(const inner_args_t &inner_args)
Definition trimmed-graph.h:44
eg_traits::dump_args_t inner_args_t
Definition trimmed-graph.h:42
Definition trimmed-graph.h:36
trimmed_node node_t
Definition trimmed-graph.h:37
trimmed_graph graph_t
Definition trimmed-graph.h:39
trimmed_edge edge_t
Definition trimmed-graph.h:38
trimmed_cluster cluster_t
Definition trimmed-graph.h:51