Patchwork Add tree-ssa-coalesce.h

login
register
mail settings
Submitter Andrew MacLeod
Date Sept. 30, 2013, 3:48 p.m.
Message ID <52499D51.4050502@redhat.com>
Download mbox | patch
Permalink /patch/279179/
State New
Headers show

Comments

Andrew MacLeod - Sept. 30, 2013, 3:48 p.m.
Move the prototype for coalesce_ssa_name() out of tree-ssa-live.h and 
put it in a new tree-ssa-coalesce.h file.
Include tree-ssa-coalesce.h from  tree-outof-ssa.h as it forms part of 
the out-of-ssa module.

Also move gimple_can_coalesce_p from tree-ssa-coalesce.c to gimple.h as 
it operates on gimple structures and is also used a couple of other 
places.  The prototype is already in gimple.h.

Bootstraps on build/x86_64-unknown-linux-gnu with no new regressions.   OK?

Andrew
Richard Guenther - Oct. 1, 2013, 8:04 a.m.
On Mon, Sep 30, 2013 at 5:48 PM, Andrew MacLeod <amacleod@redhat.com> wrote:
> Move the prototype for coalesce_ssa_name() out of tree-ssa-live.h and put it
> in a new tree-ssa-coalesce.h file.
> Include tree-ssa-coalesce.h from  tree-outof-ssa.h as it forms part of the
> out-of-ssa module.
>
> Also move gimple_can_coalesce_p from tree-ssa-coalesce.c to gimple.h as it
> operates on gimple structures and is also used a couple of other places.
> The prototype is already in gimple.h.
>
> Bootstraps on build/x86_64-unknown-linux-gnu with no new regressions.   OK?

Ok.

Thanks,
Richard.

> Andrew
>

Patch


	* tree-ssa-live.h (coalesce_ssa_name): Move Prototype to...
	* tree-ssa-coalesce.h: New. Move prototype to here.
	* tree-outof-ssa.h: Include tree-ssa-coalesce.h.
	* tree-ssa-coalesce.c: Include tree-outof-ssa.h.
	(gimple_can_coalesce_p): Move to...
	* gimple.c (gimple_can_coalesce_p): Here.

*** a1/tree-ssa-live.h	2013-09-30 10:52:14.833172626 -0400
--- tree-ssa-live.h	2013-09-30 11:10:59.161620552 -0400
*************** make_live_on_entry (tree_live_info_p liv
*** 321,328 ****
    bitmap_set_bit (live->global, p);
  }
  
- 
- /* From tree-ssa-coalesce.c  */
- extern var_map coalesce_ssa_name (void);
- 
  #endif /* _TREE_SSA_LIVE_H  */
--- 321,324 ----
*** a1/tree-ssa-coalesce.h	2013-09-30 11:22:12.566295821 -0400
--- tree-ssa-coalesce.h	2013-09-30 11:10:59.162614148 -0400
***************
*** 1 ****
--- 1,26 ----
+ /* Header file for tree-ssa-coalesce.c exports.
+    Copyright (C) 2013 Free Software Foundation, Inc.
  
+ This file is part of GCC.
+ 
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 3, or (at your option) any later
+ version.
+ 
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #ifndef GCC_TREE_SSA_COALESCE_H
+ #define GCC_TREE_SSA_COALESCE_H
+ 
+ extern var_map coalesce_ssa_name (void);
+ 
+ 
+ #endif /* GCC_TREE_SSA_COALESCE_H */
*** a1/tree-outof-ssa.h	2013-09-30 10:52:14.827173820 -0400
--- tree-outof-ssa.h	2013-09-30 11:10:59.163608763 -0400
*************** along with GCC; see the file COPYING3.  
*** 23,28 ****
--- 23,29 ----
  
  #include "tree-ssa-live.h"
  #include "tree-ssa-ter.h"
+ #include "tree-ssa-coalesce.h"
  
  /* This structure (of which only a singleton SA exists) is used to
     pass around information between the outof-SSA functions, cfgexpand
*** a1/tree-ssa-coalesce.c	2013-09-30 10:52:14.831172590 -0400
--- tree-ssa-coalesce.c	2013-09-30 11:14:41.572345761 -0400
*************** along with GCC; see the file COPYING3.  
*** 29,35 ****
  #include "dumpfile.h"
  #include "tree-ssa.h"
  #include "hash-table.h"
! #include "tree-ssa-live.h"
  #include "diagnostic-core.h"
  
  
--- 29,35 ----
  #include "dumpfile.h"
  #include "tree-ssa.h"
  #include "hash-table.h"
! #include "tree-outof-ssa.h"
  #include "diagnostic-core.h"
  
  
*************** coalesce_ssa_name (void)
*** 1333,1374 ****
  
    return map;
  }
- 
- /* Given SSA_NAMEs NAME1 and NAME2, return true if they are candidates for
-    coalescing together, false otherwise.
- 
-    This must stay consistent with var_map_base_init in tree-ssa-live.c.  */
- 
- bool
- gimple_can_coalesce_p (tree name1, tree name2)
- {
-   /* First check the SSA_NAME's associated DECL.  We only want to
-      coalesce if they have the same DECL or both have no associated DECL.  */
-   tree var1 = SSA_NAME_VAR (name1);
-   tree var2 = SSA_NAME_VAR (name2);
-   var1 = (var1 && (!VAR_P (var1) || !DECL_IGNORED_P (var1))) ? var1 : NULL_TREE;
-   var2 = (var2 && (!VAR_P (var2) || !DECL_IGNORED_P (var2))) ? var2 : NULL_TREE;
-   if (var1 != var2)
-     return false;
- 
-   /* Now check the types.  If the types are the same, then we should
-      try to coalesce V1 and V2.  */
-   tree t1 = TREE_TYPE (name1);
-   tree t2 = TREE_TYPE (name2);
-   if (t1 == t2)
-     return true;
- 
-   /* If the types are not the same, check for a canonical type match.  This
-      (for example) allows coalescing when the types are fundamentally the
-      same, but just have different names. 
- 
-      Note pointer types with different address spaces may have the same
-      canonical type.  Those are rejected for coalescing by the
-      types_compatible_p check.  */
-   if (TYPE_CANONICAL (t1)
-       && TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2)
-       && types_compatible_p (t1, t2))
-     return true;
- 
-   return false;
- }
--- 1333,1335 ----
*** a1/gimple.c	2013-09-30 10:52:14.721172704 -0400
--- gimple.c	2013-09-30 11:14:44.074494494 -0400
*************** dump_decl_set (FILE *file, bitmap set)
*** 4106,4109 ****
--- 4106,4147 ----
      fprintf (file, "NIL");
  }
  
+ /* Given SSA_NAMEs NAME1 and NAME2, return true if they are candidates for
+    coalescing together, false otherwise.
+ 
+    This must stay consistent with var_map_base_init in tree-ssa-live.c.  */
+ 
+ bool
+ gimple_can_coalesce_p (tree name1, tree name2)
+ {
+   /* First check the SSA_NAME's associated DECL.  We only want to
+      coalesce if they have the same DECL or both have no associated DECL.  */
+   tree var1 = SSA_NAME_VAR (name1);
+   tree var2 = SSA_NAME_VAR (name2);
+   var1 = (var1 && (!VAR_P (var1) || !DECL_IGNORED_P (var1))) ? var1 : NULL_TREE;
+   var2 = (var2 && (!VAR_P (var2) || !DECL_IGNORED_P (var2))) ? var2 : NULL_TREE;
+   if (var1 != var2)
+     return false;
+ 
+   /* Now check the types.  If the types are the same, then we should
+      try to coalesce V1 and V2.  */
+   tree t1 = TREE_TYPE (name1);
+   tree t2 = TREE_TYPE (name2);
+   if (t1 == t2)
+     return true;
+ 
+   /* If the types are not the same, check for a canonical type match.  This
+      (for example) allows coalescing when the types are fundamentally the
+      same, but just have different names. 
+ 
+      Note pointer types with different address spaces may have the same
+      canonical type.  Those are rejected for coalescing by the
+      types_compatible_p check.  */
+   if (TYPE_CANONICAL (t1)
+       && TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2)
+       && types_compatible_p (t1, t2))
+     return true;
+ 
+   return false;
+ }
  #include "gt-gimple.h"