re PR target/65697 (__atomic memory barriers not strong enough for __sync builtins)
[gcc.git] / gcc / ira.c
index 07d6c6951f2dcd28d7a824288a6fbe5b4740b67f..92d5eb11ed7c71ce682145db958805610f5319ab 100644 (file)
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -368,23 +368,16 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tm.h"
 #include "regs.h"
-#include "hash-set.h"
-#include "machmode.h"
-#include "vec.h"
-#include "double-int.h"
-#include "input.h"
 #include "alias.h"
 #include "symtab.h"
-#include "wide-int.h"
-#include "inchash.h"
 #include "tree.h"
+#include "hard-reg-set.h"
 #include "rtl.h"
 #include "tm_p.h"
 #include "target.h"
 #include "flags.h"
 #include "obstack.h"
 #include "bitmap.h"
-#include "hard-reg-set.h"
 #include "predict.h"
 #include "function.h"
 #include "dominance.h"
@@ -394,10 +387,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "cfgcleanup.h"
 #include "basic-block.h"
 #include "df.h"
-#include "hashtab.h"
-#include "statistics.h"
-#include "real.h"
-#include "fixed-value.h"
 #include "insn-config.h"
 #include "expmed.h"
 #include "dojump.h"
@@ -414,7 +403,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "except.h"
 #include "reload.h"
 #include "diagnostic-core.h"
-#include "ggc.h"
 #include "ira-int.h"
 #include "lra.h"
 #include "dce.h"
@@ -1767,8 +1755,8 @@ setup_prohibited_mode_move_regs (void)
   if (ira_prohibited_mode_move_regs_initialized_p)
     return;
   ira_prohibited_mode_move_regs_initialized_p = true;
-  test_reg1 = gen_rtx_REG (VOIDmode, 0);
-  test_reg2 = gen_rtx_REG (VOIDmode, 0);
+  test_reg1 = gen_rtx_REG (word_mode, LAST_VIRTUAL_REGISTER + 1);
+  test_reg2 = gen_rtx_REG (word_mode, LAST_VIRTUAL_REGISTER + 2);
   move_pat = gen_rtx_SET (test_reg1, test_reg2);
   move_insn = gen_rtx_INSN (VOIDmode, 0, 0, 0, move_pat, 0, -1, 0);
   for (i = 0; i < NUM_MACHINE_MODES; i++)
@@ -1778,10 +1766,8 @@ setup_prohibited_mode_move_regs (void)
        {
          if (! HARD_REGNO_MODE_OK (j, (machine_mode) i))
            continue;
-         SET_REGNO_RAW (test_reg1, j);
-         PUT_MODE (test_reg1, (machine_mode) i);
-         SET_REGNO_RAW (test_reg2, j);
-         PUT_MODE (test_reg2, (machine_mode) i);
+         set_mode_and_regno (test_reg1, (machine_mode) i, j);
+         set_mode_and_regno (test_reg2, (machine_mode) i, j);
          INSN_CODE (move_insn) = -1;
          recog_memoized (move_insn);
          if (INSN_CODE (move_insn) < 0)
@@ -1808,7 +1794,6 @@ ira_setup_alts (rtx_insn *insn, HARD_REG_SET &alts)
   int nop, nalt;
   bool curr_swapped;
   const char *p;
-  rtx op;
   int commutative = -1;
 
   extract_insn (insn);
@@ -1850,7 +1835,7 @@ ira_setup_alts (rtx_insn *insn, HARD_REG_SET &alts)
            {
              int c, len;
 
-             op = recog_data.operand[nop];
+             rtx op = recog_data.operand[nop];
              p = insn_constraints[nop * recog_data.n_alternatives + nalt];
              if (*p == 0 || *p == ',')
                continue;
@@ -1923,10 +1908,8 @@ ira_setup_alts (rtx_insn *insn, HARD_REG_SET &alts)
        break;
       if (curr_swapped)
        break;
-      op = recog_data.operand[commutative];
-      recog_data.operand[commutative] = recog_data.operand[commutative + 1];
-      recog_data.operand[commutative + 1] = op;
-
+      std::swap (recog_data.operand[commutative],
+                recog_data.operand[commutative + 1]);
     }
 }
 
@@ -4993,7 +4976,7 @@ split_live_ranges_for_shrink_wrap (void)
 
       if (newreg)
        {
-         rtx new_move = gen_move_insn (newreg, dest);
+         rtx_insn *new_move = gen_move_insn (newreg, dest);
          emit_insn_after (new_move, bb_note (call_dom));
          if (dump_file)
            {