From 472ca566f917ce9aadb3950b5e65cc212fcbbb0b Mon Sep 17 00:00:00 2001 From: rguenth Date: Fri, 8 Aug 2014 12:55:31 +0000 Subject: 2014-08-08 Richard Biener * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213759 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/lto-streamer.h | 100 ++++++++++++++--------------------------------------- 1 file changed, 25 insertions(+), 75 deletions(-) (limited to 'gcc/lto-streamer.h') 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 -- cgit v1.2.1