From 73dd5ce0c3b7d284d7ea9e6ee6f60b8ad4f9af3c Mon Sep 17 00:00:00 2001 From: Olivier Hainque Date: Wed, 20 Oct 2010 10:09:41 +0000 Subject: [PATCH] rs6000.c (rs6000_reg_live_or_pic_offset_p): If the current function calls eh_return... * config/rs6000/rs6000.c (rs6000_reg_live_or_pic_offset_p): If the current function calls eh_return, claim live all registers that we need to check for liveness otherwise. testsuite/ * gcc.target/powerpc (ehreturn.c): New test. From-SVN: r165715 --- gcc/ChangeLog | 6 ++++++ gcc/config/rs6000/rs6000.c | 7 ++++++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/powerpc/ehreturn.c | 15 +++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/ehreturn.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d1241cb..17cc226 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-10-20 Olivier Hainque + + * config/rs6000/rs6000.c (rs6000_reg_live_or_pic_offset_p): + If the current function calls eh_return, claim live all registers + that we need to check for liveness otherwise. + 2010-10-20 Nicola Pero * c-decl.c (c_write_global_declarations): Call diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 69c3969..9469d45 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -19690,7 +19690,12 @@ rs6000_make_savres_rtx (rs6000_stack_t *info, static bool rs6000_reg_live_or_pic_offset_p (int reg) { - return ((df_regs_ever_live_p (reg) + /* If the function calls eh_return, claim used all the registers that would + be checked for liveness otherwise. This is required for the PIC offset + register with -mminimal-toc on AIX, as it is advertised as "fixed" for + register allocation purposes in this case. */ + + return (((crtl->calls_eh_return || df_regs_ever_live_p (reg)) && (!call_used_regs[reg] || (reg == RS6000_PIC_OFFSET_TABLE_REGNUM && TARGET_TOC && TARGET_MINIMAL_TOC))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f777c3f..cd27045 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-10-20 Olivier Hainque + + * gcc.target/powerpc/ehreturn.c: New test. + 2010-10-20 Nicola Pero Merge from 'apple/trunk' branch on FSF servers. Test adapted to diff --git a/gcc/testsuite/gcc.target/powerpc/ehreturn.c b/gcc/testsuite/gcc.target/powerpc/ehreturn.c new file mode 100644 index 0000000..ff286f6 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/ehreturn.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mminimal-toc -mno-multiple" } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ + +void foo () +{ + long l; void *p; + volatile int x; + + __builtin_unwind_init (); + x = 12; + __builtin_eh_return (l, p); +} + +/* { dg-final { scan-assembler "st\\[wd\\] 30," } } */ -- 2.7.4