This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add a new option "-ftree-bitfield-merge" (patch / doc inside)


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).

> +tree
> +field_type (const_tree decl);
> +
> +bool
> +expressions_equal_p (tree e1, tree e2);
> +
> +HOST_WIDE_INT
> +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
joseph@codesourcery.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]