diff mbox series

[18/32] Remove global call sets: haifa-sched.c

Message ID mptd0g6wstr.fsf@arm.com
State New
Headers show
Series Support multiple ABIs in the same translation unit | expand

Commit Message

Richard Sandiford Sept. 11, 2019, 7:12 p.m. UTC
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-11  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.

Comments

Jeff Law Sept. 29, 2019, 9:11 p.m. UTC | #1
On 9/11/19 1:12 PM, Richard Sandiford wrote:
> 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-11  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.
> 
OK
jeff
diff mbox series

Patch

Index: gcc/haifa-sched.c
===================================================================
--- gcc/haifa-sched.c	2019-09-10 19:56:45.353177919 +0100
+++ gcc/haifa-sched.c	2019-09-11 19:48:27.281819692 +0100
@@ -146,6 +146,7 @@  Software Foundation; either version 3, o
 #include "cfgloop.h"
 #include "dumpfile.h"
 #include "print-rtl.h"
+#include "function-abi.h"
 
 #ifdef INSN_SCHEDULING
 
@@ -939,7 +940,8 @@  enum reg_class *sched_regno_pressure_cla
 /* 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];
+	    }
 	}
     }
 }