summaryrefslogtreecommitdiff
path: root/gcc/global.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-01 05:29:03 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-01 05:29:03 +0000
commitd9903bcbbe19100d94f5dd9dcdb1a5276e7dfbe5 (patch)
tree51f172c784c1a0fb89978ba5eedd01b262b307a4 /gcc/global.c
parentef07ff3370aa4c7a31df6187583111c0e1b3b63a (diff)
downloadgcc-d9903bcbbe19100d94f5dd9dcdb1a5276e7dfbe5.tar.gz
PR rtl-optimization/23478
* local-alloc.c (struct qty): Add n_throwing_calls_crossed field. (alloc_qty): Initialize it. (update_equiv_regs): Clear REG_N_THROWING_CALLS_CROSSED. (combine_regs): Combine also n_throwing_calls_crossed fields. (find_free_reg): Don't attempt to caller-save pseudos crossing calls that might throw. * global.c (struct allocno): Add throwing_calls_crossed field. (global_alloc): Revert 2005-08-22 change. Initialize throwing_calls_crossed. (find_reg): Don't attempt to caller-save pseudos crossing calls that might throw. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103718 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/global.c')
-rw-r--r--gcc/global.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/global.c b/gcc/global.c
index f82cd08017a..d4e2b773559 100644
--- a/gcc/global.c
+++ b/gcc/global.c
@@ -97,6 +97,9 @@ struct allocno
/* Number of calls crossed by each allocno. */
int calls_crossed;
+ /* Number of calls that might throw crossed by each allocno. */
+ int throwing_calls_crossed;
+
/* Number of refs to each allocno. */
int n_refs;
@@ -465,9 +468,7 @@ global_alloc (FILE *file)
/* Don't allocate pseudos that cross calls,
if this function receives a nonlocal goto. */
&& (! current_function_has_nonlocal_label
- || REG_N_CALLS_CROSSED (i) == 0)
- /* Don't allocate pseudos that cross calls that may throw. */
- && REG_N_THROWING_CALLS_CROSSED (i) == 0)
+ || REG_N_CALLS_CROSSED (i) == 0))
{
if (reg_renumber[i] < 0
&& reg_may_share[i] && reg_allocno[reg_may_share[i]] >= 0)
@@ -488,6 +489,8 @@ global_alloc (FILE *file)
allocno[num].reg = i;
allocno[num].size = PSEUDO_REGNO_SIZE (i);
allocno[num].calls_crossed += REG_N_CALLS_CROSSED (i);
+ allocno[num].throwing_calls_crossed
+ += REG_N_THROWING_CALLS_CROSSED (i);
allocno[num].n_refs += REG_N_REFS (i);
allocno[num].freq += REG_FREQ (i);
if (allocno[num].live_length < REG_LIVE_LENGTH (i))
@@ -1207,9 +1210,11 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere
{
/* Did not find a register. If it would be profitable to
allocate a call-clobbered register and save and restore it
- around calls, do that. */
+ around calls, do that. Don't do this if it crosses any calls
+ that might throw. */
if (! accept_call_clobbered
&& allocno[num].calls_crossed != 0
+ && allocno[num].throwing_calls_crossed == 0
&& CALLER_SAVE_PROFITABLE (allocno[num].n_refs,
allocno[num].calls_crossed))
{