aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-07-22 09:34:32 +0200
committerMartin Liska <marxin@gcc.gnu.org>2019-07-22 07:34:32 +0000
commitd1caf05a899bb57d1a96acd4869890991dedca20 (patch)
tree6b31f36652cb64bc8ed425701a2b3d8cab17aa82
parent2df89b66f1b397c9eacd2078eb6a9b52c2c4853f (diff)
downloadgcc-d1caf05a899bb57d1a96acd4869890991dedca20.zip
gcc-d1caf05a899bb57d1a96acd4869890991dedca20.tar.gz
gcc-d1caf05a899bb57d1a96acd4869890991dedca20.tar.bz2
Simplify LTO section format.
2019-07-22 Martin Liska <mliska@suse.cz> * lto-section-in.c (lto_get_section_data): Use new function get_compression. * lto-streamer-out.c (produce_lto_section): Use set_compression to encode compression algorithm. * lto-streamer.h (struct lto_section): Do not use bitfields in the format. From-SVN: r273661
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/lto-section-in.c3
-rw-r--r--gcc/lto-streamer-out.c3
-rw-r--r--gcc/lto-streamer.h19
4 files changed, 29 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ae03a33..528432f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,14 @@
2019-07-22 Martin Liska <mliska@suse.cz>
+ * lto-section-in.c (lto_get_section_data):
+ Use new function get_compression.
+ * lto-streamer-out.c (produce_lto_section): Use
+ set_compression to encode compression algorithm.
+ * lto-streamer.h (struct lto_section): Do not
+ use bitfields in the format.
+
+2019-07-22 Martin Liska <mliska@suse.cz>
+
PR driver/91172
* opts-common.c (decode_cmdline_option): Decode
argument of -Werror and check it for a wrong language.
diff --git a/gcc/lto-section-in.c b/gcc/lto-section-in.c
index 4c28701..0bdcf62 100644
--- a/gcc/lto-section-in.c
+++ b/gcc/lto-section-in.c
@@ -161,7 +161,8 @@ lto_get_section_data (struct lto_file_decl_data *file_data,
stream = lto_start_uncompression (lto_append_data, &buffer);
lto_uncompress_block (stream, data, *len);
- lto_end_uncompression (stream, file_data->lto_section_header.compression);
+ lto_end_uncompression (stream,
+ file_data->lto_section_header.get_compression ());
*len = buffer.length - header_length;
data = buffer.data + header_length;
diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c
index 35dcae4..e0881cf5 100644
--- a/gcc/lto-streamer-out.c
+++ b/gcc/lto-streamer-out.c
@@ -2403,7 +2403,8 @@ produce_lto_section ()
bool slim_object = flag_generate_lto && !flag_fat_lto_objects;
lto_section s
- = { LTO_major_version, LTO_minor_version, slim_object, compression, 0 };
+ = { LTO_major_version, LTO_minor_version, slim_object, 0 };
+ s.set_compression (compression);
lto_write_data (&s, sizeof s);
lto_end_section ();
destroy_output_block (ob);
diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index 3c35d8a..bf755a6 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -394,9 +394,22 @@ struct lto_section
{
int16_t major_version;
int16_t minor_version;
- unsigned char slim_object: 1;
- lto_compression compression: 4;
- int32_t reserved0: 27;
+ unsigned char slim_object;
+
+ /* Flags is a private field that is not defined publicly. */
+ uint16_t flags;
+
+ /* Set compression to FLAGS. */
+ inline void set_compression (lto_compression c)
+ {
+ flags = c;
+ }
+
+ /* Get compression from FLAGS. */
+ inline lto_compression get_compression ()
+ {
+ return (lto_compression) flags;
+ }
};
STATIC_ASSERT (sizeof (lto_section) == 8);