tree-ssa-live.h (coalesce_ssa_name): Move Prototype to...
authorAndrew MacLeod <amacleod@redhat.com>
Tue, 1 Oct 2013 16:23:52 +0000 (16:23 +0000)
committerAndrew Macleod <amacleod@gcc.gnu.org>
Tue, 1 Oct 2013 16:23:52 +0000 (16:23 +0000)
* 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.

From-SVN: r203069

gcc/ChangeLog
gcc/gimple.c
gcc/tree-outof-ssa.h
gcc/tree-ssa-coalesce.c
gcc/tree-ssa-coalesce.h [new file with mode: 0644]
gcc/tree-ssa-live.h

index 8764f0dd2f39506c7fbf5ddda1e0569cb459ba6c..8431db037261496f887ec068607a70863e81f8be 100644 (file)
@@ -1,3 +1,12 @@
+2013-10-01  Andrew MacLeod  <amacleod@redhat.com>
+
+       * 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.
+
 2013-10-01  Andrew MacLeod  <amacleod@redhat.com>
 
        * tree-into-ssa.c (enum need_phi_state): Relocate from tree-flow.h.
index a75604fdad4eb1e9f9f89cb7130b4acb27f8cfda..26c78c806b598745650f864a3015746765fb1f2e 100644 (file)
@@ -4380,4 +4380,42 @@ dump_decl_set (FILE *file, bitmap set)
     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"
index e44808e9f774e47f5a05e099a5007740c38eca34..8c37f55ce50c67102d1a0751e818ee7251631243 100644 (file)
@@ -23,6 +23,7 @@ along with GCC; see the file COPYING3.  If not see
 
 #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
index 087272fe13a7d0ce9a01433772b11ac4040ae539..2f5507ca8fcadaef8fe27010284a2c2fc9a23920 100644 (file)
@@ -29,7 +29,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "dumpfile.h"
 #include "tree-ssa.h"
 #include "hash-table.h"
-#include "tree-ssa-live.h"
+#include "tree-outof-ssa.h"
 #include "diagnostic-core.h"
 
 
@@ -1333,42 +1333,3 @@ coalesce_ssa_name (void)
 
   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;
-}
diff --git a/gcc/tree-ssa-coalesce.h b/gcc/tree-ssa-coalesce.h
new file mode 100644 (file)
index 0000000..6b2831f
--- /dev/null
@@ -0,0 +1,25 @@
+/* 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 */
index 542f6a1944e5f8173c76b940d55d467e9461a3ce..5d80d988711b4a51b5d8535b7f1ec9a5972866df 100644 (file)
@@ -321,8 +321,4 @@ make_live_on_entry (tree_live_info_p live, basic_block bb , int p)
   bitmap_set_bit (live->global, p);
 }
 
-
-/* From tree-ssa-coalesce.c  */
-extern var_map coalesce_ssa_name (void);
-
 #endif /* _TREE_SSA_LIVE_H  */