GCC Middle and Back End API Reference
callback-info.h
Go to the documentation of this file.
1/* Callback attribute summary
2 Copyright (C) 2026 Free Software Foundation, Inc.
3 Contributed by Josef Melcr <jmelcr@gcc.gnu.org>
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
20
21#ifndef CALLBACK_INFO_H
22#define CALLBACK_INFO_H
23
24/* Summary aggregating all information relevant to callback edges. Most of the
25 information can be calculated from the attribute as well, but keeping it
26 separate allows us to modify the info without touching the underlying
27 attribute. */
29{
30public:
31 /* Index of the callback function in the argument list. Currently also used
32 as an id for the callback attribute of the function (needed if a function
33 has multiple callback attributes). This limits us to a single callback
34 attribute per parameter. If we want to allow multiple attributes per
35 parameter, we will need a separate id field. */
36 unsigned fn_idx;
37
38 /* Mapping from the dispatching function's arguments to the callback
39 function. */
41
42 /* TRUE iff the associated callback edge was redirected. */
44
45 /* Stream in callback_info. */
46 void stream_in (lto_input_block *ib);
47
48 /* Stream out callback_info. */
49 void stream_out (lto_simple_output_block *ib) const;
50
51 /* Returns the id of the associated callback attribute. */
52 unsigned get_id () const;
53
54 /* Initializes the summary. */
55 void init (unsigned fn_idx, tree attr);
56};
57
58class callback_info_sum_t : public call_summary<callback_info *>
59{
60public:
64
65 /* Populates the callback_info_sum if it's NULL. */
66 static void check_create_info_sum ();
67
68 /* Frees the callback_info_sum pointer. */
69 static void free_info_sum ();
70
71 /* Duplication function for the cgraph_edge duplication hook. */
72 void duplicate (cgraph_edge *src, cgraph_edge *dst, callback_info *src_s,
73 callback_info *dst_s) override;
74};
75
77
78#endif /* CALLBACK_INFO_H */
callback_info_sum_t * callback_info_sum
Definition callback-info.cc:39
Definition vec.h:1667
Definition callback-info.h:59
static void free_info_sum()
Definition callback-info.cc:100
void duplicate(cgraph_edge *src, cgraph_edge *dst, callback_info *src_s, callback_info *dst_s) override
Definition callback-info.cc:109
static void check_create_info_sum()
Definition callback-info.cc:92
callback_info_sum_t(symbol_table *table, bool ggc)
Definition callback-info.h:61
Definition callback-info.h:29
auto_vec< int > arg_mapping
Definition callback-info.h:40
void init(unsigned fn_idx, tree attr)
Definition callback-info.cc:83
void stream_in(lto_input_block *ib)
Definition callback-info.cc:58
void stream_out(lto_simple_output_block *ib) const
Definition callback-info.cc:43
bool redirected
Definition callback-info.h:43
unsigned fn_idx
Definition callback-info.h:36
unsigned get_id() const
Definition callback-info.cc:77
Definition cgraph.h:1872
Definition lto-streamer.h:349
Definition cgraph.h:2543
union tree_node * tree
Definition coretypes.h:97
static struct table_elt * table[HASH_SIZE]
Definition cse.cc:471
Definition lto-streamer.h:692