23 #ifndef GCC_LTO_STREAMER_H
24 #define GCC_LTO_STREAMER_H
26 #include "plugin-api.h"
143 #define LTO_SECTION_NAME_PREFIX ".gnu.lto_"
145 #define LTO_major_version 2
146 #define LTO_minor_version 2
278 #define DEFINE_DECL_STREAM_FUNCS(UPPER_NAME, name) \
280 lto_file_decl_data_get_ ## name (struct lto_file_decl_data *data, \
283 struct lto_in_decl_state *state = data->current_decl_state; \
284 gcc_assert (idx < state->streams[LTO_DECL_STREAM_## UPPER_NAME].size); \
285 return state->streams[LTO_DECL_STREAM_## UPPER_NAME].trees[idx]; \
288 static inline unsigned int \
289 lto_file_decl_data_num_ ## name ## s (struct lto_file_decl_data *data) \
291 struct lto_in_decl_state *state = data->current_decl_state; \
292 return state->streams[LTO_DECL_STREAM_## UPPER_NAME].size; \
324 #define LTO_INIT_INPUT_BLOCK(BASE,D,P,L) \
331 #define LTO_INIT_INPUT_BLOCK_PTR(BASE,D,P,L) \
438 unsigned int in_partition:1;
444 unsigned int initializer:1;
544 lto_symtab_encoder_t
GTY((skip)) symtab_node_encoder;
550 const
char *
GTY((skip)) file_name;
553 htab_t
GTY((skip)) section_hash_table;
556 htab_t
GTY((skip)) renaming_hash_table;
646 static inline hashval_t hash (
const value_type *);
656 hashval_t r = ds->
len;
659 for (i = 0; i < ds->
len; i++)
660 r = r * 67 + (
unsigned)ds->
s[i] - 113;
670 return memcmp (ds1->
s, ds2->
s, ds1->
len) == 0;
751 enum lto_section_type,
const char **,
size_t *);
754 enum lto_section_type,
761 enum lto_section_type,
762 const char *,
size_t *);
764 enum lto_section_type,
765 const char *,
const char *,
size_t);
768 const char *,
const char *);
790 tree,
unsigned int *);
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
841 const char *,
unsigned,
847 struct function *,
enum LTO_tags);
851 unsigned *,
unsigned *);
853 enum LTO_tags, hashval_t hash);
865 struct lto_out_decl_state *);
867 struct lto_output_stream *,
868 struct lto_out_decl_state *);
889 lto_symtab_encoder_t);
891 lto_symtab_encoder_t);
893 lto_symtab_encoder_t);
895 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];
1036 return DECL_NONLOCAL (label) || FORCED_LABEL (label);
1043 return encoder->
nodes.length ();
1047 #define LCC_NOT_FOUND (-1)
1057 return (slot && *slot ? (
size_t) *(slot) - 1 : LCC_NOT_FOUND);
1100 if (ref == LCC_NOT_FOUND)
1103 return encoder->
nodes[ref].node;
1147 && (!is_a <cgraph_node> (
lsei_node (*lsei))
1160 if (!is_a <cgraph_node> (
lsei_node (lsei))
1173 && (!is_a <varpool_node> (
lsei_node (*lsei))
1186 if (!is_a <varpool_node> (
lsei_node (lsei))
1193 DEFINE_DECL_STREAM_FUNCS (TYPE,
type)
1194 DEFINE_DECL_STREAM_FUNCS (FIELD_DECL, field_decl)
1195 DEFINE_DECL_STREAM_FUNCS (FN_DECL, fn_decl)
1196 DEFINE_DECL_STREAM_FUNCS (VAR_DECL, var_decl)
1197 DEFINE_DECL_STREAM_FUNCS (TYPE_DECL, type_decl)
1198 DEFINE_DECL_STREAM_FUNCS (NAMESPACE_DECL, namespace_decl)
1199 DEFINE_DECL_STREAM_FUNCS (LABEL_DECL, label_decl)