On Wed, Feb 13, 2013 at 01:04:04PM +0100, Richard Biener wrote:
> 2013-02-13  Richard Biener  <rguent...@suse.de>
> 
>       PR lto/50494
>       * varasm.c (output_constant_def_1): Get the decl representing
>       the constant as argument.
>       (output_constant_def): Wrap output_constant_def_1.
>       (make_decl_rtl): Use output_constant_def_1 with the decl
>       representing the constant.
>       (build_constant_desc): Optionally re-use a decl already
>       representing the constant.
>       (tree_output_constant_def): Adjust.

Looks good to me, except formatting nit:

> + /* Like output_constant_def but create a new decl representing the
> +    constant if necessary.  */
> + 
> + rtx
> + output_constant_def (tree exp, int defer)
> + {
> +   return  output_constant_def_1  (exp, NULL_TREE, defer);

Twice too many spaces.

But I'd say we should also add some varasm.c function that
increase_alignment should call for
(TREE_CODE (decl) == VAR_DECL && DECL_IN_CONSTANT_POOL (decl))
vars upon increasing alignment of the decl, which would do something like:
void
adjust_const_pool_alignment (tree decl)
{
  struct constant_descriptor_tree *desc, key;

  gcc_assert (TREE_CODE (decl) == VAR_DECL && DECL_IN_CONSTANT_POOL (decl));
  key.value = DECL_INITIAL (decl);
  key.hash = const_hash_1 (DECL_INITIAL (decl));
  desc = (struct constant_descriptor_tree *)
         htab_find_with_hash (const_desc_htab, &key, key.hash);
  if (desc && MEM_P (desc) && MEM_ALIGN (desc->rtl) < DECL_ALIGN (decl))
    set_mem_align (desc->rtl, DECL_ALIGN (decl));
}
(completely untested).  Because, if we force the constant to be aligned
more than it would be by default, the RTL optimizers should be told about
that too.

        Jakub

Reply via email to