[Ada] Improve generated code for records with rep clauses
Eric Botcazou
ebotcazou@adacore.com
Tue Jun 12 09:51:00 GMT 2018
This makes sure the handling of bit-fields is uniform in packed records or
records with representation clause.
Tested on x86-64/Linux, applied on mainline,
2018-06-12 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (variant_desc): Add AUX field.
(gnat_to_gnu_entity) <discrete_type>: Do not call compute_record_mode
directly.
(reverse_sort_field_list): New static function.
(components_to_record): Place the variant part at the beginning of the
field list when there is an obvious order of increasing position.
(build_variant_list): Initialize it.
(create_variant_part_from): Do not call compute_record_mode directly.
(copy_and_substitute_in_layout): Likewise. Always sort the fields with
fixed position in order of increasing position, in the record and all
the variants, in any. Call reverse_sort_field_list.
* gcc-interface/utils.c (make_packable_type): Compute the sizes before
calling finish_record_type. Do not call compute_record_mode directly.
(finish_record_type): Overhaul final processing depending on REP_LEVEL
and call finish_bitfield_layout if it is equal to one or two.
2018-06-12 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/opt72a.ad[sb]: New test.
* gnat.dg/opt72_pkg.ads: New helper.
--
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-patch
Size: 12497 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20180612/8e6310e2/attachment.bin>
More information about the Gcc-patches
mailing list