aboutsummaryrefslogtreecommitdiff
path: root/gcc/lra-spills.c
diff options
context:
space:
mode:
authorVladimir N. Makarov <vmakarov@redhat.com>2020-10-30 15:05:22 -0400
committerVladimir N. Makarov <vmakarov@redhat.com>2020-10-30 15:08:23 -0400
commit44fbc9c6e02ca5b8f98f25b514ed7588e7ba733d (patch)
treecb3a5a5e1fbd03203fd0a2842a6ffca63195bc51 /gcc/lra-spills.c
parentbdf6524bc0bfa0908a7a7c52e799dbecbebaefe8 (diff)
downloadgcc-44fbc9c6e02ca5b8f98f25b514ed7588e7ba733d.zip
gcc-44fbc9c6e02ca5b8f98f25b514ed7588e7ba733d.tar.gz
gcc-44fbc9c6e02ca5b8f98f25b514ed7588e7ba733d.tar.bz2
Take insn scratch RA requirements into account in IRA.
The patch changes insn scratches which require registers for all insn alternatives (in other words w/o X constraint in scratch constraint string). This is done before IRA staring its work. LRA still continue to change the rest scratches (with X constraint and in insn created during IRA) into pseudos. As before the patch at the end of LRA work, spilled scratch pseudos (for which X constraint was chosen) changed into scratches back. gcc/ChangeLog: * lra.c (get_scratch_reg): New function. (remove_scratches_1): Rename remove_insn_scratches. Use ira_remove_insn_scratches and get_scratch_reg. (remove_scratches): Do not initialize scratches, scratch_bitmap, and scratch_operand_bitmap. (lra): Call ira_restore_scratches instead of restore_scratches. (struct sloc, sloc_t, scratches, scratch_bitmap) (scratch_operand_bitmap, lra_former_scratch_p) (lra_former_scratch_operand_p, lra_register_new_scratch_op) (restore_scratches): Move them to ... * ira.c: ... here. (former_scratch_p, former_scratch_operand_p): Rename to ira_former_scratch_p and ira_former_scratch_operand_p. (contains_X_constraint_p): New function. (register_new_scratch_op): Rename to ira_register_new_scratch_op. Change it to work for IRA and LRA. (restore_scratches): Rename to ira_restore_scratches. (get_scratch_reg, ira_remove_insn_scratches): New functions. (ira): Call ira_remove_scratches if we use LRA. * ira.h (ira_former_scratch_p, ira_former_scratch_operand_p): New prototypes. (ira_register_new_scratch_op, ira_restore_scratches): New prototypes. (ira_remove_insn_scratches): New prototype. * lra-int.h (lra_former_scratch_p, lra_former_scratch_operand_p): Remove prototypes. (lra_register_new_scratch_op): Ditto. * lra-constraints.c: Rename lra_former_scratch_p and lra_former_scratch_p to ira_former_scratch_p and to ira_former_scratch_p. * lra-remat.c: Ditto. * lra-spills.c: Rename lra_former_scratch_p to ira_former_scratch_p.
Diffstat (limited to 'gcc/lra-spills.c')
-rw-r--r--gcc/lra-spills.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c
index 0caa4ac..8082a5b 100644
--- a/gcc/lra-spills.c
+++ b/gcc/lra-spills.c
@@ -446,7 +446,7 @@ remove_pseudos (rtx *loc, rtx_insn *insn)
it might result in an address reload for some targets. In
any case we transform such pseudos not getting hard registers
into scratches back. */
- && ! lra_former_scratch_p (i))
+ && ! ira_former_scratch_p (i))
{
if (lra_reg_info[i].nrefs == 0
&& pseudo_slots[i].mem == NULL && spill_hard_reg[i] == NULL)
@@ -494,7 +494,7 @@ spill_pseudos (void)
for (i = FIRST_PSEUDO_REGISTER; i < regs_num; i++)
{
if (lra_reg_info[i].nrefs != 0 && lra_get_regno_hard_regno (i) < 0
- && ! lra_former_scratch_p (i))
+ && ! ira_former_scratch_p (i))
{
bitmap_set_bit (spilled_pseudos, i);
bitmap_ior_into (changed_insns, &lra_reg_info[i].insn_bitmap);
@@ -578,7 +578,7 @@ lra_need_for_scratch_reg_p (void)
for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
if (lra_reg_info[i].nrefs != 0 && lra_get_regno_hard_regno (i) < 0
- && lra_former_scratch_p (i))
+ && ira_former_scratch_p (i))
return true;
return false;
}
@@ -591,7 +591,7 @@ lra_need_for_spills_p (void)
for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
if (lra_reg_info[i].nrefs != 0 && lra_get_regno_hard_regno (i) < 0
- && ! lra_former_scratch_p (i))
+ && ! ira_former_scratch_p (i))
return true;
return false;
}
@@ -612,7 +612,7 @@ lra_spill (void)
for (n = 0, i = FIRST_PSEUDO_REGISTER; i < regs_num; i++)
if (lra_reg_info[i].nrefs != 0 && lra_get_regno_hard_regno (i) < 0
/* We do not want to assign memory for former scratches. */
- && ! lra_former_scratch_p (i))
+ && ! ira_former_scratch_p (i))
pseudo_regnos[n++] = i;
lra_assert (n > 0);
pseudo_slots = XNEWVEC (struct pseudo_slot, regs_num);