]> gcc.gnu.org Git - gcc.git/blame - gcc/lto-streamer.h
re PR fortran/90329 (Incompatibility between gfortran and C lapack calls)
[gcc.git] / gcc / lto-streamer.h
CommitLineData
d7f09764
DN
1/* Data structures and declarations used for reading and writing
2 GIMPLE to a file stream.
3
85ec4feb 4 Copyright (C) 2009-2018 Free Software Foundation, Inc.
d7f09764
DN
5 Contributed by Doug Kwan <dougkwan@google.com>
6
7This file is part of GCC.
8
9GCC is free software; you can redistribute it and/or modify it under
10the terms of the GNU General Public License as published by the Free
11Software Foundation; either version 3, or (at your option) any later
12version.
13
14GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15WARRANTY; without even the implied warranty of MERCHANTABILITY or
16FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17for more details.
18
19You should have received a copy of the GNU General Public License
20along with GCC; see the file COPYING3. If not see
21<http://www.gnu.org/licenses/>. */
22
23#ifndef GCC_LTO_STREAMER_H
24#define GCC_LTO_STREAMER_H
25
26#include "plugin-api.h"
db0bf14f 27#include "gcov-io.h"
f0efc7aa 28#include "diagnostic.h"
47c79d56 29
d7f09764
DN
30/* The encoding for a function consists of the following sections:
31
32 1) The header.
33 2) FIELD_DECLS.
34 3) FUNCTION_DECLS.
35 4) global VAR_DECLS.
36 5) type_decls
37 6) types.
38 7) Names for the labels that have names
39 8) The SSA names.
40 9) The control flow graph.
41 10-11)Gimple for local decls.
42 12) Gimple for the function.
43 13) Strings.
44
45 1) THE HEADER.
46 2-6) THE GLOBAL DECLS AND TYPES.
47
48 The global decls and types are encoded in the same way. For each
49 entry, there is word with the offset within the section to the
50 entry.
51
b8698a0f 52 7) THE LABEL NAMES.
d7f09764
DN
53
54 Since most labels do not have names, this section my be of zero
55 length. It consists of an array of string table references, one
56 per label. In the lto code, the labels are given either
57 positive or negative indexes. the positive ones have names and
58 the negative ones do not. The positive index can be used to
59 find the name in this array.
60
b8698a0f 61 9) THE CFG.
d7f09764
DN
62
63 10) Index into the local decls. Since local decls can have local
64 decls inside them, they must be read in randomly in order to
b8698a0f 65 properly restore them.
d7f09764
DN
66
67 11-12) GIMPLE FOR THE LOCAL DECLS AND THE FUNCTION BODY.
68
69 The gimple consists of a set of records.
70
71 THE FUNCTION
b8698a0f 72
d7f09764
DN
73 At the top level of (8) is the function. It consists of five
74 pieces:
75
76 LTO_function - The tag.
77 eh tree - This is all of the exception handling regions
78 put out in a post order traversial of the
79 tree. Siblings are output as lists terminated
80 by a 0. The set of fields matches the fields
81 defined in except.c.
82
83 last_basic_block - in uleb128 form.
84
85 basic blocks - This is the set of basic blocks.
86
87 zero - The termination of the basic blocks.
88
89 BASIC BLOCKS
90
91 There are two forms of basic blocks depending on if they are
92 empty or not.
93
94 The basic block consists of:
95
96 LTO_bb1 or LTO_bb0 - The tag.
97
98 bb->index - the index in uleb128 form.
99
100 #succs - The number of successors un uleb128 form.
101
102 the successors - For each edge, a pair. The first of the
103 pair is the index of the successor in
104 uleb128 form and the second are the flags in
105 uleb128 form.
106
107 the statements - A gimple tree, as described above.
108 These are only present for LTO_BB1.
109 Following each statement is an optional
110 exception handling record LTO_eh_region
111 which contains the region number (for
112 regions >= 0).
113
114 zero - This is only present for LTO_BB1 and is used
115 to terminate the statements and exception
116 regions within this block.
117
118 12) STRINGS
119
120 String are represented in the table as pairs, a length in ULEB128
121 form followed by the data for the string. */
122
d90d82e3 123#define LTO_major_version 7
7fa35a4b 124#define LTO_minor_version 2
d7f09764
DN
125
126typedef unsigned char lto_decl_flags_t;
127
128
d7f09764
DN
129/* Tags representing the various IL objects written to the bytecode file
130 (GIMPLE statements, basic blocks, EH regions, tree nodes, etc).
131
132 NOTE, when adding new LTO tags, also update lto_tag_name. */
b8698a0f 133enum LTO_tags
d7f09764
DN
134{
135 LTO_null = 0,
136
15d16c8a
RB
137 /* Special for streamer. Reference to previously-streamed node. */
138 LTO_tree_pickle_reference,
139
d7f09764
DN
140 /* Reserve enough entries to fit all the tree and gimple codes handled
141 by the streamer. This guarantees that:
142
143 1- Given a tree code C:
144 enum LTO_tags tag == C + 1
145
146 2- Given a gimple code C:
147 enum LTO_tags tag == C + NUM_TREE_CODES + 1
148
149 Conversely, to map between LTO tags and tree/gimple codes, the
150 reverse operation must be applied. */
07233947 151 LTO_bb0 = 1 + MAX_TREE_CODES + LAST_AND_UNUSED_GIMPLE_CODE,
d7f09764
DN
152 LTO_bb1,
153
154 /* EH region holding the previous statement. */
155 LTO_eh_region,
156
c61f8c3b
RG
157 /* Shared INTEGER_CST node. */
158 LTO_integer_cst,
159
d7f09764
DN
160 /* Function body. */
161 LTO_function,
162
163 /* EH table. */
164 LTO_eh_table,
165
166 /* EH region types. These mirror enum eh_region_type. */
167 LTO_ert_cleanup,
168 LTO_ert_try,
169 LTO_ert_allowed_exceptions,
170 LTO_ert_must_not_throw,
171
172 /* EH landing pad. */
173 LTO_eh_landing_pad,
174
175 /* EH try/catch node. */
176 LTO_eh_catch,
177
ee03e71d
RB
178 /* Special for global streamer. A blob of unnamed tree nodes. */
179 LTO_tree_scc,
180
d7f09764
DN
181 /* References to indexable tree nodes. These objects are stored in
182 tables that are written separately from the function bodies that
183 reference them. This way they can be instantiated even when the
184 referencing functions aren't (e.g., during WPA) and it also allows
185 functions to be copied from one file to another without having
186 to unpickle the body first (the references are location
187 independent).
188
189 NOTE, do not regroup these values as the grouping is exposed
190 in the range checks done in lto_input_tree. */
191 LTO_field_decl_ref, /* Do not change. */
192 LTO_function_decl_ref,
193 LTO_label_decl_ref,
194 LTO_namespace_decl_ref,
195 LTO_result_decl_ref,
196 LTO_ssa_name_ref,
197 LTO_type_decl_ref,
198 LTO_type_ref,
199 LTO_const_decl_ref,
200 LTO_imported_decl_ref,
6be14c0e 201 LTO_translation_unit_decl_ref,
5f673c6a
TB
202 LTO_global_decl_ref,
203 LTO_namelist_decl_ref, /* Do not change. */
d7f09764
DN
204
205 /* This tag must always be last. */
206 LTO_NUM_TAGS
207};
208
209
210/* Set of section types that are in an LTO file. This list will grow
211 as the number of IPA passes grows since each IPA pass will need its
212 own section type to store its summary information.
213
214 When adding a new section type, you must also extend the
215 LTO_SECTION_NAME array in lto-section-in.c. */
216enum lto_section_type
217{
218 LTO_section_decls = 0,
219 LTO_section_function_body,
220 LTO_section_static_initializer,
ab96cc5b 221 LTO_section_symtab,
369451ec 222 LTO_section_refs,
49f836ba 223 LTO_section_asm,
fb3f88cc 224 LTO_section_jump_functions,
d7f09764
DN
225 LTO_section_ipa_pure_const,
226 LTO_section_ipa_reference,
0208f7da 227 LTO_section_ipa_profile,
ab96cc5b 228 LTO_section_symtab_nodes,
d7f09764 229 LTO_section_opts,
922f15c2 230 LTO_section_cgraph_opt_sum,
0bceb671 231 LTO_section_ipa_fn_summary,
2c9561b5 232 LTO_section_ipcp_transform,
b84d4347 233 LTO_section_ipa_icf,
ec6fe917 234 LTO_section_offload_table,
db847fa8 235 LTO_section_mode_table,
b2b40051 236 LTO_section_ipa_hsa,
d7f09764
DN
237 LTO_N_SECTION_TYPES /* Must be last. */
238};
239
240/* Indices to the various function, type and symbol streams. */
84562394 241enum lto_decl_stream_e_t
d7f09764
DN
242{
243 LTO_DECL_STREAM_TYPE = 0, /* Must be first. */
244 LTO_DECL_STREAM_FIELD_DECL,
245 LTO_DECL_STREAM_FN_DECL,
246 LTO_DECL_STREAM_VAR_DECL,
247 LTO_DECL_STREAM_TYPE_DECL,
248 LTO_DECL_STREAM_NAMESPACE_DECL,
249 LTO_DECL_STREAM_LABEL_DECL,
250 LTO_N_DECL_STREAMS
84562394 251};
d7f09764
DN
252
253typedef enum ld_plugin_symbol_resolution ld_plugin_symbol_resolution_t;
d7f09764
DN
254
255
256/* Macro to define convenience functions for type and decl streams
b8698a0f 257 in lto_file_decl_data. */
d7f09764
DN
258#define DEFINE_DECL_STREAM_FUNCS(UPPER_NAME, name) \
259static inline tree \
260lto_file_decl_data_get_ ## name (struct lto_file_decl_data *data, \
261 unsigned int idx) \
262{ \
263 struct lto_in_decl_state *state = data->current_decl_state; \
9c71e9df 264 return (*state->streams[LTO_DECL_STREAM_## UPPER_NAME])[idx]; \
d7f09764
DN
265} \
266\
267static inline unsigned int \
268lto_file_decl_data_num_ ## name ## s (struct lto_file_decl_data *data) \
269{ \
270 struct lto_in_decl_state *state = data->current_decl_state; \
9c71e9df 271 return vec_safe_length (state->streams[LTO_DECL_STREAM_## UPPER_NAME]); \
d7f09764
DN
272}
273
274
275/* Return a char pointer to the start of a data stream for an lto pass
276 or function. The first parameter is the file data that contains
277 the information. The second parameter is the type of information
278 to be obtained. The third parameter is the name of the function
b8698a0f 279 and is only used when finding a function body; otherwise it is
d7f09764 280 NULL. The fourth parameter is the length of the data returned. */
b8698a0f 281typedef const char* (lto_get_section_data_f) (struct lto_file_decl_data *,
d7f09764 282 enum lto_section_type,
b8698a0f 283 const char *,
d7f09764
DN
284 size_t *);
285
286/* Return the data found from the above call. The first three
287 parameters are the same as above. The fourth parameter is the data
073a8998 288 itself and the fifth is the length of the data. */
b8698a0f 289typedef void (lto_free_section_data_f) (struct lto_file_decl_data *,
d7f09764
DN
290 enum lto_section_type,
291 const char *,
292 const char *,
293 size_t);
294
eaeec5ec
JH
295/* The location cache holds expanded locations for streamed in trees.
296 This is done to reduce memory usage of libcpp linemap that strongly preffers
297 locations to be inserted in the soruce order. */
298
299class lto_location_cache
300{
301public:
302 /* Apply all changes in location cache. Add locations into linemap and patch
303 trees. */
304 bool apply_location_cache ();
305 /* Tree merging did not suceed; mark all changes in the cache as accepted. */
306 void accept_location_cache ();
307 /* Tree merging did suceed; throw away recent changes. */
308 void revert_location_cache ();
309 void input_location (location_t *loc, struct bitpack_d *bp,
310 struct data_in *data_in);
311 lto_location_cache ()
312 : loc_cache (), accepted_length (0), current_file (NULL), current_line (0),
a9dfad6d 313 current_col (0), current_sysp (false), current_loc (UNKNOWN_LOCATION)
eaeec5ec
JH
314 {
315 gcc_assert (!current_cache);
316 current_cache = this;
317 }
318 ~lto_location_cache ()
319 {
320 apply_location_cache ();
321 gcc_assert (current_cache == this);
322 current_cache = NULL;
323 }
324
325 /* There can be at most one instance of location cache (combining multiple
326 would bring it out of sync with libcpp linemap); point to current
327 one. */
328 static lto_location_cache *current_cache;
329
330private:
331 static int cmp_loc (const void *pa, const void *pb);
332
333 struct cached_location
334 {
335 const char *file;
336 location_t *loc;
337 int line, col;
6c1bc27c 338 bool sysp;
eaeec5ec
JH
339 };
340
341 /* The location cache. */
342
50cfd44e 343 auto_vec<cached_location> loc_cache;
eaeec5ec
JH
344
345 /* Accepted entries are ones used by trees that are known to be not unified
346 by tree merging. */
347
348 int accepted_length;
349
350 /* Bookkeeping to remember state in between calls to lto_apply_location_cache
351 When streaming gimple, the location cache is not used and thus
352 lto_apply_location_cache happens per location basis. It is then
353 useful to avoid redundant calls of linemap API. */
354
355 const char *current_file;
356 int current_line;
357 int current_col;
6c1bc27c 358 bool current_sysp;
eaeec5ec
JH
359 location_t current_loc;
360};
361
d7f09764 362/* Structure used as buffer for reading an LTO file. */
207c68cd 363class lto_input_block
d7f09764 364{
207c68cd
RB
365public:
366 /* Special constructor for the string table, it abuses this to
367 do random access but use the uhwi decoder. */
db847fa8
JJ
368 lto_input_block (const char *data_, unsigned int p_, unsigned int len_,
369 const unsigned char *mode_table_)
370 : data (data_), mode_table (mode_table_), p (p_), len (len_) {}
371 lto_input_block (const char *data_, unsigned int len_,
372 const unsigned char *mode_table_)
373 : data (data_), mode_table (mode_table_), p (0), len (len_) {}
207c68cd 374
d7f09764 375 const char *data;
db847fa8 376 const unsigned char *mode_table;
d7f09764
DN
377 unsigned int p;
378 unsigned int len;
379};
380
d7f09764
DN
381
382/* The is the first part of the record for a function or constructor
383 in the .o file. */
384struct lto_header
385{
386 int16_t major_version;
387 int16_t minor_version;
d7f09764
DN
388};
389
207c68cd
RB
390/* The is the first part of the record in an LTO file for many of the
391 IPA passes. */
392struct lto_simple_header : lto_header
d7f09764 393{
207c68cd
RB
394 /* Size of main gimple body of function. */
395 int32_t main_size;
396};
d7f09764 397
207c68cd
RB
398struct lto_simple_header_with_strings : lto_simple_header
399{
d7f09764
DN
400 /* Size of the string table. */
401 int32_t string_size;
402};
403
207c68cd
RB
404/* The header for a function body. */
405struct lto_function_header : lto_simple_header_with_strings
406{
407 /* Size of the cfg. */
408 int32_t cfg_size;
409};
410
d7f09764
DN
411
412/* Structure describing a symbol section. */
207c68cd 413struct lto_decl_header : lto_simple_header_with_strings
d7f09764 414{
d7f09764
DN
415 /* Size of region for decl state. */
416 int32_t decl_state_size;
417
418 /* Number of nodes in globals stream. */
419 int32_t num_nodes;
49f836ba
JB
420};
421
422
d7f09764
DN
423/* Statistics gathered during LTO, WPA and LTRANS. */
424struct lto_stats_d
425{
426 unsigned HOST_WIDE_INT num_input_cgraph_nodes;
7b99cca4 427 unsigned HOST_WIDE_INT num_output_symtab_nodes;
d7f09764
DN
428 unsigned HOST_WIDE_INT num_input_files;
429 unsigned HOST_WIDE_INT num_output_files;
430 unsigned HOST_WIDE_INT num_cgraph_partitions;
431 unsigned HOST_WIDE_INT section_size[LTO_N_SECTION_TYPES];
432 unsigned HOST_WIDE_INT num_function_bodies;
433 unsigned HOST_WIDE_INT num_trees[NUM_TREE_CODES];
434 unsigned HOST_WIDE_INT num_output_il_bytes;
435 unsigned HOST_WIDE_INT num_compressed_il_bytes;
436 unsigned HOST_WIDE_INT num_input_il_bytes;
437 unsigned HOST_WIDE_INT num_uncompressed_il_bytes;
ee03e71d
RB
438 unsigned HOST_WIDE_INT num_tree_bodies_output;
439 unsigned HOST_WIDE_INT num_pickle_refs_output;
d7f09764
DN
440};
441
7b99cca4 442/* Entry of LTO symtab encoder. */
84562394 443struct lto_encoder_entry
7b99cca4 444{
5e20cdc9 445 symtab_node *node;
7b99cca4
JH
446 /* Is the node in this partition (i.e. ltrans of this partition will
447 be responsible for outputting it)? */
448 unsigned int in_partition:1;
449 /* Do we encode body in this partition? */
450 unsigned int body:1;
451 /* Do we encode initializer in this partition?
452 For example the readonly variable initializers are encoded to aid
453 constant folding even if they are not in the partition. */
454 unsigned int initializer:1;
84562394 455};
7b99cca4 456
7b99cca4 457
d7f09764 458/* Encoder data structure used to stream callgraph nodes. */
7380e6ef 459struct lto_symtab_encoder_d
d7f09764 460{
9771b263 461 vec<lto_encoder_entry> nodes;
b787e7a2 462 hash_map<symtab_node *, size_t> *map;
2f41ecf5 463};
7380e6ef
JH
464
465typedef struct lto_symtab_encoder_d *lto_symtab_encoder_t;
2f41ecf5 466
f27c1867 467/* Iterator structure for cgraph node sets. */
84562394 468struct lto_symtab_encoder_iterator
703e95cf 469{
f27c1867
JH
470 lto_symtab_encoder_t encoder;
471 unsigned index;
84562394 472};
f27c1867
JH
473
474
475
d7f09764
DN
476/* The lto_tree_ref_encoder struct is used to encode trees into indices. */
477
478struct lto_tree_ref_encoder
479{
1eb68d2d 480 hash_map<tree, unsigned> *tree_hash_table; /* Maps pointers to indices. */
d579fcda 481 vec<tree> trees; /* Maps indices to pointers. */
d7f09764
DN
482};
483
484
485/* Structure to hold states of input scope. */
907dadbd 486struct GTY((for_user)) lto_in_decl_state
d7f09764
DN
487{
488 /* Array of lto_in_decl_buffers to store type and decls streams. */
9c71e9df 489 vec<tree, va_gc> *streams[LTO_N_DECL_STREAMS];
d7f09764
DN
490
491 /* If this in-decl state is associated with a function. FN_DECL
492 point to the FUNCTION_DECL. */
493 tree fn_decl;
ca834876
JH
494
495 /* True if decl state is compressed. */
496 bool compressed;
d7f09764
DN
497};
498
499typedef struct lto_in_decl_state *lto_in_decl_state_ptr;
500
ca752f39 501struct decl_state_hasher : ggc_ptr_hash<lto_in_decl_state>
907dadbd
TS
502{
503 static hashval_t
504 hash (lto_in_decl_state *s)
505 {
506 return htab_hash_pointer (s->fn_decl);
507 }
508
509 static bool
510 equal (lto_in_decl_state *a, lto_in_decl_state *b)
511 {
512 return a->fn_decl == b->fn_decl;
513 }
514};
d7f09764
DN
515
516/* The structure that holds all of the vectors of global types,
517 decls and cgraph nodes used in the serialization of this file. */
518struct lto_out_decl_state
519{
520 /* The buffers contain the sets of decls of various kinds and types we have
521 seen so far and the indexes assigned to them. */
522 struct lto_tree_ref_encoder streams[LTO_N_DECL_STREAMS];
523
524 /* Encoder for cgraph nodes. */
7380e6ef 525 lto_symtab_encoder_t symtab_node_encoder;
2f41ecf5 526
d7f09764
DN
527 /* If this out-decl state belongs to a function, fn_decl points to that
528 function. Otherwise, it is NULL. */
529 tree fn_decl;
ca834876
JH
530
531 /* True if decl state is compressed. */
532 bool compressed;
d7f09764
DN
533};
534
535typedef struct lto_out_decl_state *lto_out_decl_state_ptr;
536
d7f09764 537
aed7d7cf
AK
538/* Compact representation of a index <-> resolution pair. Unpacked to an
539 vector later. */
540struct res_pair
541{
542 ld_plugin_symbol_resolution_t res;
543 unsigned index;
544};
aed7d7cf 545
aed7d7cf 546
d7f09764
DN
547/* One of these is allocated for each object file that being compiled
548 by lto. This structure contains the tables that are needed by the
549 serialized functions and ipa passes to connect themselves to the
550 global types and decls as they are reconstituted. */
49ba8180 551struct GTY(()) lto_file_decl_data
d7f09764
DN
552{
553 /* Decl state currently used. */
554 struct lto_in_decl_state *current_decl_state;
555
556 /* Decl state corresponding to regions outside of any functions
557 in the compilation unit. */
558 struct lto_in_decl_state *global_decl_state;
559
560 /* Table of cgraph nodes present in this file. */
7380e6ef 561 lto_symtab_encoder_t GTY((skip)) symtab_node_encoder;
2f41ecf5 562
d7f09764 563 /* Hash table maps lto-related section names to location in file. */
907dadbd 564 hash_table<decl_state_hasher> *function_decl_states;
d7f09764
DN
565
566 /* The .o file that these offsets relate to. */
49ba8180 567 const char *GTY((skip)) file_name;
d7f09764 568
d7f09764 569 /* Hash table maps lto-related section names to location in file. */
49ba8180 570 htab_t GTY((skip)) section_hash_table;
d7f09764
DN
571
572 /* Hash new name of renamed global declaration to its original name. */
49ba8180 573 htab_t GTY((skip)) renaming_hash_table;
73ce4d1e
AK
574
575 /* Linked list used temporarily in reader */
576 struct lto_file_decl_data *next;
577
578 /* Sub ID for merged objects. */
dde8b360 579 unsigned HOST_WIDE_INT id;
73ce4d1e
AK
580
581 /* Symbol resolutions for this file */
9771b263 582 vec<res_pair> GTY((skip)) respairs;
aed7d7cf 583 unsigned max_index;
db0bf14f
JH
584
585 struct gcov_ctr_summary GTY((skip)) profile_info;
bbf9ad07
JH
586
587 /* Map assigning declarations their resolutions. */
39c8aaa4 588 hash_map<tree, ld_plugin_symbol_resolution> * GTY((skip)) resolution_map;
db847fa8
JJ
589
590 /* Mode translation table. */
591 const unsigned char *mode_table;
d7f09764
DN
592};
593
a9429e29
LB
594typedef struct lto_file_decl_data *lto_file_decl_data_ptr;
595
d7f09764
DN
596struct lto_char_ptr_base
597{
598 char *ptr;
599};
600
601/* An incore byte stream to buffer the various parts of the function.
602 The entire structure should be zeroed when created. The record
603 consists of a set of blocks. The first sizeof (ptr) bytes are used
604 as a chain, and the rest store the bytes to be written. */
605struct lto_output_stream
606{
607 /* The pointer to the first block in the stream. */
608 struct lto_char_ptr_base * first_block;
609
610 /* The pointer to the last and current block in the stream. */
611 struct lto_char_ptr_base * current_block;
612
613 /* The pointer to where the next char should be written. */
614 char * current_pointer;
615
616 /* The number of characters left in the current block. */
617 unsigned int left_in_block;
618
619 /* The block size of the last block allocated. */
620 unsigned int block_size;
621
622 /* The total number of characters written. */
623 unsigned int total_size;
624};
625
d7f09764
DN
626/* A simple output block. This can be used for simple IPA passes that
627 do not need more than one stream. */
628struct lto_simple_output_block
629{
630 enum lto_section_type section_type;
631 struct lto_out_decl_state *decl_state;
632
633 /* The stream that the main tree codes are written to. */
634 struct lto_output_stream *main_stream;
635};
636
4a8fb1a1
LC
637/* String hashing. */
638
639struct string_slot
640{
641 const char *s;
642 int len;
643 unsigned int slot_num;
644};
645
646/* Hashtable helpers. */
647
8d67ee55 648struct string_slot_hasher : nofree_ptr_hash <string_slot>
4a8fb1a1 649{
67f58944
TS
650 static inline hashval_t hash (const string_slot *);
651 static inline bool equal (const string_slot *, const string_slot *);
4a8fb1a1
LC
652};
653
654/* Returns a hash code for DS. Adapted from libiberty's htab_hash_string
655 to support strings that may not end in '\0'. */
656
657inline hashval_t
67f58944 658string_slot_hasher::hash (const string_slot *ds)
4a8fb1a1
LC
659{
660 hashval_t r = ds->len;
661 int i;
662
663 for (i = 0; i < ds->len; i++)
664 r = r * 67 + (unsigned)ds->s[i] - 113;
665 return r;
666}
667
668/* Returns nonzero if DS1 and DS2 are equal. */
669
670inline bool
67f58944 671string_slot_hasher::equal (const string_slot *ds1, const string_slot *ds2)
4a8fb1a1
LC
672{
673 if (ds1->len == ds2->len)
674 return memcmp (ds1->s, ds2->s, ds1->len) == 0;
675
676 return 0;
677}
678
d7f09764
DN
679/* Data structure holding all the data and descriptors used when writing
680 an LTO file. */
681struct output_block
682{
683 enum lto_section_type section_type;
684 struct lto_out_decl_state *decl_state;
685
686 /* The stream that the main tree codes are written to. */
687 struct lto_output_stream *main_stream;
688
689 /* The stream that contains the string table. */
690 struct lto_output_stream *string_stream;
691
692 /* The stream that contains the cfg. */
693 struct lto_output_stream *cfg_stream;
694
695 /* The hash table that contains the set of strings we have seen so
696 far and the indexes assigned to them. */
c203e8a7 697 hash_table<string_slot_hasher> *string_hash_table;
d7f09764 698
0b83e688 699 /* The current symbol that we are currently serializing. Null
d7f09764 700 if we are serializing something else. */
f473c082 701 symtab_node *symbol;
d7f09764
DN
702
703 /* These are the last file and line that were seen in the stream.
704 If the current node differs from these, it needs to insert
705 something into the stream and fix these up. */
706 const char *current_file;
707 int current_line;
708 int current_col;
6c1bc27c 709 bool current_sysp;
d7f09764 710
d7f09764 711 /* Cache of nodes written in this section. */
412288f1 712 struct streamer_tree_cache_d *writer_cache;
fac009a8
JH
713
714 /* All data persistent across whole duration of output block
715 can go here. */
716 struct obstack obstack;
d7f09764
DN
717};
718
719
720/* Data and descriptors used when reading from an LTO file. */
721struct data_in
722{
723 /* The global decls and types. */
724 struct lto_file_decl_data *file_data;
725
d7f09764
DN
726 /* The string table. */
727 const char *strings;
728
729 /* The length of the string table. */
730 unsigned int strings_len;
731
d7f09764 732 /* Maps each reference number to the resolution done by the linker. */
9771b263 733 vec<ld_plugin_symbol_resolution_t> globals_resolution;
d7f09764
DN
734
735 /* Cache of pickled nodes. */
412288f1 736 struct streamer_tree_cache_d *reader_cache;
eaeec5ec
JH
737
738 /* Cache of source code location. */
739 lto_location_cache location_cache;
d7f09764
DN
740};
741
742
743/* In lto-section-in.c */
744extern struct lto_input_block * lto_create_simple_input_block (
b8698a0f 745 struct lto_file_decl_data *,
d7f09764
DN
746 enum lto_section_type, const char **, size_t *);
747extern void
b8698a0f 748lto_destroy_simple_input_block (struct lto_file_decl_data *,
d7f09764
DN
749 enum lto_section_type,
750 struct lto_input_block *, const char *, size_t);
b8698a0f 751extern void lto_set_in_hooks (struct lto_file_decl_data **,
d7f09764
DN
752 lto_get_section_data_f *,
753 lto_free_section_data_f *);
754extern struct lto_file_decl_data **lto_get_file_decl_data (void);
755extern const char *lto_get_section_data (struct lto_file_decl_data *,
756 enum lto_section_type,
ca834876
JH
757 const char *, size_t *,
758 bool decompress = false);
759extern const char *lto_get_raw_section_data (struct lto_file_decl_data *,
760 enum lto_section_type,
761 const char *, size_t *);
d7f09764 762extern void lto_free_section_data (struct lto_file_decl_data *,
ca834876
JH
763 enum lto_section_type,
764 const char *, const char *, size_t,
765 bool decompress = false);
766extern void lto_free_raw_section_data (struct lto_file_decl_data *,
767 enum lto_section_type,
768 const char *, const char *, size_t);
d7f09764
DN
769extern htab_t lto_create_renaming_table (void);
770extern void lto_record_renamed_decl (struct lto_file_decl_data *,
771 const char *, const char *);
772extern const char *lto_get_decl_name_mapping (struct lto_file_decl_data *,
773 const char *);
774extern struct lto_in_decl_state *lto_new_in_decl_state (void);
775extern void lto_delete_in_decl_state (struct lto_in_decl_state *);
d7f09764
DN
776extern struct lto_in_decl_state *lto_get_function_in_decl_state (
777 struct lto_file_decl_data *, tree);
82e9d642 778extern void lto_free_function_in_decl_state (struct lto_in_decl_state *);
5e20cdc9 779extern void lto_free_function_in_decl_state_for_node (symtab_node *);
bc0fe8cb 780extern void lto_section_overrun (struct lto_input_block *) ATTRIBUTE_NORETURN;
f242c0a5
JH
781extern void lto_value_range_error (const char *,
782 HOST_WIDE_INT, HOST_WIDE_INT,
783 HOST_WIDE_INT) ATTRIBUTE_NORETURN;
d7f09764
DN
784
785/* In lto-section-out.c */
d7f09764
DN
786extern void lto_begin_section (const char *, bool);
787extern void lto_end_section (void);
f6bcdb5e 788extern void lto_write_data (const void *, unsigned int);
ca834876 789extern void lto_write_raw_data (const void *, unsigned int);
d7f09764 790extern void lto_write_stream (struct lto_output_stream *);
d7f09764
DN
791extern bool lto_output_decl_index (struct lto_output_stream *,
792 struct lto_tree_ref_encoder *,
793 tree, unsigned int *);
794extern void lto_output_field_decl_index (struct lto_out_decl_state *,
795 struct lto_output_stream *, tree);
796extern void lto_output_fn_decl_index (struct lto_out_decl_state *,
797 struct lto_output_stream *, tree);
798extern void lto_output_namespace_decl_index (struct lto_out_decl_state *,
799 struct lto_output_stream *, tree);
800extern void lto_output_var_decl_index (struct lto_out_decl_state *,
801 struct lto_output_stream *, tree);
802extern void lto_output_type_decl_index (struct lto_out_decl_state *,
803 struct lto_output_stream *, tree);
804extern void lto_output_type_ref_index (struct lto_out_decl_state *,
805 struct lto_output_stream *, tree);
806extern struct lto_simple_output_block *lto_create_simple_output_block (
807 enum lto_section_type);
808extern void lto_destroy_simple_output_block (struct lto_simple_output_block *);
809extern struct lto_out_decl_state *lto_new_out_decl_state (void);
810extern void lto_delete_out_decl_state (struct lto_out_decl_state *);
811extern struct lto_out_decl_state *lto_get_out_decl_state (void);
812extern void lto_push_out_decl_state (struct lto_out_decl_state *);
813extern struct lto_out_decl_state *lto_pop_out_decl_state (void);
814extern void lto_record_function_out_decl_state (tree,
815 struct lto_out_decl_state *);
bc0fe8cb 816extern void lto_append_block (struct lto_output_stream *);
d7f09764
DN
817
818
819/* In lto-streamer.c. */
1b34e6e2
BS
820
821/* Set when streaming LTO for offloading compiler. */
822extern bool lto_stream_offload_p;
823
d7f09764
DN
824extern const char *lto_tag_name (enum LTO_tags);
825extern bitmap lto_bitmap_alloc (void);
826extern void lto_bitmap_free (bitmap);
73ce4d1e 827extern char *lto_get_section_name (int, const char *, struct lto_file_decl_data *);
b8f4e58f 828extern void print_lto_report (const char *);
d7f09764
DN
829extern void lto_streamer_init (void);
830extern bool gate_lto_out (void);
b898d037 831extern void lto_check_version (int, int, const char *);
47c79d56 832extern void lto_streamer_hooks_init (void);
d7f09764
DN
833
834/* In lto-streamer-in.c */
d7f09764 835extern void lto_input_cgraph (struct lto_file_decl_data *, const char *);
47c79d56 836extern void lto_reader_init (void);
5e581212
JH
837extern void lto_input_function_body (struct lto_file_decl_data *,
838 struct cgraph_node *,
d7f09764 839 const char *);
0b83e688
JH
840extern void lto_input_variable_constructor (struct lto_file_decl_data *,
841 struct varpool_node *,
842 const char *);
d7f09764
DN
843extern void lto_input_constructors_and_inits (struct lto_file_decl_data *,
844 const char *);
398f05da 845extern void lto_input_toplevel_asms (struct lto_file_decl_data *, int);
db847fa8 846extern void lto_input_mode_table (struct lto_file_decl_data *);
d7f09764
DN
847extern struct data_in *lto_data_in_create (struct lto_file_decl_data *,
848 const char *, unsigned,
9771b263 849 vec<ld_plugin_symbol_resolution_t> );
d7f09764 850extern void lto_data_in_delete (struct data_in *);
a183b5c7 851extern void lto_input_data_block (struct lto_input_block *, void *, size_t);
eaeec5ec
JH
852void lto_input_location (location_t *, struct bitpack_d *, struct data_in *);
853location_t stream_input_location_now (struct bitpack_d *bp,
854 struct data_in *data);
f0efc7aa
DN
855tree lto_input_tree_ref (struct lto_input_block *, struct data_in *,
856 struct function *, enum LTO_tags);
857void lto_tag_check_set (enum LTO_tags, int, ...);
858void lto_init_eh (void);
ee03e71d
RB
859hashval_t lto_input_scc (struct lto_input_block *, struct data_in *,
860 unsigned *, unsigned *);
861tree lto_input_tree_1 (struct lto_input_block *, struct data_in *,
862 enum LTO_tags, hashval_t hash);
b9393656 863tree lto_input_tree (struct lto_input_block *, struct data_in *);
d7f09764
DN
864
865
866/* In lto-streamer-out.c */
867extern void lto_register_decl_definition (tree, struct lto_file_decl_data *);
868extern struct output_block *create_output_block (enum lto_section_type);
869extern void destroy_output_block (struct output_block *);
7e54c608 870extern void lto_output_tree (struct output_block *, tree, bool, bool);
49f836ba 871extern void lto_output_toplevel_asms (void);
fb3f88cc 872extern void produce_asm (struct output_block *ob, tree fn);
38f4f02f
BS
873extern void lto_output ();
874extern void produce_asm_for_decls ();
a183b5c7
DN
875void lto_output_decl_state_streams (struct output_block *,
876 struct lto_out_decl_state *);
877void lto_output_decl_state_refs (struct output_block *,
878 struct lto_output_stream *,
879 struct lto_out_decl_state *);
7cb7d208 880void lto_output_location (struct output_block *, struct bitpack_d *, location_t);
db847fa8 881void lto_output_init_mode_table (void);
d7f09764
DN
882
883
884/* In lto-cgraph.c */
9cf7975d 885extern bool asm_nodes_output;
e75f8f79 886lto_symtab_encoder_t lto_symtab_encoder_new (bool);
5e20cdc9 887int lto_symtab_encoder_encode (lto_symtab_encoder_t, symtab_node *);
7380e6ef 888void lto_symtab_encoder_delete (lto_symtab_encoder_t);
5e20cdc9 889bool lto_symtab_encoder_delete_node (lto_symtab_encoder_t, symtab_node *);
7380e6ef 890bool lto_symtab_encoder_encode_body_p (lto_symtab_encoder_t,
91fbf0c7 891 struct cgraph_node *);
f27c1867 892bool lto_symtab_encoder_in_partition_p (lto_symtab_encoder_t,
5e20cdc9 893 symtab_node *);
f27c1867 894void lto_set_symtab_encoder_in_partition (lto_symtab_encoder_t,
5e20cdc9 895 symtab_node *);
91fbf0c7 896
7380e6ef 897bool lto_symtab_encoder_encode_initializer_p (lto_symtab_encoder_t,
2c8326a5 898 varpool_node *);
f27c1867 899void output_symtab (void);
ab96cc5b 900void input_symtab (void);
ec6fe917 901void output_offload_tables (void);
ed5d948d 902void input_offload_tables (bool);
369451ec 903bool referenced_from_other_partition_p (struct ipa_ref_list *,
f27c1867 904 lto_symtab_encoder_t);
9a809897 905bool reachable_from_other_partition_p (struct cgraph_node *,
f27c1867 906 lto_symtab_encoder_t);
f473c082 907bool referenced_from_this_partition_p (symtab_node *,
f27c1867 908 lto_symtab_encoder_t);
f3380641 909bool reachable_from_this_partition_p (struct cgraph_node *,
f27c1867 910 lto_symtab_encoder_t);
b4661bfe 911lto_symtab_encoder_t compute_ltrans_boundary (lto_symtab_encoder_t encoder);
837bac8c 912void select_what_to_stream (void);
d7f09764 913
325fe981
JH
914/* In options-save.c. */
915void cl_target_option_stream_out (struct output_block *, struct bitpack_d *,
916 struct cl_target_option *);
917
918void cl_target_option_stream_in (struct data_in *,
919 struct bitpack_d *,
920 struct cl_target_option *);
921
ca9a04da
JH
922void cl_optimization_stream_out (struct bitpack_d *, struct cl_optimization *);
923
924void cl_optimization_stream_in (struct bitpack_d *, struct cl_optimization *);
925
d7f09764 926
d7f09764
DN
927
928/* In lto-opts.c. */
d7f09764 929extern void lto_write_options (void);
d7f09764
DN
930
931
d7f09764
DN
932/* Statistics gathered during LTO, WPA and LTRANS. */
933extern struct lto_stats_d lto_stats;
934
935/* Section names corresponding to the values of enum lto_section_type. */
936extern const char *lto_section_name[];
937
938/* Holds all the out decl states of functions output so far in the
939 current output file. */
9771b263 940extern vec<lto_out_decl_state_ptr> lto_function_decl_states;
d7f09764
DN
941
942/* Return true if LTO tag TAG corresponds to a tree code. */
943static inline bool
944lto_tag_is_tree_code_p (enum LTO_tags tag)
945{
15d16c8a 946 return tag > LTO_tree_pickle_reference && (unsigned) tag <= MAX_TREE_CODES;
d7f09764
DN
947}
948
949
950/* Return true if LTO tag TAG corresponds to a gimple code. */
951static inline bool
952lto_tag_is_gimple_code_p (enum LTO_tags tag)
953{
15d16c8a
RB
954 return (unsigned) tag >= NUM_TREE_CODES + 2
955 && (unsigned) tag < 2 + NUM_TREE_CODES + LAST_AND_UNUSED_GIMPLE_CODE;
d7f09764
DN
956}
957
958
959/* Return the LTO tag corresponding to gimple code CODE. See enum
960 LTO_tags for details on the conversion. */
961static inline enum LTO_tags
962lto_gimple_code_to_tag (enum gimple_code code)
963{
15d16c8a 964 return (enum LTO_tags) ((unsigned) code + NUM_TREE_CODES + 2);
d7f09764
DN
965}
966
967
968/* Return the GIMPLE code corresponding to TAG. See enum LTO_tags for
969 details on the conversion. */
970static inline enum gimple_code
971lto_tag_to_gimple_code (enum LTO_tags tag)
972{
973 gcc_assert (lto_tag_is_gimple_code_p (tag));
15d16c8a 974 return (enum gimple_code) ((unsigned) tag - NUM_TREE_CODES - 2);
d7f09764
DN
975}
976
977
978/* Return the LTO tag corresponding to tree code CODE. See enum
979 LTO_tags for details on the conversion. */
980static inline enum LTO_tags
981lto_tree_code_to_tag (enum tree_code code)
982{
15d16c8a 983 return (enum LTO_tags) ((unsigned) code + 2);
d7f09764
DN
984}
985
986
987/* Return the tree code corresponding to TAG. See enum LTO_tags for
988 details on the conversion. */
989static inline enum tree_code
990lto_tag_to_tree_code (enum LTO_tags tag)
991{
992 gcc_assert (lto_tag_is_tree_code_p (tag));
15d16c8a 993 return (enum tree_code) ((unsigned) tag - 2);
d7f09764
DN
994}
995
f0efc7aa
DN
996/* Check that tag ACTUAL == EXPECTED. */
997static inline void
998lto_tag_check (enum LTO_tags actual, enum LTO_tags expected)
999{
1000 if (actual != expected)
1001 internal_error ("bytecode stream: expected tag %s instead of %s",
1002 lto_tag_name (expected), lto_tag_name (actual));
1003}
1004
1005/* Check that tag ACTUAL is in the range [TAG1, TAG2]. */
1006static inline void
1007lto_tag_check_range (enum LTO_tags actual, enum LTO_tags tag1,
1008 enum LTO_tags tag2)
1009{
1010 if (actual < tag1 || actual > tag2)
1011 internal_error ("bytecode stream: tag %s is not in the expected range "
1012 "[%s, %s]",
1013 lto_tag_name (actual),
1014 lto_tag_name (tag1),
1015 lto_tag_name (tag2));
1016}
1017
d7f09764
DN
1018/* Initialize an lto_out_decl_buffer ENCODER. */
1019static inline void
d579fcda 1020lto_init_tree_ref_encoder (struct lto_tree_ref_encoder *encoder)
d7f09764 1021{
1eb68d2d 1022 encoder->tree_hash_table = new hash_map<tree, unsigned> (251);
9771b263 1023 encoder->trees.create (0);
d7f09764
DN
1024}
1025
1026
073a8998 1027/* Destroy an lto_tree_ref_encoder ENCODER by freeing its contents. The
d7f09764
DN
1028 memory used by ENCODER is not freed by this function. */
1029static inline void
1030lto_destroy_tree_ref_encoder (struct lto_tree_ref_encoder *encoder)
1031{
1032 /* Hash table may be delete already. */
1eb68d2d
TS
1033 delete encoder->tree_hash_table;
1034 encoder->tree_hash_table = NULL;
9771b263 1035 encoder->trees.release ();
d7f09764
DN
1036}
1037
1038/* Return the number of trees encoded in ENCODER. */
1039static inline unsigned int
1040lto_tree_ref_encoder_size (struct lto_tree_ref_encoder *encoder)
1041{
9771b263 1042 return encoder->trees.length ();
d7f09764
DN
1043}
1044
1045/* Return the IDX-th tree in ENCODER. */
1046static inline tree
1047lto_tree_ref_encoder_get_tree (struct lto_tree_ref_encoder *encoder,
1048 unsigned int idx)
1049{
9771b263 1050 return encoder->trees[idx];
d7f09764
DN
1051}
1052
f27c1867
JH
1053/* Return number of encoded nodes in ENCODER. */
1054static inline int
1055lto_symtab_encoder_size (lto_symtab_encoder_t encoder)
1056{
9771b263 1057 return encoder->nodes.length ();
7b99cca4
JH
1058}
1059
1060/* Value used to represent failure of lto_symtab_encoder_lookup. */
1061#define LCC_NOT_FOUND (-1)
1062
1063/* Look up NODE in encoder. Return NODE's reference if it has been encoded
1064 or LCC_NOT_FOUND if it is not there. */
1065
1066static inline int
1067lto_symtab_encoder_lookup (lto_symtab_encoder_t encoder,
5e20cdc9 1068 symtab_node *node)
7b99cca4 1069{
b787e7a2
TS
1070 size_t *slot = encoder->map->get (node);
1071 return (slot && *slot ? *(slot) - 1 : LCC_NOT_FOUND);
f27c1867
JH
1072}
1073
1074/* Return true if iterator LSE points to nothing. */
1075static inline bool
1076lsei_end_p (lto_symtab_encoder_iterator lsei)
1077{
1078 return lsei.index >= (unsigned)lto_symtab_encoder_size (lsei.encoder);
1079}
1080
1081/* Advance iterator LSE. */
1082static inline void
1083lsei_next (lto_symtab_encoder_iterator *lsei)
1084{
1085 lsei->index++;
1086}
1087
1088/* Return the node pointed to by LSI. */
5e20cdc9 1089static inline symtab_node *
f27c1867
JH
1090lsei_node (lto_symtab_encoder_iterator lsei)
1091{
9771b263 1092 return lsei.encoder->nodes[lsei.index].node;
f27c1867
JH
1093}
1094
1095/* Return the node pointed to by LSI. */
1096static inline struct cgraph_node *
1097lsei_cgraph_node (lto_symtab_encoder_iterator lsei)
1098{
d52f5295 1099 return dyn_cast<cgraph_node *> (lsei.encoder->nodes[lsei.index].node);
f27c1867
JH
1100}
1101
1102/* Return the node pointed to by LSI. */
2c8326a5 1103static inline varpool_node *
f27c1867
JH
1104lsei_varpool_node (lto_symtab_encoder_iterator lsei)
1105{
d52f5295 1106 return dyn_cast<varpool_node *> (lsei.encoder->nodes[lsei.index].node);
f27c1867
JH
1107}
1108
f27c1867
JH
1109/* Return the cgraph node corresponding to REF using ENCODER. */
1110
5e20cdc9 1111static inline symtab_node *
f27c1867
JH
1112lto_symtab_encoder_deref (lto_symtab_encoder_t encoder, int ref)
1113{
1114 if (ref == LCC_NOT_FOUND)
1115 return NULL;
1116
9771b263 1117 return encoder->nodes[ref].node;
f27c1867
JH
1118}
1119
1120/* Return an iterator to the first node in LSI. */
1121static inline lto_symtab_encoder_iterator
1122lsei_start (lto_symtab_encoder_t encoder)
1123{
1124 lto_symtab_encoder_iterator lsei;
1125
1126 lsei.encoder = encoder;
1127 lsei.index = 0;
1128 return lsei;
1129}
1130
1131/* Advance iterator LSE. */
1132static inline void
1133lsei_next_in_partition (lto_symtab_encoder_iterator *lsei)
1134{
1135 lsei_next (lsei);
1136 while (!lsei_end_p (*lsei)
1137 && !lto_symtab_encoder_in_partition_p (lsei->encoder, lsei_node (*lsei)))
1138 lsei_next (lsei);
1139}
1140
1141/* Return an iterator to the first node in LSI. */
1142static inline lto_symtab_encoder_iterator
1143lsei_start_in_partition (lto_symtab_encoder_t encoder)
1144{
1145 lto_symtab_encoder_iterator lsei = lsei_start (encoder);
1146
1147 if (lsei_end_p (lsei))
1148 return lsei;
1149 if (!lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei)))
1150 lsei_next_in_partition (&lsei);
1151
1152 return lsei;
1153}
1154
1155/* Advance iterator LSE. */
1156static inline void
1157lsei_next_function_in_partition (lto_symtab_encoder_iterator *lsei)
1158{
1159 lsei_next (lsei);
1160 while (!lsei_end_p (*lsei)
7de90a6c 1161 && (!is_a <cgraph_node *> (lsei_node (*lsei))
f27c1867
JH
1162 || !lto_symtab_encoder_in_partition_p (lsei->encoder, lsei_node (*lsei))))
1163 lsei_next (lsei);
1164}
1165
1166/* Return an iterator to the first node in LSI. */
1167static inline lto_symtab_encoder_iterator
1168lsei_start_function_in_partition (lto_symtab_encoder_t encoder)
1169{
1170 lto_symtab_encoder_iterator lsei = lsei_start (encoder);
1171
1172 if (lsei_end_p (lsei))
1173 return lsei;
7de90a6c 1174 if (!is_a <cgraph_node *> (lsei_node (lsei))
f27c1867
JH
1175 || !lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei)))
1176 lsei_next_function_in_partition (&lsei);
1177
1178 return lsei;
1179}
1180
1181/* Advance iterator LSE. */
1182static inline void
1183lsei_next_variable_in_partition (lto_symtab_encoder_iterator *lsei)
1184{
1185 lsei_next (lsei);
1186 while (!lsei_end_p (*lsei)
7de90a6c 1187 && (!is_a <varpool_node *> (lsei_node (*lsei))
f27c1867
JH
1188 || !lto_symtab_encoder_in_partition_p (lsei->encoder, lsei_node (*lsei))))
1189 lsei_next (lsei);
1190}
1191
1192/* Return an iterator to the first node in LSI. */
1193static inline lto_symtab_encoder_iterator
1194lsei_start_variable_in_partition (lto_symtab_encoder_t encoder)
1195{
1196 lto_symtab_encoder_iterator lsei = lsei_start (encoder);
1197
1198 if (lsei_end_p (lsei))
1199 return lsei;
7de90a6c 1200 if (!is_a <varpool_node *> (lsei_node (lsei))
f27c1867
JH
1201 || !lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei)))
1202 lsei_next_variable_in_partition (&lsei);
1203
1204 return lsei;
1205}
1206
d7f09764
DN
1207DEFINE_DECL_STREAM_FUNCS (TYPE, type)
1208DEFINE_DECL_STREAM_FUNCS (FIELD_DECL, field_decl)
1209DEFINE_DECL_STREAM_FUNCS (FN_DECL, fn_decl)
1210DEFINE_DECL_STREAM_FUNCS (VAR_DECL, var_decl)
1211DEFINE_DECL_STREAM_FUNCS (TYPE_DECL, type_decl)
1212DEFINE_DECL_STREAM_FUNCS (NAMESPACE_DECL, namespace_decl)
1213DEFINE_DECL_STREAM_FUNCS (LABEL_DECL, label_decl)
1214
1ea85365
RB
1215/* Entry for the delayed registering of decl -> DIE references. */
1216struct dref_entry {
1217 tree decl;
1218 const char *sym;
1219 unsigned HOST_WIDE_INT off;
1220};
1221
1222extern vec<dref_entry> dref_queue;
1223
1224
d7f09764 1225#endif /* GCC_LTO_STREAMER_H */
This page took 4.802692 seconds and 5 git commands to generate.