/* Data structures and declarations used for reading and writing
GIMPLE to a file stream.
- Copyright (C) 2009-2015 Free Software Foundation, Inc.
+ Copyright (C) 2009-2018 Free Software Foundation, Inc.
Contributed by Doug Kwan <dougkwan@google.com>
This file is part of GCC.
#define GCC_LTO_STREAMER_H
#include "plugin-api.h"
-#include "target.h"
-#include "alloc-pool.h"
#include "gcov-io.h"
#include "diagnostic.h"
-/* Define when debugging the LTO streamer. This causes the writer
- to output the numeric value for the memory address of the tree node
- being emitted. When debugging a problem in the reader, check the
- original address that the writer was emitting using lto_orig_address_get.
- With this value, set a breakpoint in the writer (e.g., lto_output_tree)
- to trace how the faulty node is being emitted. */
-/* #define LTO_STREAMER_DEBUG 1 */
-
/* The encoding for a function consists of the following sections:
1) The header.
String are represented in the table as pairs, a length in ULEB128
form followed by the data for the string. */
-#define LTO_major_version 4
-#define LTO_minor_version 0
+#define LTO_major_version 7
+#define LTO_minor_version 2
typedef unsigned char lto_decl_flags_t;
/* EH region holding the previous statement. */
LTO_eh_region,
- /* An MD or NORMAL builtin. Only the code and class are streamed out. */
- LTO_builtin_decl,
-
/* Shared INTEGER_CST node. */
LTO_integer_cst,
LTO_section_symtab_nodes,
LTO_section_opts,
LTO_section_cgraph_opt_sum,
- LTO_section_inline_summary,
+ LTO_section_ipa_fn_summary,
LTO_section_ipcp_transform,
LTO_section_ipa_icf,
LTO_section_offload_table,
LTO_section_mode_table,
+ LTO_section_ipa_hsa,
LTO_N_SECTION_TYPES /* Must be last. */
};
struct data_in *data_in);
lto_location_cache ()
: loc_cache (), accepted_length (0), current_file (NULL), current_line (0),
- current_col (0), current_loc (UNKNOWN_LOCATION)
+ current_col (0), current_sysp (false), current_loc (UNKNOWN_LOCATION)
{
gcc_assert (!current_cache);
current_cache = this;
const char *file;
location_t *loc;
int line, col;
+ bool sysp;
};
/* The location cache. */
const char *current_file;
int current_line;
int current_col;
+ bool current_sysp;
location_t current_loc;
};
struct lto_simple_header_with_strings : lto_simple_header
{
- /* Size of main gimple body of function. */
- int32_t main_size;
-
/* Size of the string table. */
int32_t string_size;
};
/* If this in-decl state is associated with a function. FN_DECL
point to the FUNCTION_DECL. */
tree fn_decl;
+
+ /* True if decl state is compressed. */
+ bool compressed;
};
typedef struct lto_in_decl_state *lto_in_decl_state_ptr;
/* If this out-decl state belongs to a function, fn_decl points to that
function. Otherwise, it is NULL. */
tree fn_decl;
+
+ /* True if decl state is compressed. */
+ bool compressed;
};
typedef struct lto_out_decl_state *lto_out_decl_state_ptr;
const char *current_file;
int current_line;
int current_col;
+ bool current_sysp;
/* Cache of nodes written in this section. */
struct streamer_tree_cache_d *writer_cache;
extern struct lto_file_decl_data **lto_get_file_decl_data (void);
extern const char *lto_get_section_data (struct lto_file_decl_data *,
enum lto_section_type,
- const char *, size_t *);
+ const char *, size_t *,
+ bool decompress = false);
+extern const char *lto_get_raw_section_data (struct lto_file_decl_data *,
+ enum lto_section_type,
+ const char *, size_t *);
extern void lto_free_section_data (struct lto_file_decl_data *,
- enum lto_section_type,
- const char *, const char *, size_t);
+ enum lto_section_type,
+ const char *, const char *, size_t,
+ bool decompress = false);
+extern void lto_free_raw_section_data (struct lto_file_decl_data *,
+ enum lto_section_type,
+ const char *, const char *, size_t);
extern htab_t lto_create_renaming_table (void);
extern void lto_record_renamed_decl (struct lto_file_decl_data *,
const char *, const char *);
extern void lto_begin_section (const char *, bool);
extern void lto_end_section (void);
extern void lto_write_data (const void *, unsigned int);
+extern void lto_write_raw_data (const void *, unsigned int);
extern void lto_write_stream (struct lto_output_stream *);
extern bool lto_output_decl_index (struct lto_output_stream *,
struct lto_tree_ref_encoder *,
extern void print_lto_report (const char *);
extern void lto_streamer_init (void);
extern bool gate_lto_out (void);
-#ifdef LTO_STREAMER_DEBUG
-extern void lto_orig_address_map (tree, intptr_t);
-extern intptr_t lto_orig_address_get (tree);
-extern void lto_orig_address_remove (tree);
-#endif
-extern void lto_check_version (int, int);
+extern void lto_check_version (int, int, const char *);
extern void lto_streamer_hooks_init (void);
/* In lto-streamer-in.c */
void output_symtab (void);
void input_symtab (void);
void output_offload_tables (void);
-void input_offload_tables (void);
+void input_offload_tables (bool);
bool referenced_from_other_partition_p (struct ipa_ref_list *,
lto_symtab_encoder_t);
bool reachable_from_other_partition_p (struct cgraph_node *,
void cl_optimization_stream_in (struct bitpack_d *, struct cl_optimization *);
-/* In lto-symtab.c. */
-extern void lto_symtab_merge_decls (void);
-extern void lto_symtab_merge_symbols (void);
-extern tree lto_symtab_prevailing_decl (tree decl);
-
/* In lto-opts.c. */
extern void lto_write_options (void);
DEFINE_DECL_STREAM_FUNCS (NAMESPACE_DECL, namespace_decl)
DEFINE_DECL_STREAM_FUNCS (LABEL_DECL, label_decl)
+/* Entry for the delayed registering of decl -> DIE references. */
+struct dref_entry {
+ tree decl;
+ const char *sym;
+ unsigned HOST_WIDE_INT off;
+};
+
+extern vec<dref_entry> dref_queue;
+
+
#endif /* GCC_LTO_STREAMER_H */