This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Add a new option "-ftree-bitfield-merge" (patch / doc inside)
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Zoran Jovanovic <Zoran dot Jovanovic at imgtec dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Petar Jovanovic <Petar dot Jovanovic at imgtec dot com>
- Date: Wed, 17 Jul 2013 21:17:40 +0000
- Subject: Re: [PATCH] Add a new option "-ftree-bitfield-merge" (patch / doc inside)
- References: <386B40EC5E8DBF459FD11A754D868AD922E31112 at BADAG02 dot ba dot imgtec dot org>
On Wed, 17 Jul 2013, Zoran Jovanovic wrote:
> This patch adds new optimization pass that combines several adjacent bit
> field accesses that copy values from one memory location to another into
> single bit field access.
Could you clarify if this works correctly in the presence of unions? That
is, if the sequence of bit-fields being read from overlaps with the
sequence written to (but no individual store involves a write overlapping
with a read), whether because they are in the same structure or because
they are in structures appropriately overlaid with unions, the semantics
of the sequence of loads and stores is preserved (which may not be the
same as a simple copy)? There should be comprehensive testcases added to
the testsuite covering different variations on this issue.
> +Enable bit field merge on trees
"bit-field", see codingconventions.html (this applies to both --help text
and Texinfo documentation).
> + Copyright (C) 2004, 2005, 2007, 2008, 2009, 2010, 2011
> + Free Software Foundation, Inc.
<year>-2013 (all on one line).
> +field_type (const_tree decl);
> +expressions_equal_p (tree e1, tree e2);
> +field_byte_offset (const_tree decl);
> +unsigned HOST_WIDE_INT
> +simple_type_size_in_bits (const_tree type);
Never include such non-static declarations in a .c file; include the
appropriate header for the declarations instead. Try to use static
forward declarations only if needed because of recursion (otherwise
topologically sort the functions in the source file).
Joseph S. Myers