re PR target/65697 (__atomic memory barriers not strong enough for __sync builtins)
[gcc.git] / gcc / df-problems.c
index 3f4aacd20f56f55c19a2a408af81888195c3e25e..a34578157ae13c4811a9d7a71f07f65e4bda30f1 100644 (file)
@@ -29,12 +29,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tm_p.h"
 #include "insn-config.h"
 #include "recog.h"
-#include "hashtab.h"
-#include "hash-set.h"
-#include "vec.h"
-#include "machmode.h"
 #include "hard-reg-set.h"
-#include "input.h"
 #include "function.h"
 #include "regs.h"
 #include "alloc-pool.h"
@@ -933,12 +928,11 @@ df_lr_local_compute (bitmap all_blocks ATTRIBUTE_UNUSED)
         reference of the frame pointer.  */
       bitmap_set_bit (&df->hardware_regs_used, FRAME_POINTER_REGNUM);
 
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
       /* Pseudos with argument area equivalences may require
         reloading via the argument pointer.  */
-      if (fixed_regs[ARG_POINTER_REGNUM])
+      if (FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
+         && fixed_regs[ARG_POINTER_REGNUM])
        bitmap_set_bit (&df->hardware_regs_used, ARG_POINTER_REGNUM);
-#endif
 
       /* Any constant, or pseudo with constant equivalences, may
         require reloading from memory using the pic register.  */
@@ -1880,7 +1874,7 @@ struct df_link *
 df_chain_create (df_ref src, df_ref dst)
 {
   struct df_link *head = DF_REF_CHAIN (src);
-  struct df_link *link = (struct df_link *) pool_alloc (df_chain->block_pool);
+  struct df_link *link = df_chain->block_pool->allocate ();
 
   DF_REF_CHAIN (src) = link;
   link->next = head;
@@ -1905,7 +1899,7 @@ df_chain_unlink_1 (df_ref ref, df_ref target)
            prev->next = chain->next;
          else
            DF_REF_CHAIN (ref) = chain->next;
-         pool_free (df_chain->block_pool, chain);
+         df_chain->block_pool->remove (chain);
          return;
        }
       prev = chain;
@@ -1925,7 +1919,7 @@ df_chain_unlink (df_ref ref)
       struct df_link *next = chain->next;
       /* Delete the other side if it exists.  */
       df_chain_unlink_1 (chain->ref, ref);
-      pool_free (df_chain->block_pool, chain);
+      df_chain->block_pool->remove (chain);
       chain = next;
     }
   DF_REF_CHAIN (ref) = NULL;
@@ -1957,7 +1951,7 @@ df_chain_remove_problem (void)
 
   /* Wholesale destruction of the old chains.  */
   if (df_chain->block_pool)
-    free_alloc_pool (df_chain->block_pool);
+    delete df_chain->block_pool;
 
   EXECUTE_IF_SET_IN_BITMAP (df_chain->out_of_date_transfer_functions, 0, bb_index, bi)
     {
@@ -2011,8 +2005,8 @@ static void
 df_chain_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
 {
   df_chain_remove_problem ();
-  df_chain->block_pool = create_alloc_pool ("df_chain_block pool",
-                                        sizeof (struct df_link), 50);
+  df_chain->block_pool = new pool_allocator<df_link> ("df_chain_block pool",
+                                                     50);
   df_chain->optional_p = true;
 }
 
@@ -2147,7 +2141,7 @@ df_chain_finalize (bitmap all_blocks)
 static void
 df_chain_free (void)
 {
-  free_alloc_pool (df_chain->block_pool);
+  delete df_chain->block_pool;
   BITMAP_FREE (df_chain->out_of_date_transfer_functions);
   free (df_chain);
 }
@@ -2864,7 +2858,7 @@ df_remove_dead_eq_notes (rtx_insn *insn, bitmap live)
 /* Set a NOTE_TYPE note for REG in INSN.  */
 
 static inline void
-df_set_note (enum reg_note note_type, rtx insn, rtx reg)
+df_set_note (enum reg_note note_type, rtx_insn *insn, rtx reg)
 {
   gcc_checking_assert (!DEBUG_INSN_P (insn));
   add_reg_note (insn, note_type, reg);
@@ -3574,12 +3568,7 @@ df_simulate_one_insn_forwards (basic_block bb, rtx_insn *insn, bitmap live)
        case REG_UNUSED:
          {
            rtx reg = XEXP (link, 0);
-           int regno = REGNO (reg);
-           if (HARD_REGISTER_NUM_P (regno))
-             bitmap_clear_range (live, regno,
-                                 hard_regno_nregs[regno][GET_MODE (reg)]);
-           else
-             bitmap_clear_bit (live, regno);
+           bitmap_clear_range (live, REGNO (reg), REG_NREGS (reg));
          }
          break;
        default:
@@ -3597,7 +3586,7 @@ df_simulate_one_insn_forwards (basic_block bb, rtx_insn *insn, bitmap live)
 /* Return an OR of MEMREF_NORMAL or MEMREF_VOLATILE for the MEMs in X.  */
 
 static int
-find_memory (rtx insn)
+find_memory (rtx_insn *insn)
 {
   int flags = 0;
   subrtx_iterator::array_type array;
@@ -3820,9 +3809,7 @@ can_move_insns_across (rtx_insn *from, rtx_insn *to,
          if (bitmap_intersect_p (merge_set, test_use)
              || bitmap_intersect_p (merge_use, test_set))
            break;
-#ifdef HAVE_cc0
-         if (!sets_cc0_p (insn))
-#endif
+         if (!HAVE_cc0 || !sets_cc0_p (insn))
            max_to = insn;
        }
       next = NEXT_INSN (insn);
@@ -3861,10 +3848,7 @@ can_move_insns_across (rtx_insn *from, rtx_insn *to,
       if (NONDEBUG_INSN_P (insn))
        {
          if (!bitmap_intersect_p (test_set, local_merge_live)
-#ifdef HAVE_cc0
-             && !sets_cc0_p (insn)
-#endif
-             )
+             && (!HAVE_cc0 || !sets_cc0_p (insn)))
            {
              max_to = insn;
              break;