From: Roger Sayle Date: Tue, 30 Nov 2004 04:34:21 +0000 (+0000) Subject: re PR rtl-optimization/9771 ([x86] wrong ebp optimisation) X-Git-Tag: releases/gcc-3.3.6~215 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=018d83e88a4aa43c58946cd7c96d65f23442b19d;p=thirdparty%2Fgcc.git re PR rtl-optimization/9771 ([x86] wrong ebp optimisation) PR rtl-optimization/9771 * regclass.c (CALL_REALLY_USED_REGNO_P): New macro to eliminate conditional compilation in init_reg_sets_1. (init_reg_sets_1): Let global_regs[i] take priority over the frame (but not stack) pointer exceptions to regs_invalidated_by_call. (globalize_reg): Globalizing a fixed register may need to update regs_invalidated_by_call. * gcc.dg/pr9771-1.c: New test case. From-SVN: r91512 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8882add1203b..87e607bb90eb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2004-11-29 Roger Sayle + + PR rtl-optimization/9771 + * regclass.c (CALL_REALLY_USED_REGNO_P): New macro to eliminate + conditional compilation in init_reg_sets_1. + (init_reg_sets_1): Let global_regs[i] take priority over the frame + (but not stack) pointer exceptions to regs_invalidated_by_call. + (globalize_reg): Globalizing a fixed register may need to update + regs_invalidated_by_call. + 2004-11-27 Falk Hueffner Eric Botcazou diff --git a/gcc/regclass.c b/gcc/regclass.c index ecc630f42da3..e3a8963a594a 100644 --- a/gcc/regclass.c +++ b/gcc/regclass.c @@ -105,6 +105,13 @@ static const char initial_call_used_regs[] = CALL_USED_REGISTERS; char call_really_used_regs[] = CALL_REALLY_USED_REGISTERS; #endif +#ifdef CALL_REALLY_USED_REGISTERS +#define CALL_REALLY_USED_REGNO_P(X) call_really_used_regs[X] +#else +#define CALL_REALLY_USED_REGNO_P(X) call_used_regs[X] +#endif + + /* Indexed by hard register number, contains 1 for registers that are fixed use or call used registers that cannot hold quantities across calls even if we are willing to save and restore them. call fixed @@ -447,7 +454,11 @@ init_reg_sets_1 () If we are generating PIC code, the PIC offset table register is preserved across calls, though the target can override that. */ - if (i == STACK_POINTER_REGNUM || i == FRAME_POINTER_REGNUM) + if (i == STACK_POINTER_REGNUM) + ; + else if (global_regs[i]) + SET_HARD_REG_BIT (regs_invalidated_by_call, i); + else if (i == FRAME_POINTER_REGNUM) ; #if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM else if (i == HARD_FRAME_POINTER_REGNUM) @@ -461,13 +472,7 @@ init_reg_sets_1 () else if (i == PIC_OFFSET_TABLE_REGNUM && fixed_regs[i]) ; #endif - else if (0 -#ifdef CALL_REALLY_USED_REGISTERS - || call_really_used_regs[i] -#else - || call_used_regs[i] -#endif - || global_regs[i]) + else if (CALL_REALLY_USED_REGNO_P (i)) SET_HARD_REG_BIT (regs_invalidated_by_call, i); } @@ -792,6 +797,12 @@ globalize_reg (i) global_regs[i] = 1; + /* If we're globalizing the frame pointer, we need to set the + appropriate regs_invalidated_by_call bit, even if it's already + set in fixed_regs. */ + if (i != STACK_POINTER_REGNUM) + SET_HARD_REG_BIT (regs_invalidated_by_call, i); + /* If already fixed, nothing else to do. */ if (fixed_regs[i]) return; @@ -802,7 +813,6 @@ globalize_reg (i) SET_HARD_REG_BIT (fixed_reg_set, i); SET_HARD_REG_BIT (call_used_reg_set, i); SET_HARD_REG_BIT (call_fixed_reg_set, i); - SET_HARD_REG_BIT (regs_invalidated_by_call, i); } /* Now the data and code for the `regclass' pass, which happens diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 91388bf269df..f04ee9b535e8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-11-29 Roger Sayle + + PR rtl-optimization/9771 + * gcc.dg/pr9771-1.c: New test case. + 2004-11-27 Falk Hueffner * gcc.dg/loop-6.c: New test.