This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: Add new heuristic for structure aliasing, don't create duplicate SFT's
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Daniel Berlin <dberlin at dberlin dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 6 Apr 2005 13:24:19 -0400
- Subject: Re: [PATCH]: Add new heuristic for structure aliasing, don't create duplicate SFT's
- Organization: Red Hat Canada
- References: <1112141355.4767.55.camel@linux.site> <1112149232.4767.71.camel@linux.site>
On Tue, Mar 29, 2005 at 09:20:31PM -0500, Daniel Berlin wrote:
> Okay for mainline if it succeeds?
>
The patch seems to be malformed. Would you send me a new
version? Some comments, though:
> 2005-03-29 Daniel Berlin <dberlin@dberlin.org>
>
> * params.def (PARAM_SALIAS_MAX_IMPLICIT_FIELDS): New
> * params.h (SALIAS_MAX_IMPLICIT_FIELDS): New
> * doc/invoke.texi: Documnet salias-max-implicit-fields.
s/Documnet/Document/
> --- params.def 23 Mar 2005 19:09:57 -0000 1.56
> +++ params.def 29 Mar 2005 23:44:28 -0000
> @@ -35,6 +35,14 @@ Software Foundation, 59 Temple Place - S
>
> Be sure to add an entry to invoke.texi summarizing the parameter. */
>
> +/* The maximum number of fields in a variable with only implicit uses
> + for which structure aliasing will consider trying to track each
> + field. The default is 5. */
>
I'd add more details about what 'implict uses' means in this
context.
> @@ -2837,25 +2904,36 @@ create_overlap_variables_for (tree var)
> }
> /* Otherwise, create the variables. */
> subvars = lookup_subvars_for_var (var);
> - up = used_portions[uid];
>
> + qsort (VEC_address (fieldoff_t, fieldstack),
> + VEC_length (fieldoff_t, fieldstack),
> + sizeof (fieldoff_t),
> + fieldoff_compare);
> +
> while (VEC_length (fieldoff_t, fieldstack) != 0)
> {
> - subvar_t sv = ggc_alloc (sizeof (struct subvar));
> + subvar_t sv;
> HOST_WIDE_INT fosize;
> var_ann_t ann;
>
> fo = VEC_pop (fieldoff_t, fieldstack);
> fosize = TREE_INT_CST_LOW (DECL_SIZE (fo->field));
>
> - if ((fo->offset <= up->minused
> - && fo->offset + fosize <= up->minused)
> - || fo->offset >= up->maxused)
> + /* If this field isn't in the used portion,
> + or it has the exact same offset and size as the last
> + field, skip it. */
> +
> + if (((fo->offset <= up->minused
> + && fo->offset + fosize <= up->minused)
> + || fo->offset >= up->maxused)
> + || (fo->offset == lastfooffset
> + && fosize == lastfosize
> + && currfotype == lastfotype))
>
Where is currfotype declared and initialized? This is the
addition to avoid merging fields of different types?
> @table @gcctabopt
> +@item salias-max-implicit-fields
> +The maximum number of fields in a variable with only implicit uses
> +for which structure aliasing will consider trying to track each
> +field. The default is 5
>
Similar comment. Add more details about implicit vs explicit
uses and why it affects the heuristic.
Thanks. Diego.