OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa-coalesce.c
index 867e15c..776e9e0 100644 (file)
@@ -1,5 +1,5 @@
 /* Coalesce SSA_NAMES together for the out-of-ssa pass.
-   Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
+   Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
    Contributed by Andrew MacLeod <amacleod@redhat.com>
 
@@ -25,13 +25,13 @@ along with GCC; see the file COPYING3.  If not see
 #include "tm.h"
 #include "tree.h"
 #include "flags.h"
-#include "diagnostic.h"
+#include "tree-pretty-print.h"
 #include "bitmap.h"
 #include "tree-flow.h"
 #include "hashtab.h"
 #include "tree-dump.h"
 #include "tree-ssa-live.h"
-#include "toplev.h"
+#include "diagnostic-core.h"
 
 
 /* This set of routines implements a coalesce_list.  This is an object which
@@ -242,8 +242,7 @@ delete_coalesce_list (coalesce_list_p cl)
 {
   gcc_assert (cl->cost_one_list == NULL);
   htab_delete (cl->list);
-  if (cl->sorted)
-    free (cl->sorted);
+  free (cl->sorted);
   gcc_assert (cl->num_sorted == 0);
   free (cl);
 }
@@ -256,7 +255,7 @@ delete_coalesce_list (coalesce_list_p cl)
 static coalesce_pair_p
 find_coalesce_pair (coalesce_list_p cl, int p1, int p2, bool create)
 {
-  struct coalesce_pair p, *pair;
+  struct coalesce_pair p;
   void **slot;
   unsigned int hash;
 
@@ -272,22 +271,23 @@ find_coalesce_pair (coalesce_list_p cl, int p1, int p2, bool create)
       p.second_element = p2;
     }
 
-
   hash = coalesce_pair_map_hash (&p);
-  pair = (struct coalesce_pair *) htab_find_with_hash (cl->list, &p, hash);
+  slot = htab_find_slot_with_hash (cl->list, &p, hash,
+                                  create ? INSERT : NO_INSERT);
+  if (!slot)
+    return NULL;
 
-  if (create && !pair)
+  if (!*slot)
     {
+      struct coalesce_pair * pair = XNEW (struct coalesce_pair);
       gcc_assert (cl->sorted == NULL);
-      pair = XNEW (struct coalesce_pair);
       pair->first_element = p.first_element;
       pair->second_element = p.second_element;
       pair->cost = 0;
-      slot = htab_find_slot_with_hash (cl->list, pair, hash, INSERT);
-      *(struct coalesce_pair **)slot = pair;
+      *slot = (void *)pair;
     }
 
-  return pair;
+  return (struct coalesce_pair *) *slot;
 }
 
 static inline void
@@ -545,11 +545,9 @@ ssa_conflicts_test_p (ssa_conflicts_p ptr, unsigned x, unsigned y)
 {
   bitmap b;
 
-#ifdef ENABLE_CHECKING
-  gcc_assert (x < ptr->size);
-  gcc_assert (y < ptr->size);
-  gcc_assert (x != y);
-#endif
+  gcc_checking_assert (x < ptr->size);
+  gcc_checking_assert (y < ptr->size);
+  gcc_checking_assert (x != y);
 
   b = ptr->conflicts[x];
   if (b)
@@ -577,11 +575,9 @@ ssa_conflicts_add_one (ssa_conflicts_p ptr, unsigned x, unsigned y)
 static inline void
 ssa_conflicts_add (ssa_conflicts_p ptr, unsigned x, unsigned y)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (x < ptr->size);
-  gcc_assert (y < ptr->size);
-  gcc_assert (x != y);
-#endif
+  gcc_checking_assert (x < ptr->size);
+  gcc_checking_assert (y < ptr->size);
+  gcc_checking_assert (x != y);
   ssa_conflicts_add_one (ptr, x, y);
   ssa_conflicts_add_one (ptr, y, x);
 }
@@ -723,11 +719,8 @@ live_track_add_partition (live_track_p ptr, int partition)
   root = basevar_index (ptr->map, partition);
   /* If this base var wasn't live before, it is now.  Clear the element list
      since it was delayed until needed.  */
-  if (!bitmap_bit_p (ptr->live_base_var, root))
-    {
-      bitmap_set_bit (ptr->live_base_var, root);
-      bitmap_clear (ptr->live_base_partitions[root]);
-    }
+  if (bitmap_set_bit (ptr->live_base_var, root))
+    bitmap_clear (ptr->live_base_partitions[root]);
   bitmap_set_bit (ptr->live_base_partitions[root], partition);
 
 }
@@ -1379,7 +1372,7 @@ coalesce_ssa_name (void)
 
          if (a
              && SSA_NAME_VAR (a)
-             && !DECL_ARTIFICIAL (SSA_NAME_VAR (a))
+             && !DECL_IGNORED_P (SSA_NAME_VAR (a))
              && (!has_zero_uses (a) || !SSA_NAME_IS_DEFAULT_DEF (a)))
            {
              tree *slot = (tree *) htab_find_slot (ssa_name_hash, a, INSERT);