From d1caf05a899bb57d1a96acd4869890991dedca20 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 22 Jul 2019 09:34:32 +0200 Subject: [PATCH] Simplify LTO section format. 2019-07-22 Martin Liska * 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 --- gcc/ChangeLog | 9 +++++++++ gcc/lto-section-in.c | 3 ++- gcc/lto-streamer-out.c | 3 ++- gcc/lto-streamer.h | 19 ++++++++++++++++--- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ae03a33dd4e..528432f7b8b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2019-07-22 Martin Liska + + * 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 PR driver/91172 diff --git a/gcc/lto-section-in.c b/gcc/lto-section-in.c index 4c2870176ae..0bdcf62b1de 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 35dcae4d589..e0881cf57af 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 3c35d8a3f9a..bf755a64141 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);