This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix caller-save.c:add_used_regs_1 handling of pseudos
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 23 Feb 2014 21:14:51 +0000
- Subject: Fix caller-save.c:add_used_regs_1 handling of pseudos
- Authentication-results: sourceware.org; auth=none
I noticed in passing that this 4.7 cleanup:
http://article.gmane.org/gmane.comp.gcc.patches/224853
changed caller-save.c:add_used_regs_1 from:
if (REG_P (x))
{
regno = REGNO (x);
if (!HARD_REGISTER_NUM_P (regno))
regno = reg_renumber[regno];
if (regno >= 0)
for (i = hard_regno_nregs[regno][GET_MODE (x)] - 1; i >= 0; i--)
SET_REGNO_REG_SET (live, regno + i);
}
return 0;
to:
if (REG_P (x))
{
regno = REGNO (x);
if (HARD_REGISTER_NUM_P (regno))
bitmap_set_range (live, regno, hard_regno_nregs[regno][GET_MODE (x)]);
else
regno = reg_renumber[regno];
}
return 0;
so that nothing happens for pseudos. I've no idea whether this makes
a difference in practice or not but it seems safer to restore the old
behaviour.
Tested on mipsisa64-sde-elf rather than x86_64-linux-gnu since it only
affects reload targets. OK to install?
Thanks,
Richard
gcc/
* caller-save.c (add_used_regs_1): Fix handling of pseudos.
Index: gcc/caller-save.c
===================================================================
--- gcc/caller-save.c 2014-01-02 22:16:03.383281697 +0000
+++ gcc/caller-save.c 2014-02-23 11:04:27.519785327 +0000
@@ -1339,7 +1339,7 @@ insert_save (struct insn_chain *chain, i
static int
add_used_regs_1 (rtx *loc, void *data)
{
- unsigned int regno;
+ int regno;
regset live;
rtx x;
@@ -1348,10 +1348,10 @@ add_used_regs_1 (rtx *loc, void *data)
if (REG_P (x))
{
regno = REGNO (x);
- if (HARD_REGISTER_NUM_P (regno))
- bitmap_set_range (live, regno, hard_regno_nregs[regno][GET_MODE (x)]);
- else
+ if (!HARD_REGISTER_NUM_P (regno))
regno = reg_renumber[regno];
+ if (regno >= 0)
+ bitmap_set_range (live, regno, hard_regno_nregs[regno][GET_MODE (x)]);
}
return 0;
}