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: [lto][patch] Merge variable alignments and fix failure to load bodies of static functions


On Wed, Jul 2, 2008 at 19:44, Bill Maddox <maddox@google.com> wrote:

> +  /* Stash the name away in case it is a static that must
> +     be renamed below.  We use the original assembler name
> +     to find the section with the IR for the function body.  */
> +  decl->decl_with_vis.original_assembler_name =
> +    decl->decl_with_vis.assembler_name;
> +

Why not put it on a side-table or even on DECL's cgraph node?
If this is not serialized, it does not need to live in
tree_decl_with_vis.

The problem is that this affects all the VAR_DECLs and we create
a good number of these, so the impact on memory size can be
significant.

> +/* Compute the least common multiple of A and B.  */
> +
> +static unsigned
> +lto_least_common_multiple (unsigned a, unsigned b)
> +{
> +  unsigned x, y, save;
> +
> +  gcc_assert (a != 0 && b != 0);
> +
> +  /* Compute GCD (a, b) by Euclid's algorithm.  */
> +  x = a;
> +  y = b;
> +  while (y != 0)
> +    {
> +      save = y;
> +      y = x % y;
> +      x = save;
> +    }
> +
> +  /* x == GCD (a, b) */
> +
> +  return (a * b) / x;
> +}

You can use lambda.h:gcd()

>
>  /* Common helper function for merging variable and function declarations.  */
>  static tree
> @@ -398,12 +419,16 @@ lto_symtab_merge_decl (tree new_decl)
>  	  return error_mark_node;
>  	}
>      }
> +#if 0
> +  /* We may want a warning here, but we will allow the merge anyway,
> +     adjusting the alignment to the most restrictive common alignment.  */

What about we error when both DECL_ALIGNs are set and different?
If either DECL_ALIGN is not set or set to the natural alignment
for the type, then we allow the merging without warning.


Diego.


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