annotate gcc/streamer-hooks.h @ 16:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
kono
parents:
diff changeset
1 /* Streamer hooks. Support for adding streamer-specific callbacks to
kono
parents:
diff changeset
2 generic streaming routines.
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 Copyright (C) 2011-2017 Free Software Foundation, Inc.
kono
parents:
diff changeset
5 Contributed by Diego Novillo <dnovillo@google.com>
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 This file is part of GCC.
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 GCC is free software; you can redistribute it and/or modify it under
kono
parents:
diff changeset
10 the terms of the GNU General Public License as published by the Free
kono
parents:
diff changeset
11 Software Foundation; either version 3, or (at your option) any later
kono
parents:
diff changeset
12 version.
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
kono
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kono
parents:
diff changeset
17 for more details.
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
20 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
21 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 #ifndef GCC_STREAMER_HOOKS_H
kono
parents:
diff changeset
24 #define GCC_STREAMER_HOOKS_H
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 /* Forward declarations to avoid including unnecessary headers. */
kono
parents:
diff changeset
27 struct output_block;
kono
parents:
diff changeset
28 struct lto_input_block;
kono
parents:
diff changeset
29 struct data_in;
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 /* Streamer hooks. These functions do additional processing as
kono
parents:
diff changeset
32 needed by the module. There are two types of callbacks, those that
kono
parents:
diff changeset
33 replace the default behavior and those that supplement it.
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 Hooks marked [REQ] are required to be set. Those marked [OPT] may
kono
parents:
diff changeset
36 be NULL, if the streamer does not need to implement them. */
kono
parents:
diff changeset
37 struct streamer_hooks {
kono
parents:
diff changeset
38 /* [REQ] Called by every tree streaming routine that needs to write
kono
parents:
diff changeset
39 a tree node. The arguments are: output_block where to write the
kono
parents:
diff changeset
40 node, the tree node to write and a boolean flag that should be true
kono
parents:
diff changeset
41 if the caller wants to write a reference to the tree, instead of the
kono
parents:
diff changeset
42 tree itself. The second boolean parameter specifies this for
kono
parents:
diff changeset
43 the tree itself, the first for all siblings that are streamed.
kono
parents:
diff changeset
44 The referencing mechanism is up to each streamer to implement. */
kono
parents:
diff changeset
45 void (*write_tree) (struct output_block *, tree, bool, bool);
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 /* [REQ] Called by every tree streaming routine that needs to read
kono
parents:
diff changeset
48 a tree node. It takes two arguments: an lto_input_block pointing
kono
parents:
diff changeset
49 to the buffer where to read from and a data_in instance with tables
kono
parents:
diff changeset
50 and descriptors needed by the unpickling routines. It returns the
kono
parents:
diff changeset
51 tree instantiated from the stream. */
kono
parents:
diff changeset
52 tree (*read_tree) (struct lto_input_block *, struct data_in *);
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 /* [REQ] Called by every streaming routine that needs to read a location. */
kono
parents:
diff changeset
55 void (*input_location) (location_t *, struct bitpack_d *, struct data_in *);
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 /* [REQ] Called by every streaming routine that needs to write a location. */
kono
parents:
diff changeset
58 void (*output_location) (struct output_block *, struct bitpack_d *, location_t);
kono
parents:
diff changeset
59 };
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 #define stream_write_tree(OB, EXPR, REF_P) \
kono
parents:
diff changeset
62 streamer_hooks.write_tree (OB, EXPR, REF_P, REF_P)
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 #define stream_write_tree_shallow_non_ref(OB, EXPR, REF_P) \
kono
parents:
diff changeset
65 streamer_hooks.write_tree (OB, EXPR, REF_P, false)
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 #define stream_read_tree(IB, DATA_IN) \
kono
parents:
diff changeset
68 streamer_hooks.read_tree (IB, DATA_IN)
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 #define stream_input_location(LOCPTR, BP, DATA_IN) \
kono
parents:
diff changeset
71 streamer_hooks.input_location (LOCPTR, BP, DATA_IN)
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 #define stream_output_location(OB, BP, LOC) \
kono
parents:
diff changeset
74 streamer_hooks.output_location (OB, BP, LOC)
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 /* Streamer hooks. */
kono
parents:
diff changeset
77 extern struct streamer_hooks streamer_hooks;
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 /* In streamer-hooks.c. */
kono
parents:
diff changeset
80 void streamer_hooks_init (void);
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 #endif /* GCC_STREAMER_HOOKS_H */