Remove no_caller_save_reg_set
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 10 Sep 2019 18:56:31 +0000 (18:56 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 10 Sep 2019 18:56:31 +0000 (18:56 +0000)
Reusing the reasoning from the call_fixed_reg_set patch:

  for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
    for (j = 1; j <= MOVE_MAX_WORDS; j++)
      if (reg_save_code (i,regno_save_mode[i][j]) == -1)

should be true whenever regno_save_mode[i][j] == VOIDmode,
which it is for:

  ~call_used_reg_set | ~have_save_mode

So this condition amounts to:

  ~call_used_reg_set | ~have_save_mode | ~have_save_insn
  == ~call_used_reg_set | ~savable_regs

no_caller_save_reg_set is then set if call_used_regs[i], so
no_caller_save_reg_set is:

  call_used_reg_set & (~call_used_reg_set | ~savable_regs)
  == call_used_reg_set & ~savable_regs

This patch expands its single user accordingly.

Note that ~savable_regs is always empty on LRA targets.

2019-09-10  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* hard-reg-set.h (target_hard_regs::x_no_caller_save_reg_set): Delete.
(no_caller_save_reg_set): Delete.
* caller-save.c (init_caller_save): Don't initialize it.
* ira-conflicts.c (ira_build_conflicts): Calculate
no_caller_save_reg_set locally from call_used_reg_set and savable_regs.

From-SVN: r275599

gcc/ChangeLog
gcc/caller-save.c
gcc/hard-reg-set.h
gcc/ira-conflicts.c

index aee319088f76d35bdc23902b749ec11804962d6f..7c6d9ea29c6425e63778de621a8aa4331cfd1708 100644 (file)
@@ -1,3 +1,11 @@
+2019-09-10  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * hard-reg-set.h (target_hard_regs::x_no_caller_save_reg_set): Delete.
+       (no_caller_save_reg_set): Delete.
+       * caller-save.c (init_caller_save): Don't initialize it.
+       * ira-conflicts.c (ira_build_conflicts): Calculate
+       no_caller_save_reg_set locally from call_used_reg_set and savable_regs.
+
 2019-09-10  Richard Sandiford  <richard.sandiford@arm.com>
 
        * hard-reg-set.h (target_hard_regs::x_call_fixed_reg_set): Delete.
index 05fbc4421e1adb1cb961b62c18286bd500f89fb8..58ea14f653e78c129d255a26e42442f514fcdbae 100644 (file)
@@ -192,7 +192,6 @@ init_caller_save (void)
 
   caller_save_initialized_p = true;
 
-  CLEAR_HARD_REG_SET (no_caller_save_reg_set);
   /* First find all the registers that we need to deal with and all
      the modes that they can have.  If we can't find a mode to use,
      we can't have the register live over calls.  */
@@ -264,11 +263,7 @@ init_caller_save (void)
        {
          regno_save_mode[i][j] = VOIDmode;
          if (j == 1)
-           {
-             CLEAR_HARD_REG_BIT (savable_regs, i);
-             if (call_used_regs[i])
-               SET_HARD_REG_BIT (no_caller_save_reg_set, i);
-           }
+           CLEAR_HARD_REG_BIT (savable_regs, i);
        }
 }
 
index 4c8da3a7ac8deacf847635e11a76fddf22be74da..945e49966643a1a7996708eb53ff10e3f6eaeb61 100644 (file)
@@ -424,10 +424,6 @@ struct target_hard_regs {
      with the local stack frame are safe, but scant others.  */
   HARD_REG_SET x_regs_invalidated_by_call;
 
-  /* Call used hard registers which cannot be saved because there is no
-     insn for this.  */
-  HARD_REG_SET x_no_caller_save_reg_set;
-
   /* Table of register numbers in the order in which to try to use them.  */
   int x_reg_alloc_order[FIRST_PSEUDO_REGISTER];
 
@@ -490,8 +486,6 @@ extern struct target_hard_regs *this_target_hard_regs;
   (this_target_hard_regs->x_savable_regs)
 #define regs_invalidated_by_call \
   (this_target_hard_regs->x_regs_invalidated_by_call)
-#define no_caller_save_reg_set \
-  (this_target_hard_regs->x_no_caller_save_reg_set)
 #define reg_alloc_order \
   (this_target_hard_regs->x_reg_alloc_order)
 #define inv_reg_alloc_order \
index ac8014afb9239dd4220ff998c5a105c57d965f88..430c6a6f0791c734c5cc8b8e32da1f69f4c570c1 100644 (file)
@@ -765,6 +765,8 @@ ira_build_conflicts (void)
            }
          else if (ALLOCNO_CALLS_CROSSED_NUM (a) != 0)
            {
+             HARD_REG_SET no_caller_save_reg_set
+               = (call_used_reg_set & ~savable_regs);
              OBJECT_TOTAL_CONFLICT_HARD_REGS (obj) |= no_caller_save_reg_set;
              OBJECT_TOTAL_CONFLICT_HARD_REGS (obj) |= temp_hard_reg_set;
              OBJECT_CONFLICT_HARD_REGS (obj) |= no_caller_save_reg_set;