re PR target/43700 (global register variables defect)

gcc/
	PR target/43700
	* config/mips/mips.c (mips_cfun_call_saved_reg_p): Handle global
	registers.

gcc/testsuite/
	* gcc.target/mips/reg-var-1.c: New test.

From-SVN: r174409
This commit is contained in:
Richard Sandiford 2011-05-29 18:10:44 +00:00 committed by Richard Sandiford
parent fafd89af06
commit 9855acf753
4 changed files with 27 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2011-05-29 Richard Sandiford <rdsandiford@googlemail.com>
PR target/43700
* config/mips/mips.c (mips_cfun_call_saved_reg_p): Handle global
registers.
2011-05-25 Uros Bizjak <ubizjak@gmail.com>
PR target/49133

View File

@ -8495,7 +8495,7 @@ mips_cfun_call_saved_reg_p (unsigned int regno)
property here. */
return (regno == GLOBAL_POINTER_REGNUM
? TARGET_CALL_SAVED_GP
: !call_really_used_regs[regno]);
: !global_regs[regno] && !call_really_used_regs[regno]);
}
/* Return true if the function body might clobber register REGNO.

View File

@ -1,3 +1,7 @@
2011-05-29 Richard Sandiford <rdsandiford@googlemail.com>
* gcc.target/mips/reg-var-1.c: New test.
2011-05-25 Uros Bizjak <ubizjak@gmail.com>
PR target/49133

View File

@ -0,0 +1,16 @@
/* { dg-do run } */
register int g asm ("$18");
void __attribute__((noinline))
test (void)
{
g = g + 1;
}
int
main (void)
{
g = 2;
test ();
return g != 3;
}