summaryrefslogtreecommitdiff
path: root/gcc/lto-streamer.h
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2014-08-08 12:55:31 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2014-08-08 12:55:31 +0000
commit207c68cd616b7739870933158e976881d1b2438e (patch)
tree37a2deb9dfd8703ab2605b7c559b3f67621fb4ff /gcc/lto-streamer.h
parent07165dd72cbaa49420a6033b7a3d5e1e8a1c8a5b (diff)
downloadgcc-207c68cd616b7739870933158e976881d1b2438e.tar.gz
lto-streamer.h (struct lto_input_block): Make it a class with a constructor.
2014-08-08 Richard Biener <rguenther@suse.de> * lto-streamer.h (struct lto_input_block): Make it a class with a constructor. (LTO_INIT_INPUT_BLOCK, LTO_INIT_INPUT_BLOCK_PTR): Remove. (struct lto_function_header, struct lto_simple_header, struct lto_simple_header_with_strings, struct lto_decl_header, struct lto_function_header): Make a simple inheritance hieararchy. Remove unused fields. (struct lto_asm_header): Remove. * lto-streamer-out.c (produce_asm): Adjust. (lto_output_toplevel_asms): Likewise. (produce_asm_for_decls): Likewise. * lto-section-out.c (lto_destroy_simple_output_block): Likewise. * data-streamer-in.c (string_for_index): Likewise. * ipa-inline-analysis.c (inline_read_section): Likewise. * ipa-prop.c (ipa_prop_read_section): Likewise. (read_replacements_section): Likewise. * lto-cgraph.c (input_cgraph_opt_section): Likewise. * lto-section-in.c (lto_create_simple_input_block): Likewise. (lto_destroy_simple_input_block): Likewise. * lto-streamer-in.c (lto_read_body_or_constructor): Likewise. (lto_input_toplevel_asms): Likewise. lto/ * lto.c (lto_read_decls): Adjust for lto_input_block changes. From-SVN: r213759
Diffstat (limited to 'gcc/lto-streamer.h')
-rw-r--r--gcc/lto-streamer.h100
1 files changed, 25 insertions, 75 deletions
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index 9f89a6c7ed6..67bbfe0ffde 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -307,27 +307,21 @@ typedef void (lto_free_section_data_f) (struct lto_file_decl_data *,
size_t);
/* Structure used as buffer for reading an LTO file. */
-struct lto_input_block
+class lto_input_block
{
+public:
+ /* Special constructor for the string table, it abuses this to
+ do random access but use the uhwi decoder. */
+ lto_input_block (const char *data_, unsigned int p_, unsigned int len_)
+ : data (data_), p (p_), len (len_) {}
+ lto_input_block (const char *data_, unsigned int len_)
+ : data (data_), p (0), len (len_) {}
+
const char *data;
unsigned int p;
unsigned int len;
};
-#define LTO_INIT_INPUT_BLOCK(BASE,D,P,L) \
- do { \
- BASE.data = D; \
- BASE.p = P; \
- BASE.len = L; \
- } while (0)
-
-#define LTO_INIT_INPUT_BLOCK_PTR(BASE,D,P,L) \
- do { \
- BASE->data = D; \
- BASE->p = P; \
- BASE->len = L; \
- } while (0)
-
/* The is the first part of the record for a function or constructor
in the .o file. */
@@ -337,27 +331,16 @@ struct lto_header
int16_t minor_version;
};
-/* The header for a function body. */
-struct lto_function_header
+/* The is the first part of the record in an LTO file for many of the
+ IPA passes. */
+struct lto_simple_header : lto_header
{
- /* The header for all types of sections. */
- struct lto_header lto_header;
-
- /* Number of labels with names. */
- int32_t num_named_labels;
-
- /* Number of labels without names. */
- int32_t num_unnamed_labels;
-
- /* Size compressed or 0 if not compressed. */
- int32_t compressed_size;
-
- /* Size of names for named labels. */
- int32_t named_label_size;
-
- /* Size of the cfg. */
- int32_t cfg_size;
+ /* Size of main gimple body of function. */
+ int32_t main_size;
+};
+struct lto_simple_header_with_strings : lto_simple_header
+{
/* Size of main gimple body of function. */
int32_t main_size;
@@ -365,41 +348,22 @@ struct lto_function_header
int32_t string_size;
};
+/* The header for a function body. */
+struct lto_function_header : lto_simple_header_with_strings
+{
+ /* Size of the cfg. */
+ int32_t cfg_size;
+};
+
/* Structure describing a symbol section. */
-struct lto_decl_header
+struct lto_decl_header : lto_simple_header_with_strings
{
- /* The header for all types of sections. */
- struct lto_header lto_header;
-
/* Size of region for decl state. */
int32_t decl_state_size;
/* Number of nodes in globals stream. */
int32_t num_nodes;
-
- /* Size of region for expressions, decls, types, etc. */
- int32_t main_size;
-
- /* Size of the string table. */
- int32_t string_size;
-};
-
-
-/* Structure describing top level asm()s. */
-struct lto_asm_header
-{
- /* The header for all types of sections. */
- struct lto_header lto_header;
-
- /* Size compressed or 0 if not compressed. */
- int32_t compressed_size;
-
- /* Size of region for expressions, decls, types, etc. */
- int32_t main_size;
-
- /* Size of the string table. */
- int32_t string_size;
};
@@ -595,20 +559,6 @@ struct lto_output_stream
unsigned int total_size;
};
-/* The is the first part of the record in an LTO file for many of the
- IPA passes. */
-struct lto_simple_header
-{
- /* The header for all types of sections. */
- struct lto_header lto_header;
-
- /* Size of main gimple body of function. */
- int32_t main_size;
-
- /* Size of main stream when compressed. */
- int32_t compressed_size;
-};
-
/* A simple output block. This can be used for simple IPA passes that
do not need more than one stream. */
struct lto_simple_output_block