From: Richard Sandiford Date: Mon, 30 Sep 2019 16:20:48 +0000 (+0000) Subject: Remove global call sets: haifa-sched.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7450506b5d48642a71459cfc24efcea6ca58e97e;p=gcc.git Remove global call sets: haifa-sched.c 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 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1b1c31cf009..12129b611f4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-09-30 Richard Sandiford + + * 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 * gcse.c: Include function-abi.h. diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index dba3acf3096..73380502e71 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -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]; + } } } }