GCC Middle and Back End API Reference
lto-streamer.h
Go to the documentation of this file.
1/* Data structures and declarations used for reading and writing
2 GIMPLE to a file stream.
3
4 Copyright (C) 2009-2026 Free Software Foundation, Inc.
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"
27#include "gcov-io.h"
28#include "diagnostic.h"
29#include "version.h"
30
31/* The encoding for a function consists of the following sections:
32
33 1) The header.
34 2) FIELD_DECLS.
35 3) FUNCTION_DECLS.
36 4) global VAR_DECLS.
37 5) type_decls
38 6) types.
39 7) Names for the labels that have names
40 8) The SSA names.
41 9) The control flow graph.
42 10-11)Gimple for local decls.
43 12) Gimple for the function.
44 13) Strings.
45
46 1) THE HEADER.
47 2-6) THE GLOBAL DECLS AND TYPES.
48
49 The global decls and types are encoded in the same way. For each
50 entry, there is word with the offset within the section to the
51 entry.
52
53 7) THE LABEL NAMES.
54
55 Since most labels do not have names, this section my be of zero
56 length. It consists of an array of string table references, one
57 per label. In the lto code, the labels are given either
58 positive or negative indexes. the positive ones have names and
59 the negative ones do not. The positive index can be used to
60 find the name in this array.
61
62 9) THE CFG.
63
64 10) Index into the local decls. Since local decls can have local
65 decls inside them, they must be read in randomly in order to
66 properly restore them.
67
68 11-12) GIMPLE FOR THE LOCAL DECLS AND THE FUNCTION BODY.
69
70 The gimple consists of a set of records.
71
72 THE FUNCTION
73
74 At the top level of (8) is the function. It consists of five
75 pieces:
76
77 LTO_function - The tag.
78 eh tree - This is all of the exception handling regions
79 put out in a post order traversial of the
80 tree. Siblings are output as lists terminated
81 by a 0. The set of fields matches the fields
82 defined in except.cc.
83
84 last_basic_block - in uleb128 form.
85
86 basic blocks - This is the set of basic blocks.
87
88 zero - The termination of the basic blocks.
89
90 BASIC BLOCKS
91
92 There are two forms of basic blocks depending on if they are
93 empty or not.
94
95 The basic block consists of:
96
97 LTO_bb1 or LTO_bb0 - The tag.
98
99 bb->index - the index in uleb128 form.
100
101 #succs - The number of successors un uleb128 form.
102
103 the successors - For each edge, a pair. The first of the
104 pair is the index of the successor in
105 uleb128 form and the second are the flags in
106 uleb128 form.
107
108 the statements - A gimple tree, as described above.
109 These are only present for LTO_BB1.
110 Following each statement is an optional
111 exception handling record LTO_eh_region
112 which contains the region number (for
113 regions >= 0).
114
115 zero - This is only present for LTO_BB1 and is used
116 to terminate the statements and exception
117 regions within this block.
118
119 13) STRINGS
120
121 String are represented in the table as pairs, a length in ULEB128
122 form followed by the data for the string. */
123
124#define LTO_major_version GCC_major_version
125#define LTO_minor_version 0
126
127typedef unsigned char lto_decl_flags_t;
128
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. */
134{
136
137 /* Reference to previously-streamed node. */
139
140 /* References to indexable tree nodes. These objects are stored in
141 tables that are written separately from the function bodies
142 and variable constructors that reference them. This way they can be
143 instantiated even when the referencing functions aren't (e.g., during WPA)
144 and it also allows functions to be copied from one file to another without
145 having to unpickle the body first (the references are location
146 independent). */
148
150
151 /* Special for global streamer. A blob of unnamed tree nodes. */
153
154 /* Sequence of trees. */
156
157 /* Shared INTEGER_CST node. */
159
160 /* Tags of trees are encoded as
161 LTO_first_tree_tag + TREE_CODE. */
163 /* Tags of gimple tuples are encoded as
164 LTO_first_gimple_tag + gimple_code. */
166
167 /* Entry and exit basic blocks. */
168 LTO_bb0 = LTO_first_gimple_tag + LAST_AND_UNUSED_GIMPLE_CODE,
170
171 /* EH region holding the previous statement. */
173
174 /* Function body. */
176
177 /* EH table. */
179
180 /* EH region types. These mirror enum eh_region_type. */
185
186 /* EH landing pad. */
188
189 /* EH try/catch node. */
191
192 /* This tag must always be last. */
194};
195
196
197/* Set of section types that are in an LTO file. This list will grow
198 as the number of IPA passes grows since each IPA pass will need its
199 own section type to store its summary information.
200
201 When adding a new section type, you must also extend the
202 LTO_SECTION_NAME array in lto-section-in.cc. */
231
232/* Indices to the various function, type and symbol streams. */
234{
235 LTO_DECL_STREAM = 0, /* Must be first. */
237};
238
239typedef enum ld_plugin_symbol_resolution ld_plugin_symbol_resolution_t;
240
241/* Return a char pointer to the start of a data stream for an lto pass
242 or function. The first parameter is the file data that contains
243 the information. The second parameter is the type of information
244 to be obtained. The third parameter is the name of the function
245 and is only used when finding a function body; otherwise it is
246 NULL. The fourth parameter is the length of the data returned. */
247typedef const char* (lto_get_section_data_f) (struct lto_file_decl_data *,
248 enum lto_section_type,
249 const char *,
250 int,
251 size_t *);
252
253/* Return the data found from the above call. The first three
254 parameters are the same as above. The fourth parameter is the data
255 itself and the fifth is the length of the data. */
257 enum lto_section_type,
258 const char *,
259 const char *,
260 size_t);
261
262/* Structure to map ordinary_map indices from streamed-in data to
263 the linemap they correspond to. */
264struct GTY(()) lto_loc_map
265{
266 size_t nmaps;
267 size_t map[1];
268};
269
270/* The location cache holds the ancillary data for streamed in trees. This is
271 done to reduce memory usage in the libcpp linemap; we don't need to create an
272 adhoc location and store the ancillary data if the tree ends up being
273 merged. */
275{
276public:
277 /* Apply all changes in location cache. Add locations into linemap and patch
278 trees. */
279 bool apply_location_cache ();
280 /* Tree merging did not succeed; mark all changes in the cache as
281 accepted. */
282 void accept_location_cache ();
283 /* Tree merging did succeed; throw away recent changes. */
284 void revert_location_cache ();
285 void input_location (location_t *dest, struct bitpack_d *bp,
286 class data_in *data_in);
287 void input_location_and_block (location_t *dest, struct bitpack_d *bp,
288 class lto_input_block *ib,
289 class data_in *data_in);
290 void set_linemap_offset (unsigned offset) { linemap_offset = offset; }
291
293 : decl_data{loc_data}
294 {
295 if (decl_data)
296 {
298 current_cache = this;
299 }
300 }
302 {
303 if (decl_data)
304 {
306 gcc_assert (current_cache == this);
308 }
309 }
310
311 /* There can be at most one active instance of location_cache, so that IPA
312 passes can find it if needed; point to current one. */
314
315private:
317 {
318 location_t *dest;
319 location_t loc;
321 unsigned discr;
322 };
323
324 /* Which linemap section we are using. */
326 const lto_loc_map *cur_loc_map = nullptr;
327 unsigned linemap_offset = 0;
328
329 /* The location cache. */
331
332 /* These keep track of most recently seen values as they are streamed in. */
334 unsigned stream_discr = 0;
335 size_t stream_map_idx = 0;
336 location_t stream_loc_offset = 0;
337
338 /* These keep track of most recently accepted values. */
341
342 /* Accepted entries are ones used by trees that are known to be not unified
343 by tree merging. */
344 unsigned accepted_length = 0;
345};
346
347/* Structure used as buffer for reading an LTO file. */
349{
350public:
351 /* Special constructor for the string table, it abuses this to
352 do random access but use the uhwi decoder. */
353 lto_input_block (const char *data_, unsigned int p_, unsigned int len_,
354 const lto_file_decl_data *file_data_)
355 : data (data_), file_data (file_data_), p (p_), len (len_) {}
356 lto_input_block (const char *data_, unsigned int len_,
357 const lto_file_decl_data *file_data_)
358 : data (data_), file_data (file_data_), p (0), len (len_) {}
359
360 const char *data;
362 unsigned int p;
363 unsigned int len;
364};
365
366/* Compression algorithm used for compression of LTO bytecode. */
367
373
374/* Structure that represents LTO ELF section with information
375 about the format. */
376
378{
381 unsigned char slim_object;
382 unsigned char _padding;
383
384 /* Flags is a private field that is not defined publicly. */
385 uint16_t flags;
386
387 /* Set compression to FLAGS. */
389 {
390 flags = c;
391 }
392
393 /* Get compression from FLAGS. */
395 {
396 return (lto_compression) flags;
397 }
398};
399
401
402/* The is the first part of the record in an LTO file for many of the
403 IPA passes. */
405{
406 /* Size of main gimple body of function. */
407 int32_t main_size;
408};
409
411{
412 /* Size of the string table. */
413 int32_t string_size;
414};
415
416/* The header for a function body. */
418{
419 /* Size of the cfg. */
420 int32_t cfg_size;
421};
422
423
424/* Structure describing a symbol section. */
426{
427 /* Size of region for decl state. */
429
430 /* Slot provenance follows the tree stream, so raw function bodies can
431 retain different DIE references for slots naming the same tree. */
433
434 /* Number of nodes in globals stream. */
435 int32_t num_nodes;
436};
437
438
439/* Statistics gathered during LTO, WPA and LTRANS. */
441{
442 unsigned HOST_WIDE_INT num_input_cgraph_nodes;
443 unsigned HOST_WIDE_INT num_output_symtab_nodes;
444 unsigned HOST_WIDE_INT num_input_files;
445 unsigned HOST_WIDE_INT num_output_files;
446 unsigned HOST_WIDE_INT num_cgraph_partitions;
447 unsigned HOST_WIDE_INT section_size[LTO_N_SECTION_TYPES];
448 unsigned HOST_WIDE_INT num_function_bodies;
449 unsigned HOST_WIDE_INT num_trees[NUM_TREE_CODES];
450 unsigned HOST_WIDE_INT num_output_il_bytes;
451 unsigned HOST_WIDE_INT num_compressed_il_bytes;
452 unsigned HOST_WIDE_INT num_input_il_bytes;
453 unsigned HOST_WIDE_INT num_uncompressed_il_bytes;
454 unsigned HOST_WIDE_INT num_tree_bodies_output;
455 unsigned HOST_WIDE_INT num_pickle_refs_output;
456};
457
458/* Entry of LTO symtab encoder. */
460{
461 /* Constructor. */
466
468 /* Is the node in this partition (i.e. ltrans of this partition will
469 be responsible for outputting it)? */
470 unsigned int in_partition:1;
471 /* Do we encode body in this partition? */
472 unsigned int body:1;
473 /* Do we stream this node only for inlining? */
474 unsigned int only_for_inlining:1;
475 /* Do we encode initializer in this partition?
476 For example the readonly variable initializers are encoded to aid
477 constant folding even if they are not in the partition. */
478 unsigned int initializer:1;
479};
480
481
482/* Encoder data structure used to stream callgraph nodes. */
484{
487
488 /* Mapping of input order of nodes onto output order. */
489 hash_map<int_hash<int, -1, -2>, int> *order_remap;
490};
491
493
494/* Iterator structure for cgraph node sets. */
500
501
502
503/* The lto_tree_ref_encoder struct is used to encode trees into indices. */
504
506{
507 hash_map<tree, unsigned> *tree_hash_table; /* Maps pointers to indices. */
508 vec<tree> trees; /* Maps indices to pointers. */
509};
510
511
512/* An early DIE reference independent of its tree. */
513struct GTY (()) lto_die_ref
514{
515 const char *sym;
516 unsigned HOST_WIDE_INT off;
517};
518
519/* Source DIE for a decl-state slot. */
521{
522 unsigned index;
524};
525
526/* Origin encoding appended to FUNCTION_DECL and BLOCK records after their
527 ordinary DIE reference. LGEN permits TREE. WPA and incremental LTO
528 write DIE or NONE for newly streamed trees; copied bodies retain their
529 input encoding. */
531{
532 /* Use the original tree reference. No additional fields. */
534 /* No saved origin; do not derive one from the tree.
535 No additional fields. */
537 /* Followed by a symbol string reference and an unsigned DIE offset. */
539};
540
541/* Return true if T's LTO record includes an origin reference encoding. */
542inline bool
544{
545 return TREE_CODE (t) == FUNCTION_DECL || TREE_CODE (t) == BLOCK;
546}
547
550
551/* Structure to hold states of input scope. */
552struct GTY((for_user)) lto_in_decl_state
553{
554 /* Array of lto_in_decl_buffers to store type and decls streams. */
556
557 /* Source DIEs ordered by slot index, retained for unread bodies. */
559
560 /* If this in-decl state is associated with a function. FN_DECL
561 point to the FUNCTION_DECL. */
563
564 /* True if decl state is compressed. */
566
567 /* Order of the linemap section to be used for interpreting the locations
568 streamed for this decl. */
569 unsigned linemap_id;
570};
571
573
574struct decl_state_hasher : ggc_ptr_hash<lto_in_decl_state>
575{
576 static hashval_t
578 {
579 return htab_hash_pointer (s->fn_decl);
580 }
581
582 static bool
584 {
585 return a->fn_decl == b->fn_decl;
586 }
587};
588
589/* The structure that holds all of the vectors of global types,
590 decls and cgraph nodes used in the serialization of this file. */
592{
593 /* The buffers contain the sets of decls of various kinds and types we have
594 seen so far and the indexes assigned to them. */
596
598
599 /* Encoder for cgraph nodes. */
601
602 /* If this out-decl state belongs to a function, fn_decl points to that
603 function. Otherwise, it is NULL. */
605
606 /* True if decl state is compressed. */
608
609 /* True if offload tables should be output. */
611
612 /* Order of the linemap section to be used for interpreting the locations
613 streamed for this decl. */
614 unsigned linemap_id;
615};
616
618
619
620/* Compact representation of a index <-> resolution pair. Unpacked to an
621 vector later. */
627
628
629/* One of these is allocated for each object file that being compiled
630 by lto. This structure contains the tables that are needed by the
631 serialized functions and ipa passes to connect themselves to the
632 global types and decls as they are reconstituted. */
634{
635 /* Decl state currently used. */
637
638 /* Decl state corresponding to regions outside of any functions
639 in the compilation unit. */
641
642 /* Table of cgraph nodes present in this file. */
644
645 /* Hash table maps lto-related section names to location in file. */
647
648 /* The .o file that these offsets relate to. */
649 const char *GTY((skip)) file_name;
650
651 /* Hash table maps lto-related section names to location in file. */
652 htab_t GTY((skip)) section_hash_table;
653
654 /* Hash new name of renamed global declaration to its original name. */
655 htab_t GTY((skip)) renaming_hash_table;
656
657 /* Linked list used temporarily in reader */
659
660 /* Order in which the file appears on the command line. */
661 int order;
662
663 /* Sub ID for merged objects. */
664 unsigned HOST_WIDE_INT id;
665
666 /* Symbol resolutions for this file */
668 unsigned max_index;
669
671
672 /* Map assigning declarations their resolutions. */
674
675 /* Mode translation table. */
676 const unsigned char *mode_table;
677
678 /* Read LTO section. */
680
682
684
685 unsigned mode_bits;
686
687 /* Number of linemap sections contained in this file. There is typically only
688 1, but WPA and INCREMENTAL_LINK_LTO modes may create files with more than
689 one linemap. */
691
692 /* Location maps for locations streamed in this file. */
695};
696
697/* Given an input linemap ID, compute how it will be known in the output, given
698 that the output could be the combination of multiple input files. */
699inline unsigned
700lto_linemap_output_id (unsigned linemap_id, const lto_file_decl_data *file_data)
701{
702 return linemap_id + file_data->order;
703}
704
706
708{
709 char *ptr;
710};
711
712/* An incore byte stream to buffer the various parts of the function.
713 The entire structure should be zeroed when created. The record
714 consists of a set of blocks. The first sizeof (ptr) bytes are used
715 as a chain, and the rest store the bytes to be written. */
717{
718 /* The pointer to the first block in the stream. */
720
721 /* The pointer to the last and current block in the stream. */
723
724 /* The pointer to where the next char should be written. */
726
727 /* The number of characters left in the current block. */
728 unsigned int left_in_block;
729
730 /* The block size of the last block allocated. */
731 unsigned int block_size;
732
733 /* The total number of characters written. */
734 unsigned int total_size;
735};
736
737/* A simple output block. This can be used for simple IPA passes that
738 do not need more than one stream. */
740{
743
744 /* The stream that the main tree codes are written to. */
746};
747
748/* String hashing. */
749
751{
752 const char *s;
753 int len;
754 unsigned int slot_num;
755};
756
757/* Hashtable helpers. */
758
760{
761 static inline hashval_t hash (const string_slot *);
762 static inline bool equal (const string_slot *, const string_slot *);
763};
764
765/* Returns a hash code for DS. Adapted from libiberty's htab_hash_string
766 to support strings that may not end in '\0'. */
767
768inline hashval_t
770{
771 hashval_t r = ds->len;
772 int i;
773
774 for (i = 0; i < ds->len; i++)
775 r = r * 67 + (unsigned)ds->s[i] - 113;
776 return r;
777}
778
779/* Returns nonzero if DS1 and DS2 are equal. */
780
781inline bool
783{
784 if (ds1->len == ds2->len)
785 return memcmp (ds1->s, ds2->s, ds1->len) == 0;
786
787 return 0;
788}
789
790/* Data structure holding all the data and descriptors used when writing
791 an LTO file. */
793{
796
797 /* The stream that the main tree codes are written to. */
799
800 /* The stream that contains the string table. */
802
803 /* The stream that contains the cfg. */
805
806 /* The hash table that contains the set of strings we have seen so
807 far and the indexes assigned to them. */
809
810 /* The current symbol that we are currently serializing. Null
811 if we are serializing something else. */
813
814 /* These record the most-recently-streamed values, to avoid streaming
815 them unnecessarily. */
821
822 /* Cache of nodes written in this section. */
824
825 /* All trees identified as local to the unit streamed. */
827
828 /* All data persistent across whole duration of output block
829 can go here. */
831};
832
833
835{
836 unsigned index;
837 /* Encoded abstract-origin reference. */
840};
841
842/* Data and descriptors used when reading from an LTO file. */
844{
845public:
846 /* The global decls and types. */
848
849 /* The string table. */
850 const char *strings;
851
852 /* The length of the string table. */
853 unsigned int strings_len;
854
855 /* Maps each reference number to the resolution done by the linker. */
857
858 /* Cache of pickled nodes. */
860
861 /* Cache slots keep their input identity when SCC unification replaces
862 their trees. Values contain no references to the discarded trees. */
864
865 /* Input references awaiting registration for the current batch of trees. */
867
868 /* Cache of source code location. */
870
871 explicit data_in (lto_file_decl_data *data_for_loc)
872 : location_cache{data_for_loc}
873 {}
874
875 void save_die_ref (unsigned index, lto_die_ref ref);
876 void register_origin_refs ();
877};
878
879
880/* In lto-section-in.cc */
882 struct lto_file_decl_data *,
883 enum lto_section_type, const char **, size_t *);
884extern void
886 enum lto_section_type,
887 class lto_input_block *, const char *, size_t);
888extern void lto_set_in_hooks (struct lto_file_decl_data **,
891extern struct lto_file_decl_data **lto_get_file_decl_data (void);
892extern const char *lto_get_section_data (struct lto_file_decl_data *,
893 enum lto_section_type,
894 const char *, int, size_t *,
895 bool decompress = false);
896extern const char *lto_get_summary_section_data (struct lto_file_decl_data *,
897 enum lto_section_type,
898 size_t *);
899extern const char *lto_get_raw_section_data (struct lto_file_decl_data *,
900 enum lto_section_type,
901 const char *, int, size_t *);
902extern void lto_free_section_data (struct lto_file_decl_data *,
903 enum lto_section_type,
904 const char *, const char *, size_t,
905 bool decompress = false);
907 enum lto_section_type,
908 const char *, const char *, size_t);
909extern htab_t lto_create_renaming_table (void);
910extern void lto_record_renamed_decl (struct lto_file_decl_data *,
911 const char *, const char *);
912extern const char *lto_get_decl_name_mapping (struct lto_file_decl_data *,
913 const char *);
914extern struct lto_in_decl_state *lto_new_in_decl_state (void);
916 unsigned);
917extern void lto_delete_in_decl_state (struct lto_in_decl_state *);
919 struct lto_file_decl_data *, tree);
923extern void lto_value_range_error (const char *,
924 HOST_WIDE_INT, HOST_WIDE_INT,
925 HOST_WIDE_INT) ATTRIBUTE_NORETURN;
926
927/* In lto-section-out.cc */
928extern void lto_begin_section (const char *, bool);
929extern void lto_end_section (void);
930extern void lto_write_data (const void *, unsigned int);
931extern void lto_write_raw_data (const void *, unsigned int);
932extern void lto_write_stream (struct lto_output_stream *);
934 enum lto_section_type);
936extern struct lto_out_decl_state *lto_new_out_decl_state (void);
937extern void lto_delete_out_decl_state (struct lto_out_decl_state *);
938extern struct lto_out_decl_state *lto_get_out_decl_state (void);
939extern void lto_push_out_decl_state (struct lto_out_decl_state *);
940extern struct lto_out_decl_state *lto_pop_out_decl_state (void);
942 struct lto_out_decl_state *);
943extern void lto_append_block (struct lto_output_stream *);
944
945
946/* In lto-streamer.cc. */
947
948/* Set when streaming LTO for offloading compiler. */
949extern bool lto_stream_offload_p;
950
951extern const char *lto_tag_name (enum LTO_tags);
952extern char *lto_get_section_name (int, const char *, int,
953 struct lto_file_decl_data *);
954extern void print_lto_report (const char *);
955extern void lto_streamer_init (void);
956extern bool gate_lto_out (void);
957extern void lto_check_version (int, int, const char *);
958extern void lto_streamer_hooks_init (void);
959
960/* In lto-streamer-in.cc */
961extern void lto_input_cgraph (struct lto_file_decl_data *, const char *);
962extern void lto_reader_init (void);
963extern void lto_free_file_name_hash (void);
964extern void lto_input_function_body (struct lto_file_decl_data *,
965 struct cgraph_node *,
966 const char *);
968 struct varpool_node *,
969 const char *);
971 const char *);
972extern void lto_input_toplevel_asms (struct lto_file_decl_data *, int);
973extern void lto_input_mode_table (struct lto_file_decl_data *);
974extern class data_in *lto_data_in_create (struct lto_file_decl_data *,
975 const char *, unsigned,
977 bool need_location_cache = true);
978extern void lto_data_in_delete (class data_in *);
979extern void lto_input_data_block (class lto_input_block *, void *, size_t);
980void lto_input_location (location_t *, struct bitpack_d *, class data_in *);
982 struct function *, enum LTO_tags);
983void lto_tag_check_set (enum LTO_tags, int, ...);
984void lto_init_eh (void);
985hashval_t lto_input_scc (class lto_input_block *, class data_in *,
986 unsigned *, unsigned *, bool);
988 enum LTO_tags, hashval_t hash);
989tree lto_input_tree (class lto_input_block *, class data_in *);
991 int * = nullptr);
992
993
994/* In lto-streamer-out.cc */
997extern void destroy_output_block (struct output_block *);
998extern void lto_output_tree (struct output_block *, tree, bool, bool);
999extern void stream_write_tree_ref (struct output_block *, tree);
1000extern void lto_output_var_decl_ref (struct lto_out_decl_state *,
1001 struct lto_output_stream *, tree);
1002extern void lto_output_fn_decl_ref (struct lto_out_decl_state *,
1003 struct lto_output_stream *, tree);
1007extern void produce_asm (struct output_block *ob);
1008extern void lto_output ();
1009extern void produce_asm_for_decls ();
1010void lto_register_linemap_for_output (size_t, unsigned);
1011void lto_copy_linemaps ();
1013 struct lto_out_decl_state *);
1015 struct lto_output_stream *,
1016 struct lto_out_decl_state *);
1018void lto_output_location (struct output_block *, struct bitpack_d *,
1019 location_t);
1021 location_t);
1022void lto_output_init_mode_table (void);
1024
1025
1026/* In lto-cgraph.cc */
1032 struct cgraph_node *);
1034 struct cgraph_node *);
1036 toplevel_node *);
1038 toplevel_node *);
1039
1041 varpool_node *);
1042void output_symtab (void);
1043void input_symtab (void);
1044void input_toplevel_asms (void);
1045void output_offload_tables (void);
1046void input_offload_tables (bool);
1056void select_what_to_stream (void);
1057
1058/* In options-save.cc. */
1060 struct cl_target_option *);
1061
1063 struct bitpack_d *,
1064 struct cl_target_option *);
1065
1067 struct bitpack_d *, struct cl_optimization *);
1068
1070 struct bitpack_d *, struct cl_optimization *);
1071
1072
1073
1074/* In lto-opts.cc. */
1075extern void lto_write_options (void);
1076
1077
1078/* Statistics gathered during LTO, WPA and LTRANS. */
1079extern struct lto_stats_d lto_stats;
1080
1081/* Section names corresponding to the values of enum lto_section_type. */
1082extern const char *lto_section_name[];
1083
1084/* Holds all the out decl states of functions output so far in the
1085 current output file. */
1087
1088/* Return true if LTO tag TAG corresponds to a tree code. */
1089inline bool
1091{
1092 return tag > LTO_first_tree_tag && (unsigned) tag <= MAX_TREE_CODES;
1093}
1094
1095
1096/* Return true if LTO tag TAG corresponds to a gimple code. */
1097inline bool
1099{
1100 return (unsigned) tag >= LTO_first_gimple_tag
1101 && (unsigned) tag
1102 < (unsigned) LTO_first_gimple_tag + LAST_AND_UNUSED_GIMPLE_CODE;
1103}
1104
1105
1106/* Return the LTO tag corresponding to gimple code CODE. See enum
1107 LTO_tags for details on the conversion. */
1108inline enum LTO_tags
1110{
1111 return (enum LTO_tags) ((unsigned) code + LTO_first_gimple_tag);
1112}
1113
1114
1115/* Return the GIMPLE code corresponding to TAG. See enum LTO_tags for
1116 details on the conversion. */
1117inline enum gimple_code
1119{
1121 return (enum gimple_code) ((unsigned) tag - LTO_first_gimple_tag);
1122}
1123
1124
1125/* Return the LTO tag corresponding to tree code CODE. See enum
1126 LTO_tags for details on the conversion. */
1127inline enum LTO_tags
1129{
1130 return (enum LTO_tags) ((unsigned) code + LTO_first_tree_tag);
1131}
1132
1133
1134/* Return the tree code corresponding to TAG. See enum LTO_tags for
1135 details on the conversion. */
1136inline enum tree_code
1138{
1140 return (enum tree_code) ((unsigned) tag - LTO_first_tree_tag);
1141}
1142
1143/* Check that tag ACTUAL == EXPECTED. */
1144inline void
1145lto_tag_check (enum LTO_tags actual, enum LTO_tags expected)
1146{
1147 if (actual != expected)
1148 internal_error ("bytecode stream: expected tag %s instead of %s",
1149 lto_tag_name (expected), lto_tag_name (actual));
1150}
1151
1152/* Check that tag ACTUAL is in the range [TAG1, TAG2]. */
1153inline void
1154lto_tag_check_range (enum LTO_tags actual, enum LTO_tags tag1,
1155 enum LTO_tags tag2)
1156{
1157 if (actual < tag1 || actual > tag2)
1158 internal_error ("bytecode stream: tag %s is not in the expected range "
1159 "[%s, %s]",
1160 lto_tag_name (actual),
1161 lto_tag_name (tag1),
1162 lto_tag_name (tag2));
1163}
1164
1165/* Initialize an lto_out_decl_buffer ENCODER. */
1166inline void
1168{
1169 encoder->tree_hash_table = new hash_map<tree, unsigned> (251);
1170 encoder->trees.create (0);
1171}
1172
1173
1174/* Destroy an lto_tree_ref_encoder ENCODER by freeing its contents. The
1175 memory used by ENCODER is not freed by this function. */
1176inline void
1178{
1179 /* Hash table may be delete already. */
1180 delete encoder->tree_hash_table;
1181 encoder->tree_hash_table = NULL;
1182 encoder->trees.release ();
1183}
1184
1185/* Return the number of trees encoded in ENCODER. */
1186inline unsigned int
1188{
1189 return encoder->trees.length ();
1190}
1191
1192/* Return the IDX-th tree in ENCODER. */
1193inline tree
1195 unsigned int idx)
1196{
1197 return encoder->trees[idx];
1198}
1199
1200/* Return number of encoded nodes in ENCODER. */
1201inline int
1203{
1204 return encoder->nodes.length ();
1205}
1206
1207/* Value used to represent failure of lto_symtab_encoder_lookup. */
1208#define LCC_NOT_FOUND (-1)
1209
1210/* Look up NODE in encoder. Return NODE's reference if it has been encoded
1211 or LCC_NOT_FOUND if it is not there. */
1212
1213inline int
1216{
1217 size_t *slot = encoder->map->get (node);
1218 return (slot && *slot ? *(slot) - 1 : LCC_NOT_FOUND);
1219}
1220
1221/* Return true if iterator LSE points to nothing. */
1222inline bool
1224{
1225 return lsei.index >= (unsigned)lto_symtab_encoder_size (lsei.encoder);
1226}
1227
1228/* Advance iterator LSE. */
1229inline void
1231{
1232 lsei->index++;
1233}
1234
1235/* Return the node pointed to by LSI. */
1236inline toplevel_node *
1238{
1239 return lsei.encoder->nodes[lsei.index].node;
1240}
1241
1242/* Return the node pointed to by LSI. */
1243inline struct cgraph_node *
1248
1249/* Return the node pointed to by LSI. */
1250inline varpool_node *
1255
1256/* Return the cgraph node corresponding to REF using ENCODER. */
1257
1258inline toplevel_node *
1260{
1261 if (ref == LCC_NOT_FOUND)
1262 return NULL;
1263
1264 return encoder->nodes[ref].node;
1265}
1266
1267/* Return an iterator to the first node in LSI. */
1270{
1272
1273 lsei.encoder = encoder;
1274 lsei.index = 0;
1275 return lsei;
1276}
1277
1278/* Advance iterator LSE. */
1279inline void
1281{
1282 lsei_next (lsei);
1283 while (!lsei_end_p (*lsei)
1285 lsei_next (lsei);
1286}
1287
1288/* Return an iterator to the first node in LSI. */
1291{
1292 lto_symtab_encoder_iterator lsei = lsei_start (encoder);
1293
1294 if (lsei_end_p (lsei))
1295 return lsei;
1296 if (!lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei)))
1297 lsei_next_in_partition (&lsei);
1298
1299 return lsei;
1300}
1301
1302/* Advance iterator LSE. */
1303inline void
1305{
1306 lsei_next (lsei);
1307 while (!lsei_end_p (*lsei)
1308 && (!is_a <cgraph_node *> (lsei_node (*lsei))
1310 lsei_next (lsei);
1311}
1312
1313/* Return an iterator to the first node in LSI. */
1316{
1317 lto_symtab_encoder_iterator lsei = lsei_start (encoder);
1318
1319 if (lsei_end_p (lsei))
1320 return lsei;
1321 if (!is_a <cgraph_node *> (lsei_node (lsei))
1322 || !lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei)))
1324
1325 return lsei;
1326}
1327
1328/* Advance iterator LSE. */
1329inline void
1331{
1332 lsei_next (lsei);
1333 while (!lsei_end_p (*lsei)
1334 && (!is_a <varpool_node *> (lsei_node (*lsei))
1336 lsei_next (lsei);
1337}
1338
1339/* Return an iterator to the first node in LSI. */
1342{
1343 lto_symtab_encoder_iterator lsei = lsei_start (encoder);
1344
1345 if (lsei_end_p (lsei))
1346 return lsei;
1347 if (!is_a <varpool_node *> (lsei_node (lsei))
1348 || !lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei)))
1350
1351 return lsei;
1352}
1353
1354/* Entry for the delayed registering of decl -> DIE references. */
1357 const char *sym;
1358 unsigned HOST_WIDE_INT off;
1359};
1360
1362
1363extern FILE *streamer_dump_file;
1364
1365#endif /* GCC_LTO_STREAMER_H */
Definition vec.h:1667
Definition lto-streamer.h:844
void save_die_ref(unsigned index, lto_die_ref ref)
Definition lto-streamer-in.cc:1773
auto_vec< lto_pending_origin_ref > pending_origin_refs
Definition lto-streamer.h:866
data_in(lto_file_decl_data *data_for_loc)
Definition lto-streamer.h:871
lto_die_ref_map * die_refs
Definition lto-streamer.h:863
vec< ld_plugin_symbol_resolution_t > globals_resolution
Definition lto-streamer.h:856
lto_location_cache location_cache
Definition lto-streamer.h:869
struct streamer_tree_cache_d * reader_cache
Definition lto-streamer.h:859
unsigned int strings_len
Definition lto-streamer.h:853
struct lto_file_decl_data * file_data
Definition lto-streamer.h:847
void register_origin_refs()
Definition lto-streamer-in.cc:1785
const char * strings
Definition lto-streamer.h:850
Definition hash-map.h:40
Value * get(const Key &k)
Definition hash-map.h:189
hash_map(size_t n=default_hash_map_size, bool ggc=false, bool sanitize_eq_and_hash=true, bool gather_mem_stats=GATHER_STATISTICS CXX_MEM_STAT_INFO)
Definition hash-map.h:138
Definition hash-set.h:37
Definition hash-table.h:375
Definition lto-streamer.h:349
unsigned int len
Definition lto-streamer.h:363
unsigned int p
Definition lto-streamer.h:362
lto_input_block(const char *data_, unsigned int p_, unsigned int len_, const lto_file_decl_data *file_data_)
Definition lto-streamer.h:353
const char * data
Definition lto-streamer.h:360
const lto_file_decl_data * file_data
Definition lto-streamer.h:361
lto_input_block(const char *data_, unsigned int len_, const lto_file_decl_data *file_data_)
Definition lto-streamer.h:356
Definition lto-streamer.h:275
void revert_location_cache()
Definition lto-streamer-in.cc:438
size_t stream_map_idx
Definition lto-streamer.h:335
location_t stream_loc_offset
Definition lto-streamer.h:336
tree stream_block
Definition lto-streamer.h:333
lto_file_decl_data *const decl_data
Definition lto-streamer.h:325
lto_location_cache(lto_file_decl_data *loc_data)
Definition lto-streamer.h:292
unsigned stream_discr
Definition lto-streamer.h:334
auto_vec< cached_location > loc_cache
Definition lto-streamer.h:330
unsigned accepted_length
Definition lto-streamer.h:344
void accept_location_cache()
Definition lto-streamer-in.cc:429
~lto_location_cache()
Definition lto-streamer.h:301
unsigned linemap_offset
Definition lto-streamer.h:327
const lto_loc_map * cur_loc_map
Definition lto-streamer.h:326
void input_location_and_block(location_t *dest, struct bitpack_d *bp, class lto_input_block *ib, class data_in *data_in)
Definition lto-streamer-in.cc:598
bool apply_location_cache()
Definition lto-streamer-in.cc:406
location_t current_loc
Definition lto-streamer.h:340
static lto_location_cache * current_cache
Definition lto-streamer.h:313
void set_linemap_offset(unsigned offset)
Definition lto-streamer.h:290
void input_location(location_t *dest, struct bitpack_d *bp, class data_in *data_in)
Definition lto-streamer-in.cc:677
cached_location current_cloc
Definition lto-streamer.h:339
Definition lra-spills.cc:101
const union tree_node * const_tree
Definition coretypes.h:98
#define GTY(x)
Definition coretypes.h:41
union tree_node * tree
Definition coretypes.h:97
void lto_append_block(struct lto_output_stream *obs)
Definition data-streamer-out.cc:38
void internal_error(const char *,...) ATTRIBUTE_GCC_DIAG(1
void ATTRIBUTE_NORETURN
Definition diagnostic-core.h:76
tree_code
Definition genmatch.cc:1011
gimple_code
Definition gimple.h:34
#define UNKNOWN_LOCATION
Definition input.h:32
bool is_a(U *p)
Definition is-a.h:230
T dyn_cast(U *p)
Definition is-a.h:280
void input_offload_tables(bool do_force_output)
Definition lto-cgraph.cc:1935
void input_toplevel_asms(void)
Definition lto-cgraph.cc:1904
lto_symtab_encoder_t compute_ltrans_boundary(lto_symtab_encoder_t in_encoder)
Definition lto-cgraph.cc:877
int lto_symtab_encoder_encode(lto_symtab_encoder_t encoder, toplevel_node *node)
Definition lto-cgraph.cc:107
bool reachable_from_this_partition_p(struct cgraph_node *node, lto_symtab_encoder_t encoder)
Definition lto-cgraph.cc:379
void lto_symtab_encoder_delete(lto_symtab_encoder_t encoder)
Definition lto-cgraph.cc:91
bool referenced_from_other_partition_p(symtab_node *node, lto_symtab_encoder_t encoder)
Definition lto-cgraph.cc:318
bool lto_symtab_encoder_only_for_inlining_p(lto_symtab_encoder_t encoder, struct cgraph_node *node)
Definition lto-cgraph.cc:171
void output_symtab(void)
Definition lto-cgraph.cc:1037
bool lto_symtab_encoder_encode_initializer_p(lto_symtab_encoder_t encoder, varpool_node *node)
Definition lto-cgraph.cc:191
bool lto_symtab_encoder_encode_body_p(lto_symtab_encoder_t encoder, struct cgraph_node *node)
Definition lto-cgraph.cc:181
lto_symtab_encoder_t lto_symtab_encoder_new(bool for_input)
Definition lto-cgraph.cc:77
void input_symtab(void)
Definition lto-cgraph.cc:1847
void select_what_to_stream(void)
Definition lto-cgraph.cc:861
void lto_set_symtab_encoder_in_partition(lto_symtab_encoder_t encoder, toplevel_node *node)
Definition lto-cgraph.cc:225
void output_offload_tables(void)
Definition lto-cgraph.cc:1141
bool lto_symtab_encoder_delete_node(lto_symtab_encoder_t encoder, toplevel_node *node)
Definition lto-cgraph.cc:139
bool reachable_from_other_partition_p(struct cgraph_node *node, lto_symtab_encoder_t encoder)
Definition lto-cgraph.cc:340
bool referenced_from_this_partition_p(symtab_node *node, lto_symtab_encoder_t encoder)
Definition lto-cgraph.cc:364
bool lto_symtab_encoder_in_partition_p(lto_symtab_encoder_t encoder, toplevel_node *node)
Definition lto-cgraph.cc:213
void lto_write_options(void)
Definition lto-opts.cc:60
const char * lto_get_decl_name_mapping(struct lto_file_decl_data *decl_data, const char *name)
Definition lto-section-in.cc:367
void lto_free_raw_section_data(struct lto_file_decl_data *file_data, enum lto_section_type section_type, const char *name, const char *data, size_t len)
Definition lto-section-in.cc:235
const char * lto_get_section_data(struct lto_file_decl_data *file_data, enum lto_section_type section_type, const char *name, int order, size_t *len, bool decompress)
Definition lto-section-in.cc:135
const lto_die_ref * lto_decl_origin_ref_at(const lto_in_decl_state *state, unsigned index)
Definition lto-section-in.cc:397
void lto_record_renamed_decl(struct lto_file_decl_data *decl_data, const char *old_name, const char *new_name)
Definition lto-section-in.cc:342
htab_t lto_create_renaming_table(void)
Definition lto-section-in.cc:333
void lto_set_in_hooks(struct lto_file_decl_data **data, lto_get_section_data_f *get_f, lto_free_section_data_f *free_f)
Definition lto-section-in.cc:76
const char * lto_section_name[LTO_N_SECTION_TYPES]
Definition lto-section-in.cc:35
void lto_free_function_in_decl_state_for_node(symtab_node *node)
Definition lto-section-in.cc:458
void lto_delete_in_decl_state(struct lto_in_decl_state *state)
Definition lto-section-in.cc:417
const char * lto_get_raw_section_data(struct lto_file_decl_data *file_data, enum lto_section_type section_type, const char *name, int order, size_t *len)
Definition lto-section-in.cc:194
void lto_free_function_in_decl_state(struct lto_in_decl_state *state)
Definition lto-section-in.cc:445
struct lto_file_decl_data ** lto_get_file_decl_data(void)
Definition lto-section-in.cc:90
class lto_input_block * lto_create_simple_input_block(struct lto_file_decl_data *file_data, enum lto_section_type section_type, const char **datar, size_t *len)
Definition lto-section-in.cc:250
void lto_value_range_error(const char *purpose, HOST_WIDE_INT val, HOST_WIDE_INT min, HOST_WIDE_INT max)
Definition lto-section-in.cc:489
void lto_destroy_simple_input_block(struct lto_file_decl_data *file_data, enum lto_section_type section_type, class lto_input_block *ib, const char *data, size_t len)
Definition lto-section-in.cc:277
struct lto_in_decl_state * lto_get_function_in_decl_state(struct lto_file_decl_data *file_data, tree func)
Definition lto-section-in.cc:431
struct lto_in_decl_state * lto_new_in_decl_state(void)
Definition lto-section-in.cc:389
void lto_section_overrun(class lto_input_block *ib)
Definition lto-section-in.cc:480
const char * lto_get_summary_section_data(struct lto_file_decl_data *file_data, enum lto_section_type section_type, size_t *len)
Definition lto-section-in.cc:185
void lto_free_section_data(struct lto_file_decl_data *file_data, enum lto_section_type section_type, const char *name, const char *data, size_t len, bool decompress)
Definition lto-section-in.cc:207
struct lto_out_decl_state * lto_get_out_decl_state(void)
Definition lto-section-out.cc:234
struct lto_simple_output_block * lto_create_simple_output_block(enum lto_section_type section_type)
Definition lto-section-out.cc:153
vec< lto_out_decl_state_ptr > lto_function_decl_states
Definition lto-section-out.cc:40
void lto_record_function_out_decl_state(tree fn_decl, struct lto_out_decl_state *state)
Definition lto-section-out.cc:260
struct lto_out_decl_state * lto_new_out_decl_state(void)
Definition lto-section-out.cc:200
void lto_begin_section(const char *name, bool compress)
Definition lto-section-out.cc:66
void lto_write_stream(struct lto_output_stream *obs)
Definition lto-section-out.cc:121
void lto_write_raw_data(const void *data, unsigned int size)
Definition lto-section-out.cc:112
void lto_push_out_decl_state(struct lto_out_decl_state *state)
Definition lto-section-out.cc:242
void lto_destroy_simple_output_block(struct lto_simple_output_block *ob)
Definition lto-section-out.cc:171
struct lto_out_decl_state * lto_pop_out_decl_state(void)
Definition lto-section-out.cc:250
void lto_end_section(void)
Definition lto-section-out.cc:88
void lto_delete_out_decl_state(struct lto_out_decl_state *state)
Definition lto-section-out.cc:218
void lto_write_data(const void *data, unsigned int size)
Definition lto-section-out.cc:101
void lto_free_file_name_hash(void)
Definition lto-streamer-in.cc:2320
tree lto_input_tree(class lto_input_block *ib, class data_in *data_in)
Definition lto-streamer-in.cc:2073
void lto_input_mode_table(struct lto_file_decl_data *file_data)
Definition lto-streamer-in.cc:2149
tree lto_input_tree_ref(class lto_input_block *ib, class data_in *data_in, struct function *fn, enum LTO_tags tag)
Definition lto-streamer-in.cc:698
hashval_t lto_input_scc(class lto_input_block *ib, class data_in *data_in, unsigned *len, unsigned *entry_len, bool shared_scc)
Definition lto-streamer-in.cc:1929
void lto_data_in_delete(class data_in *data_in)
Definition lto-streamer-in.cc:2358
tree lto_input_tree_1(class lto_input_block *ib, class data_in *data_in, enum LTO_tags tag, hashval_t hash)
Definition lto-streamer-in.cc:2019
tree lto_input_var_decl_ref(lto_input_block *ib, lto_file_decl_data *file_data)
Definition lto-streamer-in.cc:725
class data_in * lto_data_in_create(struct lto_file_decl_data *file_data, const char *strings, unsigned len, vec< ld_plugin_symbol_resolution_t > resolutions, bool need_location_cache)
Definition lto-streamer-in.cc:2340
void lto_reader_init(void)
Definition lto-streamer-in.cc:2307
void lto_input_variable_constructor(struct lto_file_decl_data *file_data, struct varpool_node *node, const char *data)
Definition lto-streamer-in.cc:1759
tree lto_input_fn_decl_ref(lto_input_block *ib, lto_file_decl_data *file_data)
Definition lto-streamer-in.cc:737
void lto_input_function_body(struct lto_file_decl_data *file_data, struct cgraph_node *node, const char *data)
Definition lto-streamer-in.cc:1749
void lto_input_location(location_t *loc, struct bitpack_d *bp, class data_in *data_in)
Definition lto-streamer-in.cc:684
void lto_input_toplevel_asms(struct lto_file_decl_data *file_data, int order_base)
Definition lto-streamer-in.cc:2108
void lto_init_eh(void)
Definition lto-streamer-in.cc:953
vec< dref_entry > dref_queue
Definition lto-streamer-in.cc:1768
void lto_input_data_block(class lto_input_block *ib, void *addr, size_t length)
Definition lto-streamer-in.cc:131
void lto_tag_check_set(enum LTO_tags actual, int ntags,...)
Definition lto-streamer-in.cc:110
tree stream_read_tree_ref(lto_input_block *ib, data_in *data_in, int *ref)
Definition lto-streamer-in.cc:1991
void lto_output_fn_decl_ref(struct lto_out_decl_state *decl_state, struct lto_output_stream *obs, tree decl)
Definition lto-streamer-out.cc:548
void lto_output_init_mode_table(void)
Definition lto-streamer-out.cc:3601
void lto_output(void)
Definition lto-streamer-out.cc:3104
void lto_prepare_function_for_streaming(struct cgraph_node *node)
Definition lto-streamer-out.cc:2568
void lto_copy_linemaps()
Definition lto-streamer-out.cc:2999
void produce_asm_for_decls(void)
Definition lto-streamer-out.cc:3700
struct output_block * create_output_block(enum lto_section_type section_type)
Definition lto-streamer-out.cc:75
bool lto_variably_modified_type_p(tree type)
Definition lto-streamer-out.cc:131
void produce_asm(struct output_block *ob)
Definition lto-streamer-out.cc:2484
void lto_output_location_and_block(struct output_block *ob, struct bitpack_d *bp, location_t loc)
Definition lto-streamer-out.cc:473
void lto_output_location(struct output_block *ob, struct bitpack_d *bp, location_t loc)
Definition lto-streamer-out.cc:461
void lto_output_toplevel_asms(lto_symtab_encoder_t encoder)
Definition lto-streamer-out.cc:2769
void lto_output_tree(struct output_block *ob, tree expr, bool ref_p, bool this_ref_p)
Definition lto-streamer-out.cc:2029
void destroy_output_block(struct output_block *ob)
Definition lto-streamer-out.cc:107
void lto_output_var_decl_ref(struct lto_out_decl_state *decl_state, struct lto_output_stream *obs, tree decl)
Definition lto-streamer-out.cc:535
void lto_register_linemap_for_output(size_t map_idx, unsigned linemap_id)
Definition lto-streamer-out.cc:3096
void lto_output_decl_state_streams(struct output_block *ob, struct lto_out_decl_state *state)
Definition lto-streamer-out.cc:3290
void lto_output_decl_state_refs(struct output_block *ob, struct lto_out_decl_state *state)
Definition lto-streamer-out.cc:3304
void stream_write_tree_ref(struct output_block *ob, tree t)
Definition lto-streamer-out.cc:657
void lto_check_version(int major, int minor, const char *file_name)
Definition lto-streamer.cc:269
const char * lto_tag_name(enum LTO_tags tag)
Definition lto-streamer.cc:47
void lto_streamer_hooks_init(void)
Definition lto-streamer.cc:284
FILE * streamer_dump_file
Definition lto-streamer.cc:42
char * lto_get_section_name(int section_type, const char *name, int node_order, struct lto_file_decl_data *f)
Definition lto-streamer.cc:103
struct lto_stats_d lto_stats
Definition lto-streamer.cc:36
bool lto_stream_offload_p
Definition lto-streamer.cc:40
void lto_streamer_init(void)
Definition lto-streamer.cc:245
bool gate_lto_out(void)
Definition lto-streamer.cc:259
void print_lto_report(const char *s)
Definition lto-streamer.cc:164
void lsei_next(lto_symtab_encoder_iterator *lsei)
Definition lto-streamer.h:1230
void cl_optimization_stream_out(struct output_block *, struct bitpack_d *, struct cl_optimization *)
struct lto_symtab_encoder_d * lto_symtab_encoder_t
Definition lto-streamer.h:492
struct lto_out_decl_state * lto_out_decl_state_ptr
Definition lto-streamer.h:617
lto_symtab_encoder_iterator lsei_start_in_partition(lto_symtab_encoder_t encoder)
Definition lto-streamer.h:1290
void lto_input_cgraph(struct lto_file_decl_data *, const char *)
enum tree_code lto_tag_to_tree_code(enum LTO_tags tag)
Definition lto-streamer.h:1137
lto_symtab_encoder_iterator lsei_start_variable_in_partition(lto_symtab_encoder_t encoder)
Definition lto-streamer.h:1341
struct lto_file_decl_data * lto_file_decl_data_ptr
Definition lto-streamer.h:705
void cl_optimization_stream_in(class data_in *, struct bitpack_d *, struct cl_optimization *)
void lsei_next_function_in_partition(lto_symtab_encoder_iterator *lsei)
Definition lto-streamer.h:1304
void lto_free_section_data_f(struct lto_file_decl_data *, enum lto_section_type, const char *, const char *, size_t)
Definition lto-streamer.h:256
void lto_tag_check(enum LTO_tags actual, enum LTO_tags expected)
Definition lto-streamer.h:1145
struct lto_in_decl_state * lto_in_decl_state_ptr
Definition lto-streamer.h:572
tree lto_tree_ref_encoder_get_tree(struct lto_tree_ref_encoder *encoder, unsigned int idx)
Definition lto-streamer.h:1194
lto_symtab_encoder_iterator lsei_start_function_in_partition(lto_symtab_encoder_t encoder)
Definition lto-streamer.h:1315
enum gimple_code lto_tag_to_gimple_code(enum LTO_tags tag)
Definition lto-streamer.h:1118
LTO_tags
Definition lto-streamer.h:134
@ LTO_ert_allowed_exceptions
Definition lto-streamer.h:183
@ LTO_tree_scc
Definition lto-streamer.h:152
@ LTO_ert_try
Definition lto-streamer.h:182
@ LTO_bb1
Definition lto-streamer.h:169
@ LTO_eh_catch
Definition lto-streamer.h:190
@ LTO_NUM_TAGS
Definition lto-streamer.h:193
@ LTO_global_stream_ref
Definition lto-streamer.h:147
@ LTO_ert_must_not_throw
Definition lto-streamer.h:184
@ LTO_tree_pickle_reference
Definition lto-streamer.h:138
@ LTO_null
Definition lto-streamer.h:135
@ LTO_bb0
Definition lto-streamer.h:168
@ LTO_eh_region
Definition lto-streamer.h:172
@ LTO_ssa_name_ref
Definition lto-streamer.h:149
@ LTO_trees
Definition lto-streamer.h:155
@ LTO_first_tree_tag
Definition lto-streamer.h:162
@ LTO_function
Definition lto-streamer.h:175
@ LTO_first_gimple_tag
Definition lto-streamer.h:165
@ LTO_eh_landing_pad
Definition lto-streamer.h:187
@ LTO_integer_cst
Definition lto-streamer.h:158
@ LTO_eh_table
Definition lto-streamer.h:178
@ LTO_ert_cleanup
Definition lto-streamer.h:181
enum ld_plugin_symbol_resolution ld_plugin_symbol_resolution_t
Definition lto-streamer.h:239
bool lsei_end_p(lto_symtab_encoder_iterator lsei)
Definition lto-streamer.h:1223
toplevel_node * lto_symtab_encoder_deref(lto_symtab_encoder_t encoder, int ref)
Definition lto-streamer.h:1259
unsigned lto_linemap_output_id(unsigned linemap_id, const lto_file_decl_data *file_data)
Definition lto-streamer.h:700
bool lto_origin_ref_node_p(const_tree t)
Definition lto-streamer.h:543
void cl_target_option_stream_out(struct output_block *, struct bitpack_d *, struct cl_target_option *)
void lsei_next_in_partition(lto_symtab_encoder_iterator *lsei)
Definition lto-streamer.h:1280
lto_decl_stream_e_t
Definition lto-streamer.h:234
@ LTO_N_DECL_STREAMS
Definition lto-streamer.h:236
@ LTO_DECL_STREAM
Definition lto-streamer.h:235
lto_section_type
Definition lto-streamer.h:204
@ LTO_section_offload_table
Definition lto-streamer.h:222
@ LTO_section_symtab
Definition lto-streamer.h:208
@ LTO_section_decls
Definition lto-streamer.h:205
@ LTO_section_cgraph_opt_sum
Definition lto-streamer.h:218
@ LTO_section_linemap
Definition lto-streamer.h:228
@ LTO_section_jump_functions
Definition lto-streamer.h:212
@ LTO_section_ipa_modref
Definition lto-streamer.h:227
@ LTO_section_ipa_fn_summary
Definition lto-streamer.h:219
@ LTO_section_ipcp_transform
Definition lto-streamer.h:220
@ LTO_section_ipa_pure_const
Definition lto-streamer.h:213
@ LTO_section_lto
Definition lto-streamer.h:224
@ LTO_section_symtab_extension
Definition lto-streamer.h:209
@ LTO_section_symtab_nodes
Definition lto-streamer.h:216
@ LTO_section_ipa_sra
Definition lto-streamer.h:225
@ LTO_section_ipa_profile
Definition lto-streamer.h:215
@ LTO_section_static_initializer
Definition lto-streamer.h:207
@ LTO_section_odr_types
Definition lto-streamer.h:226
@ LTO_section_refs
Definition lto-streamer.h:210
@ LTO_section_opts
Definition lto-streamer.h:217
@ LTO_section_mode_table
Definition lto-streamer.h:223
@ LTO_section_asm
Definition lto-streamer.h:211
@ LTO_section_ipa_reference
Definition lto-streamer.h:214
@ LTO_N_SECTION_TYPES
Definition lto-streamer.h:229
@ LTO_section_function_body
Definition lto-streamer.h:206
@ LTO_section_ipa_icf
Definition lto-streamer.h:221
lto_symtab_encoder_iterator lsei_start(lto_symtab_encoder_t encoder)
Definition lto-streamer.h:1269
int lto_symtab_encoder_size(lto_symtab_encoder_t encoder)
Definition lto-streamer.h:1202
void lto_input_constructors_and_inits(struct lto_file_decl_data *, const char *)
void lto_init_tree_ref_encoder(struct lto_tree_ref_encoder *encoder)
Definition lto-streamer.h:1167
bool lto_tag_is_gimple_code_p(enum LTO_tags tag)
Definition lto-streamer.h:1098
bool lto_tag_is_tree_code_p(enum LTO_tags tag)
Definition lto-streamer.h:1090
void lto_tag_check_range(enum LTO_tags actual, enum LTO_tags tag1, enum LTO_tags tag2)
Definition lto-streamer.h:1154
enum LTO_tags lto_tree_code_to_tag(enum tree_code code)
Definition lto-streamer.h:1128
unsigned int lto_tree_ref_encoder_size(struct lto_tree_ref_encoder *encoder)
Definition lto-streamer.h:1187
void lsei_next_variable_in_partition(lto_symtab_encoder_iterator *lsei)
Definition lto-streamer.h:1330
lto_origin_ref_kind
Definition lto-streamer.h:531
@ LTO_ORIGIN_REF_DIE
Definition lto-streamer.h:538
@ LTO_ORIGIN_REF_NONE
Definition lto-streamer.h:536
@ LTO_ORIGIN_REF_TREE
Definition lto-streamer.h:533
enum LTO_tags lto_gimple_code_to_tag(enum gimple_code code)
Definition lto-streamer.h:1109
hash_map< int_hash< unsigned, UINT_MAX >, lto_die_ref > lto_die_ref_map
Definition lto-streamer.h:549
toplevel_node * lsei_node(lto_symtab_encoder_iterator lsei)
Definition lto-streamer.h:1237
lto_compression
Definition lto-streamer.h:369
@ ZSTD
Definition lto-streamer.h:371
@ ZLIB
Definition lto-streamer.h:370
void cl_target_option_stream_in(class data_in *, struct bitpack_d *, struct cl_target_option *)
varpool_node * lsei_varpool_node(lto_symtab_encoder_iterator lsei)
Definition lto-streamer.h:1251
#define LCC_NOT_FOUND
Definition lto-streamer.h:1208
void lto_destroy_tree_ref_encoder(struct lto_tree_ref_encoder *encoder)
Definition lto-streamer.h:1177
void lto_register_decl_definition(tree, struct lto_file_decl_data *)
struct cgraph_node * lsei_cgraph_node(lto_symtab_encoder_iterator lsei)
Definition lto-streamer.h:1244
unsigned char lto_decl_flags_t
Definition lto-streamer.h:127
int lto_symtab_encoder_lookup(lto_symtab_encoder_t encoder, toplevel_node *node)
Definition lto-streamer.h:1214
const char * lto_get_section_data_f(struct lto_file_decl_data *, enum lto_section_type, const char *, int, size_t *)
Definition lto-streamer.h:247
Definition custom-sarif-properties/state-graphs.h:33
poly_int< N, C > r
Definition poly-int.h:774
i
Definition poly-int.h:776
Ca const poly_int< N, Cb > & b
Definition poly-int.h:771
Ca & a
Definition poly-int.h:770
Definition data-streamer.h:35
Definition cgraph.h:920
Definition lto-streamer.h:575
static bool equal(lto_in_decl_state *a, lto_in_decl_state *b)
Definition lto-streamer.h:583
static hashval_t hash(lto_in_decl_state *s)
Definition lto-streamer.h:577
Definition lto-streamer.h:1355
tree decl
Definition lto-streamer.h:1356
unsigned HOST_WIDE_INT off
Definition lto-streamer.h:1358
const char * sym
Definition lto-streamer.h:1357
Definition function.h:249
Definition gcov-io.h:354
Definition hash-traits.h:321
Definition hash-traits.h:122
Definition ipa-ref.h:75
Definition lto-streamer.h:708
char * ptr
Definition lto-streamer.h:709
Definition lto-streamer.h:426
int32_t decl_state_size
Definition lto-streamer.h:428
int32_t num_nodes
Definition lto-streamer.h:435
int32_t debug_ref_size
Definition lto-streamer.h:432
Definition lto-streamer.h:521
lto_die_ref ref
Definition lto-streamer.h:523
unsigned index
Definition lto-streamer.h:522
Definition lto-streamer.h:514
unsigned HOST_WIDE_INT off
Definition lto-streamer.h:516
const char * sym
Definition lto-streamer.h:515
lto_encoder_entry(toplevel_node *n)
Definition lto-streamer.h:462
unsigned int body
Definition lto-streamer.h:472
unsigned int in_partition
Definition lto-streamer.h:470
unsigned int only_for_inlining
Definition lto-streamer.h:474
unsigned int initializer
Definition lto-streamer.h:478
Definition lto-streamer.h:634
htab_t section_hash_table
Definition lto-streamer.h:652
unsigned mode_bits
Definition lto-streamer.h:685
unsigned max_index
Definition lto-streamer.h:668
vec< res_pair > respairs
Definition lto-streamer.h:667
struct lto_file_decl_data * next
Definition lto-streamer.h:658
lto_file_decl_data * loc_map_decl_data
Definition lto-streamer.h:693
struct lto_in_decl_state * global_decl_state
Definition lto-streamer.h:640
gcov_summary profile_info
Definition lto-streamer.h:670
int order
Definition lto-streamer.h:661
htab_t renaming_hash_table
Definition lto-streamer.h:655
unsigned HOST_WIDE_INT id
Definition lto-streamer.h:664
const char * file_name
Definition lto-streamer.h:649
vec< lto_loc_map *, va_gc > * loc_maps
Definition lto-streamer.h:694
lto_section lto_section_header
Definition lto-streamer.h:679
int order_base
Definition lto-streamer.h:681
unsigned num_linemap_sections
Definition lto-streamer.h:690
const unsigned char * mode_table
Definition lto-streamer.h:676
hash_map< tree, ld_plugin_symbol_resolution > * resolution_map
Definition lto-streamer.h:673
int unit_base
Definition lto-streamer.h:683
struct lto_in_decl_state * current_decl_state
Definition lto-streamer.h:636
hash_table< decl_state_hasher > * function_decl_states
Definition lto-streamer.h:646
lto_symtab_encoder_t symtab_node_encoder
Definition lto-streamer.h:643
Definition lto-streamer.h:418
int32_t cfg_size
Definition lto-streamer.h:420
Definition lto-streamer.h:553
bool compressed
Definition lto-streamer.h:565
tree fn_decl
Definition lto-streamer.h:562
vec< lto_decl_origin_ref, va_gc > * origin_refs
Definition lto-streamer.h:558
vec< tree, va_gc > * streams[LTO_N_DECL_STREAMS]
Definition lto-streamer.h:555
unsigned linemap_id
Definition lto-streamer.h:569
Definition lto-streamer.h:265
size_t map[1]
Definition lto-streamer.h:267
size_t nmaps
Definition lto-streamer.h:266
Definition lto-streamer.h:317
tree block
Definition lto-streamer.h:320
unsigned discr
Definition lto-streamer.h:321
location_t loc
Definition lto-streamer.h:319
location_t * dest
Definition lto-streamer.h:318
Definition lto-streamer.h:592
lto_symtab_encoder_t symtab_node_encoder
Definition lto-streamer.h:600
bool compressed
Definition lto-streamer.h:607
vec< lto_decl_origin_ref > origin_refs
Definition lto-streamer.h:597
tree fn_decl
Definition lto-streamer.h:604
bool output_offload_tables_p
Definition lto-streamer.h:610
unsigned linemap_id
Definition lto-streamer.h:614
struct lto_tree_ref_encoder streams[LTO_N_DECL_STREAMS]
Definition lto-streamer.h:595
Definition lto-streamer.h:717
struct lto_char_ptr_base * current_block
Definition lto-streamer.h:722
unsigned int total_size
Definition lto-streamer.h:734
unsigned int block_size
Definition lto-streamer.h:731
unsigned int left_in_block
Definition lto-streamer.h:728
char * current_pointer
Definition lto-streamer.h:725
struct lto_char_ptr_base * first_block
Definition lto-streamer.h:719
Definition lto-streamer.h:835
int origin
Definition lto-streamer.h:838
lto_die_ref ref
Definition lto-streamer.h:839
unsigned index
Definition lto-streamer.h:836
Definition lto-streamer.h:378
uint16_t flags
Definition lto-streamer.h:385
unsigned char _padding
Definition lto-streamer.h:382
int16_t minor_version
Definition lto-streamer.h:380
unsigned char slim_object
Definition lto-streamer.h:381
int16_t major_version
Definition lto-streamer.h:379
lto_compression get_compression()
Definition lto-streamer.h:394
void set_compression(lto_compression c)
Definition lto-streamer.h:388
Definition lto-streamer.h:411
int32_t string_size
Definition lto-streamer.h:413
Definition lto-streamer.h:405
int32_t main_size
Definition lto-streamer.h:407
Definition lto-streamer.h:740
struct lto_output_stream * main_stream
Definition lto-streamer.h:745
enum lto_section_type section_type
Definition lto-streamer.h:741
struct lto_out_decl_state * decl_state
Definition lto-streamer.h:742
Definition lto-streamer.h:441
unsigned HOST_WIDE_INT num_pickle_refs_output
Definition lto-streamer.h:455
unsigned HOST_WIDE_INT num_input_cgraph_nodes
Definition lto-streamer.h:442
unsigned HOST_WIDE_INT num_output_il_bytes
Definition lto-streamer.h:450
unsigned HOST_WIDE_INT num_input_files
Definition lto-streamer.h:444
unsigned HOST_WIDE_INT num_compressed_il_bytes
Definition lto-streamer.h:451
unsigned HOST_WIDE_INT num_output_files
Definition lto-streamer.h:445
unsigned HOST_WIDE_INT num_trees[NUM_TREE_CODES]
Definition lto-streamer.h:449
unsigned HOST_WIDE_INT num_function_bodies
Definition lto-streamer.h:448
unsigned HOST_WIDE_INT num_input_il_bytes
Definition lto-streamer.h:452
unsigned HOST_WIDE_INT section_size[LTO_N_SECTION_TYPES]
Definition lto-streamer.h:447
unsigned HOST_WIDE_INT num_uncompressed_il_bytes
Definition lto-streamer.h:453
unsigned HOST_WIDE_INT num_cgraph_partitions
Definition lto-streamer.h:446
unsigned HOST_WIDE_INT num_output_symtab_nodes
Definition lto-streamer.h:443
unsigned HOST_WIDE_INT num_tree_bodies_output
Definition lto-streamer.h:454
Definition lto-streamer.h:484
hash_map< toplevel_node *, size_t > * map
Definition lto-streamer.h:486
hash_map< int_hash< int, -1, -2 >, int > * order_remap
Definition lto-streamer.h:489
vec< lto_encoder_entry > nodes
Definition lto-streamer.h:485
Definition lto-streamer.h:496
lto_symtab_encoder_t encoder
Definition lto-streamer.h:497
unsigned index
Definition lto-streamer.h:498
Definition lto-streamer.h:506
hash_map< tree, unsigned > * tree_hash_table
Definition lto-streamer.h:507
vec< tree > trees
Definition lto-streamer.h:508
Definition hash-traits.h:303
Definition lto-streamer.h:793
unsigned current_discr
Definition lto-streamer.h:817
struct obstack obstack
Definition lto-streamer.h:830
struct lto_output_stream * cfg_stream
Definition lto-streamer.h:804
struct lto_output_stream * string_stream
Definition lto-streamer.h:801
enum lto_section_type section_type
Definition lto-streamer.h:794
hash_set< tree > * local_trees
Definition lto-streamer.h:826
size_t current_map_idx
Definition lto-streamer.h:818
tree current_block
Definition lto-streamer.h:816
location_t current_loc_offset
Definition lto-streamer.h:819
struct lto_out_decl_state * decl_state
Definition lto-streamer.h:795
hash_table< string_slot_hasher > * string_hash_table
Definition lto-streamer.h:808
symtab_node * symbol
Definition lto-streamer.h:812
unsigned current_linemap_id
Definition lto-streamer.h:820
struct streamer_tree_cache_d * writer_cache
Definition lto-streamer.h:823
struct lto_output_stream * main_stream
Definition lto-streamer.h:798
Definition lto-streamer.h:623
ld_plugin_symbol_resolution_t res
Definition lto-streamer.h:624
unsigned index
Definition lto-streamer.h:625
Definition tree-streamer.h:47
Definition lto-streamer.h:760
static bool equal(const string_slot *, const string_slot *)
Definition lto-streamer.h:782
static hashval_t hash(const string_slot *)
Definition lto-streamer.h:769
Definition lto-streamer.h:751
int len
Definition lto-streamer.h:753
unsigned int slot_num
Definition lto-streamer.h:754
const char * s
Definition lto-streamer.h:752
Definition cgraph.h:133
Definition cgraph.h:110
Definition cgraph.h:2250
Definition vec.h:450
#define NULL
Definition system.h:55
#define gcc_assert(EXPR)
Definition system.h:758
#define true
Definition system.h:831
#define false
Definition system.h:832
#define STATIC_ASSERT(X)
Definition system.h:808
@ MAX_TREE_CODES
Definition tree-core.h:157
#define NUM_TREE_CODES
Definition tree-core.h:164
#define TREE_CODE(NODE)
Definition tree.h:327
#define NULL_TREE
Definition tree.h:320