Patchwork [rfa] Set alignment of pseudos via get_pointer_alignment

login
register
mail settings
Submitter Michael Matz
Date Aug. 12, 2011, 4:04 p.m.
Message ID <Pine.LNX.4.64.1108121801340.23968@wotan.suse.de>
Download mbox | patch
Permalink /patch/109867/
State New
Headers show

Comments

Michael Matz - Aug. 12, 2011, 4:04 p.m.
Hi,

On Tue, 9 Aug 2011, Michael Matz wrote:

> > Are there any updates on the libada problem or other reasons why the 
> > patch cannot go in?
> 
> Nope, I've solved that one.  Letme update it.

Like so.  Regstrapped on x86_64-linux (all languages + Ada).  Okay for 
trunk?


Ciao,
Michael.
Richard Guenther - Aug. 12, 2011, 7:54 p.m.
On Fri, Aug 12, 2011 at 6:04 PM, Michael Matz <matz@suse.de> wrote:
> Hi,
>
> On Tue, 9 Aug 2011, Michael Matz wrote:
>
>> > Are there any updates on the libada problem or other reasons why the
>> > patch cannot go in?
>>
>> Nope, I've solved that one.  Letme update it.
>
> Like so.  Regstrapped on x86_64-linux (all languages + Ada).  Okay for
> trunk?

Ok.

Thanks,
Richard.

>
> Ciao,
> Michael.
> --
>        * cfgexpand.c (expand_one_register_var): Use get_pointer_alignment.
>        (gimple_expand_cfg): Merge alignment info for coalesced pointer
>        SSA names.
>
> Index: cfgexpand.c
> ===================================================================
> --- cfgexpand.c (revision 177696)
> +++ cfgexpand.c (working copy)
> @@ -909,7 +909,7 @@ expand_one_register_var (tree var)
>     mark_user_reg (x);
>
>   if (POINTER_TYPE_P (type))
> -    mark_reg_pointer (x, TYPE_ALIGN (TREE_TYPE (type)));
> +    mark_reg_pointer (x, get_pointer_alignment (var));
>  }
>
>  /* A subroutine of expand_one_var.  Called to assign rtl to a VAR_DECL that
> @@ -4265,6 +4265,31 @@ gimple_expand_cfg (void)
>        }
>     }
>
> +  /* If we have a class containing differently aligned pointers
> +     we need to merge those into the corresponding RTL pointer
> +     alignment.  */
> +  for (i = 1; i < num_ssa_names; i++)
> +    {
> +      tree name = ssa_name (i);
> +      int part;
> +      rtx r;
> +
> +      if (!name
> +         || !POINTER_TYPE_P (TREE_TYPE (name))
> +         /* We might have generated new SSA names in
> +            update_alias_info_with_stack_vars.  They will have a NULL
> +            defining statements, and won't be part of the partitioning,
> +            so ignore those.  */
> +         || !SSA_NAME_DEF_STMT (name))
> +       continue;
> +      part = var_to_partition (SA.map, name);
> +      if (part == NO_PARTITION)
> +       continue;
> +      r = SA.partition_to_pseudo[part];
> +      if (REG_P (r))
> +       mark_reg_pointer (r, get_pointer_alignment (name));
> +    }
> +
>   /* If this function is `main', emit a call to `__main'
>      to run global initializers, etc.  */
>   if (DECL_NAME (current_function_decl)
>
Michael Matz - Aug. 23, 2011, 2:39 p.m.
Hi,

> > Like so.  Regstrapped on x86_64-linux (all languages + Ada).  Okay for
> > trunk?
> 
> Ok.

r177989 (JFYI because it's some time ago to make searching the archives 
easier).


Ciao,
Michael.

Patch

Index: cfgexpand.c
===================================================================
--- cfgexpand.c	(revision 177696)
+++ cfgexpand.c	(working copy)
@@ -909,7 +909,7 @@  expand_one_register_var (tree var)
     mark_user_reg (x);
 
   if (POINTER_TYPE_P (type))
-    mark_reg_pointer (x, TYPE_ALIGN (TREE_TYPE (type)));
+    mark_reg_pointer (x, get_pointer_alignment (var));
 }
 
 /* A subroutine of expand_one_var.  Called to assign rtl to a VAR_DECL that
@@ -4265,6 +4265,31 @@  gimple_expand_cfg (void)
 	}
     }
 
+  /* If we have a class containing differently aligned pointers
+     we need to merge those into the corresponding RTL pointer
+     alignment.  */
+  for (i = 1; i < num_ssa_names; i++)
+    {
+      tree name = ssa_name (i);
+      int part;
+      rtx r;
+
+      if (!name
+	  || !POINTER_TYPE_P (TREE_TYPE (name))
+	  /* We might have generated new SSA names in
+	     update_alias_info_with_stack_vars.  They will have a NULL
+	     defining statements, and won't be part of the partitioning,
+	     so ignore those.  */
+	  || !SSA_NAME_DEF_STMT (name))
+	continue;
+      part = var_to_partition (SA.map, name);
+      if (part == NO_PARTITION)
+	continue;
+      r = SA.partition_to_pseudo[part];
+      if (REG_P (r))
+	mark_reg_pointer (r, get_pointer_alignment (name));
+    }
+
   /* If this function is `main', emit a call to `__main'
      to run global initializers, etc.  */
   if (DECL_NAME (current_function_decl)