Remove global call sets: haifa-sched.c
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 30 Sep 2019 16:20:48 +0000 (16:20 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 30 Sep 2019 16:20:48 +0000 (16:20 +0000)
The code patched here is counting how many registers the current
function would need to save in the prologue before it uses them.
The code is called per function, so using crtl is OK.

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

gcc/
* haifa-sched.c: Include function-abi.h.
(alloc_global_sched_pressure_data): Use crtl->abi to check whether
the function would need to save a register before using it.

From-SVN: r276324

gcc/ChangeLog
gcc/haifa-sched.c

index 1b1c31cf009d9e2741f873726c19c6fc43c54785..12129b611f4718d076352cc398e73dae608500c8 100644 (file)
@@ -1,3 +1,9 @@
+2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * haifa-sched.c: Include function-abi.h.
+       (alloc_global_sched_pressure_data): Use crtl->abi to check whether
+       the function would need to save a register before using it.
+
 2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>
 
        * gcse.c: Include function-abi.h.
index dba3acf3096f5c67bce74f6a4eec3b7a2438aec3..73380502e71affc0c118588ec07552c369ab9ecb 100644 (file)
@@ -146,6 +146,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "cfgloop.h"
 #include "dumpfile.h"
 #include "print-rtl.h"
+#include "function-abi.h"
 
 #ifdef INSN_SCHEDULING
 
@@ -939,7 +940,8 @@ static bitmap tmp_bitmap;
 /* Effective number of available registers of a given class (see comment
    in sched_pressure_start_bb).  */
 static int sched_class_regs_num[N_REG_CLASSES];
-/* Number of call_saved_regs and fixed_regs.  Helpers for calculating of
+/* The number of registers that the function would need to save before it
+   uses them, and the number of fixed_regs.  Helpers for calculating of
    sched_class_regs_num.  */
 static int call_saved_regs_num[N_REG_CLASSES];
 static int fixed_regs_num[N_REG_CLASSES];
@@ -7207,10 +7209,13 @@ alloc_global_sched_pressure_data (void)
          fixed_regs_num[cl] = 0;
 
          for (int i = 0; i < ira_class_hard_regs_num[cl]; ++i)
-           if (!call_used_or_fixed_reg_p (ira_class_hard_regs[cl][i]))
-             ++call_saved_regs_num[cl];
-           else if (fixed_regs[ira_class_hard_regs[cl][i]])
-             ++fixed_regs_num[cl];
+           {
+             unsigned int regno = ira_class_hard_regs[cl][i];
+             if (fixed_regs[regno])
+               ++fixed_regs_num[cl];
+             else if (!crtl->abi->clobbers_full_reg_p (regno))
+               ++call_saved_regs_num[cl];
+           }
        }
     }
 }