GCC Middle and Back End API Reference
call-summary.h
Go to the documentation of this file.
1/* Classes for working with summaries of function calls.
2 Copyright (C) 2022 David Malcolm <dmalcolm@redhat.com>.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it
7under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 3, or (at your option)
9any later version.
10
11GCC is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#ifndef GCC_ANALYZER_CALL_SUMMARY_H
21#define GCC_ANALYZER_CALL_SUMMARY_H
22
23#include "call-details.h"
24
25namespace ana {
26
27/* A class summarizing one particular outcome of a function that
28 we've already analyzed.
29 This lets us efficiently replay the analysis when we see calls
30 to the function, providing an approximation of the behavior of
31 the function without having to execute within the function itself. */
32
34{
35public:
41 const program_state &get_state () const;
42 tree get_fndecl () const;
43
45
48 bool simple) const;
49 void dump (const extrinsic_state &ext_state, FILE *fp, bool simple) const;
50 void dump (const extrinsic_state &ext_state, bool simple) const;
51
52private:
54
56 const exploded_node *const m_enode;
57};
58
59/* A class for handling replaying a specific call summary at
60 a specific call site.
61
62 Supports remapping svalues and regions, e.g. remapping
63 INIT_VAL(param of callee)
64 to:
65 whatever that argument is at the call site. */
66
68{
69public:
71 const function &called_fn,
74
75 const call_details &get_call_details () const { return m_cd; }
76 const gcall *get_call_stmt () const { return m_cd.get_call_stmt (); }
79 {
80 return get_manager ()->get_store_manager ();
81 }
82 region_model_context *get_ctxt () const { return m_cd.get_ctxt (); }
84
88
90 const svalue *caller_sval);
92 const region *caller_sval);
93
94 void dump_to_pp (pretty_printer *pp, bool simple) const;
95 void dump (FILE *fp, bool simple) const;
96 void dump (bool simple) const;
97
98private:
100
103
107
108 // Mapping from svalues in summary to svalues for callsite:
109 typedef hash_map <const svalue *, const svalue *> svalue_map_t;
111
112 // Mapping from regions in summary to regions for callsite:
113 typedef hash_map <const region *, const region *> region_map_t;
115};
116
117} // namespace ana
118
119#endif /* GCC_ANALYZER_CALL_SUMMARY_H */
Definition store.h:207
Definition call-details.h:29
region_model_manager * get_manager() const
region_model_context * get_ctxt() const
Definition call-details.h:37
const gcall * get_call_stmt() const
Definition call-details.h:58
region_model * get_model() const
Definition call-details.h:35
Definition call-summary.h:68
void add_region_mapping(const region *summary_sval, const region *caller_sval)
const svalue * convert_svalue_from_summary(const svalue *)
hash_map< const svalue *, const svalue * > svalue_map_t
Definition call-summary.h:109
call_summary * m_summary
Definition call-summary.h:105
const call_details & get_call_details() const
Definition call-summary.h:75
const gcall * get_call_stmt() const
Definition call-summary.h:76
region_model_manager * get_manager() const
Definition call-summary.h:77
const region * convert_region_from_summary(const region *)
void dump_to_pp(pretty_printer *pp, bool simple) const
region_model_context * get_ctxt() const
Definition call-summary.h:82
const extrinsic_state & m_ext_state
Definition call-summary.h:106
const region * convert_region_from_summary_1(const region *)
const call_details & m_cd
Definition call-summary.h:104
void dump(bool simple) const
region_map_t m_map_region_from_summary_to_caller
Definition call-summary.h:114
call_summary_replay(const call_details &cd, const function &called_fn, call_summary *m_summary, const extrinsic_state &ext_state)
void add_svalue_mapping(const svalue *summary_sval, const svalue *caller_sval)
const binding_key * convert_key_from_summary(const binding_key *)
hash_map< const region *, const region * > region_map_t
Definition call-summary.h:113
void dump(FILE *fp, bool simple) const
const svalue * convert_svalue_from_summary_1(const svalue *)
svalue_map_t m_map_svalue_from_summary_to_caller
Definition call-summary.h:110
store_manager * get_store_manager() const
Definition call-summary.h:78
region_model * get_caller_model() const
Definition call-summary.h:83
DISABLE_COPY_AND_ASSIGN(call_summary_replay)
Definition call-summary.h:34
tree get_fndecl() const
void dump(const extrinsic_state &ext_state, FILE *fp, bool simple) const
per_function_data *const m_per_fn_data
Definition call-summary.h:55
const program_state & get_state() const
call_summary(per_function_data *per_fn_data, const exploded_node *enode)
Definition call-summary.h:36
const exploded_node *const m_enode
Definition call-summary.h:56
void dump(const extrinsic_state &ext_state, bool simple) const
void dump_to_pp(const extrinsic_state &ext_state, pretty_printer *pp, bool simple) const
void get_user_facing_desc(pretty_printer *pp) const
label_text get_desc() const
Definition exploded-graph.h:203
Definition program-state.h:29
Definition program-state.h:203
Definition region-model.h:702
Definition region-model-manager.h:32
store_manager * get_store_manager()
Definition region-model-manager.h:150
Definition region-model.h:258
Definition region.h:125
Definition store.h:846
Definition svalue.h:90
Definition ree.cc:583
Definition pretty-print.h:244
union tree_node * tree
Definition coretypes.h:97
T * ggc_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:184
Definition access-diagram.h:30
Definition exploded-graph.h:665
Definition function.h:249
Definition gimple.h:353
static control_dependences * cd
Definition tree-ssa-dce.cc:102