From 88bc3f54dd7d7bf57bbff92fb62346b022c5f9b1 Mon Sep 17 00:00:00 2001 From: davem Date: Thu, 23 May 2002 16:37:58 +0000 Subject: [PATCH] 2002-05-23 David S. Miller * cse.c (approx_reg_cost_1, approx_reg_cost): Recode to not use regsets. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53793 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/cse.c | 41 ++++++++++++++++++++--------------------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index be5370c4eae..f3ed28a0c2f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-05-23 David S. Miller + + * cse.c (approx_reg_cost_1, approx_reg_cost): Recode to not use + regsets. + 2002-05-23 Jason Thorpe * c-common.c (warn_nonnull): Declare. diff --git a/gcc/cse.c b/gcc/cse.c index 514ba406ab0..9cc048b85f0 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -720,10 +720,25 @@ approx_reg_cost_1 (xp, data) void *data; { rtx x = *xp; - regset set = (regset) data; + int *cost_p = data; if (x && GET_CODE (x) == REG) - SET_REGNO_REG_SET (set, REGNO (x)); + { + unsigned int regno = REGNO (x); + + if (! CHEAP_REGNO (regno)) + { + if (regno < FIRST_PSEUDO_REGISTER) + { + if (SMALL_REGISTER_CLASSES) + return 1; + *cost_p += 2; + } + else + *cost_p += 1; + } + } + return 0; } @@ -736,28 +751,12 @@ static int approx_reg_cost (x) rtx x; { - regset_head set; - int i; int cost = 0; - int hardregs = 0; - - INIT_REG_SET (&set); - for_each_rtx (&x, approx_reg_cost_1, (void *) &set); - - EXECUTE_IF_SET_IN_REG_SET - (&set, 0, i, - { - if (! CHEAP_REGNO (i)) - { - if (i < FIRST_PSEUDO_REGISTER) - hardregs++; - cost += i < FIRST_PSEUDO_REGISTER ? 2 : 1; - } - }); + if (for_each_rtx (&x, approx_reg_cost_1, (void *) &cost)) + return MAX_COST; - CLEAR_REG_SET (&set); - return hardregs && SMALL_REGISTER_CLASSES ? MAX_COST : cost; + return cost; } /* Return a negative value if an rtx A, whose costs are given by COST_A -- 2.11.4.GIT