23 #ifndef GCC_LTO_STREAMER_H
24 #define GCC_LTO_STREAMER_H
26 #include "plugin-api.h"
141 #define LTO_SECTION_NAME_PREFIX ".gnu.lto_"
143 #define LTO_major_version 2
144 #define LTO_minor_version 2
276 #define DEFINE_DECL_STREAM_FUNCS(UPPER_NAME, name) \
278 lto_file_decl_data_get_ ## name (struct lto_file_decl_data *data, \
281 struct lto_in_decl_state *state = data->current_decl_state; \
282 gcc_assert (idx < state->streams[LTO_DECL_STREAM_## UPPER_NAME].size); \
283 return state->streams[LTO_DECL_STREAM_## UPPER_NAME].trees[idx]; \
286 static inline unsigned int \
287 lto_file_decl_data_num_ ## name ## s (struct lto_file_decl_data *data) \
289 struct lto_in_decl_state *state = data->current_decl_state; \
290 return state->streams[LTO_DECL_STREAM_## UPPER_NAME].size; \
322 #define LTO_INIT_INPUT_BLOCK(BASE,D,P,L) \
329 #define LTO_INIT_INPUT_BLOCK_PTR(BASE,D,P,L) \
436 unsigned int in_partition:1;
442 unsigned int initializer:1;
458 lto_symtab_encoder_t encoder;
469 tree * GTY((length (
"%h.size"))) trees;
508 lto_symtab_encoder_t symtab_node_encoder;
542 lto_symtab_encoder_t GTY((skip)) symtab_node_encoder;
548 const
char *GTY((skip)) file_name;
551 htab_t GTY((skip)) section_hash_table;
554 htab_t GTY((skip)) renaming_hash_table;
592 char * current_pointer;
595 unsigned int left_in_block;
598 unsigned int block_size;
601 unsigned int total_size;
615 int32_t compressed_size;
622 enum lto_section_type section_type;
635 unsigned int slot_num;
644 static inline hashval_t hash (
const value_type *);
645 static inline bool equal (
const value_type *,
const compare_type *);
654 hashval_t r = ds->len;
657 for (i = 0; i < ds->len; i++)
658 r = r * 67 + (
unsigned)ds->s[i] - 113;
667 if (ds1->len == ds2->len)
668 return memcmp (ds1->s, ds2->s, ds1->len) == 0;
677 enum lto_section_type section_type;
729 unsigned int strings_len;
733 unsigned int num_named_labels;
736 unsigned int num_unnamed_labels;
749 enum lto_section_type,
const char **,
size_t *);
752 enum lto_section_type,
759 enum lto_section_type,
760 const char *,
size_t *);
762 enum lto_section_type,
763 const char *,
const char *,
size_t);
766 const char *,
const char *);
792 struct lto_output_stream *,
tree);
794 struct lto_output_stream *, tree);
796 struct lto_output_stream *, tree);
798 struct lto_output_stream *, tree);
800 struct lto_output_stream *, tree);
802 struct lto_output_stream *, tree);
804 enum lto_section_type);
812 struct lto_out_decl_state *);
824 #ifdef LTO_STREAMER_DEBUG
842 const char *,
unsigned,
848 struct function *,
enum LTO_tags);
852 unsigned *,
unsigned *);
854 enum LTO_tags, hashval_t hash);
866 struct lto_out_decl_state *);
868 struct lto_output_stream *,
869 struct lto_out_decl_state *);
890 lto_symtab_encoder_t);
892 lto_symtab_encoder_t);
894 lto_symtab_encoder_t);
896 lto_symtab_encoder_t);
932 return (
unsigned) tag >= NUM_TREE_CODES + 2
939 static inline enum LTO_tags
942 return (
enum LTO_tags) ((unsigned) code + NUM_TREE_CODES + 2);
952 return (
enum gimple_code) ((unsigned) tag - NUM_TREE_CODES - 2);
958 static inline enum LTO_tags
961 return (
enum LTO_tags) ((unsigned) code + 2);
971 return (
enum tree_code) ((unsigned) tag - 2);
978 if (actual != expected)
988 if (actual < tag1 || actual > tag2)
989 internal_error (
"bytecode stream: tag %s is not in the expected range "
1001 encoder->
trees.create (0);
1013 encoder->
trees.release ();
1017 static inline unsigned int
1020 return encoder->
trees.length ();
1028 return encoder->
trees[idx];
1035 return encoder->
nodes.length ();
1039 #define LCC_NOT_FOUND (-1)
1049 return (slot && *slot ? (
size_t) *(slot) - 1 : LCC_NOT_FOUND);
1092 if (ref == LCC_NOT_FOUND)
1095 return encoder->
nodes[ref].node;
1139 && (!is_a <cgraph_node> (
lsei_node (*lsei))
1152 if (!is_a <cgraph_node> (
lsei_node (lsei))
1165 && (!is_a <varpool_node> (
lsei_node (*lsei))
1178 if (!is_a <varpool_node> (
lsei_node (lsei))
1185 DEFINE_DECL_STREAM_FUNCS (TYPE,
type)
1186 DEFINE_DECL_STREAM_FUNCS (FIELD_DECL, field_decl)
1187 DEFINE_DECL_STREAM_FUNCS (FN_DECL, fn_decl)
1188 DEFINE_DECL_STREAM_FUNCS (VAR_DECL, var_decl)
1189 DEFINE_DECL_STREAM_FUNCS (
TYPE_DECL, type_decl)
1190 DEFINE_DECL_STREAM_FUNCS (NAMESPACE_DECL, namespace_decl)
1191 DEFINE_DECL_STREAM_FUNCS (LABEL_DECL, label_decl)