[Ada] constrained discriminated records and SRA

Martin Jambor mjambor@suse.cz
Thu Oct 22 10:51:00 GMT 2009


Hi Eric,

On Fri, Oct 16, 2009 at 08:58:13AM +0200, Eric Botcazou wrote:
> > Martin, this should make it possible to get rid of
> >
> > 	  /* Some ADA records are half-unions, treat all of them the same.  */
> > 	  for (fld = TYPE_FIELDS (type); fld; fld = TREE_CHAIN (fld))
> >
> > and the associated special handling in the new SRA pass.
> 

sorry for replying so late.  The reason for this comment was that
originally I handled unions and records differently, recursing only
for unions and picking the right fields and looping for records.  This
did not work because of overlapping fields in records that Ada
produced.  I am happy to learn that is not happening any more,
however, I am not sure that splitting the code paths again now is
worth the effort as the overhead is not probably going to be that big
and shared code paths are also good from the maintenance point of
view.

So my suggestion would be to remove the whole comment, or replace it
with something saying that if looking up stuff in records is deemed
too slow in future, we should be able to simplify it now.

Thanks,

Martin

> I've installed the attached patchlet.
> 
> 
> 2009-10-16  Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	* tree-sra.c (build_ref_for_offset_1): Update comment.
> 
> 
> -- 
> Eric Botcazou

> Index: tree-sra.c
> ===================================================================
> --- tree-sra.c	(revision 152797)
> +++ tree-sra.c	(working copy)
> @@ -1231,7 +1231,8 @@ build_ref_for_offset_1 (tree *res, tree 
>  	case UNION_TYPE:
>  	case QUAL_UNION_TYPE:
>  	case RECORD_TYPE:
> -	  /* Some ADA records are half-unions, treat all of them the same.  */
> +	  /* ??? Some records used to be half-unions in Ada so the code treats
> +	     the 3 container types the same.  This has been fixed in Ada.  */
>  	  for (fld = TYPE_FIELDS (type); fld; fld = TREE_CHAIN (fld))
>  	    {
>  	      HOST_WIDE_INT pos, size;



More information about the Gcc-patches mailing list