aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2006-02-24 01:29:43 +0000
committerEric Christopher <echristo@apple.com>2006-02-24 01:29:43 +0000
commit1ffee3671dd3934c08d0fab843b8f985c543b8dd (patch)
tree2c9f92fb61a425cea4a3e2a881ae34a771a9fbbd
parent5444811113d647481ab7585c7a418971c9661813 (diff)
2006-02-23 Eric Christopher <echristo@apple.com>
Radar 4081414 * global.c (local_reg_weight): Make HOST_WIDE_INT. (global_alloc): Remove casts to double for local_reg_weight. (find_reg): Use integer temporary for weight computation. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/apple-local-200502-branch@111410 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.apple-ppc7
-rw-r--r--gcc/global.c64
2 files changed, 39 insertions, 32 deletions
diff --git a/gcc/ChangeLog.apple-ppc b/gcc/ChangeLog.apple-ppc
index 2ce5869206a..0d5d507d1c7 100644
--- a/gcc/ChangeLog.apple-ppc
+++ b/gcc/ChangeLog.apple-ppc
@@ -1,3 +1,10 @@
+2006-02-23 Eric Christopher <echristo@apple.com>
+
+ Radar 4081414
+ * global.c (local_reg_weight): Make HOST_WIDE_INT.
+ (global_alloc): Remove casts to double for local_reg_weight.
+ (find_reg): Use integer temporary for weight computation.
+
2006-02-21 Geoffrey Keating <geoffk@apple.com>
Radar 4444941
diff --git a/gcc/global.c b/gcc/global.c
index 0fa1c18f995..d0788ffc234 100644
--- a/gcc/global.c
+++ b/gcc/global.c
@@ -264,14 +264,14 @@ static int local_reg_n_refs[FIRST_PSEUDO_REGISTER];
/* APPLE LOCAL begin rewrite weight computation */
#ifdef REWRITE_WEIGHT_COMPUTATION
/* Overall weight of each hard reg, as used by local alloc.
- This was formerly computed once as
+ This was formerly computed once as
SUM(REG_FREQ(i))/SUM(REG_LIVE_LENGTH(i)) where the sums
are computed over all uses. But that computation produces very
wrong answers when a reg is used both inside and outside a loop.
Now it is computed as
SUM (REG_FREQ(i)/REG_LIVE_LENGTH(i)) over all uses. */
-static double local_reg_weight[FIRST_PSEUDO_REGISTER];
+static HOST_WIDE_INT local_reg_weight[FIRST_PSEUDO_REGISTER];
#else
/* Frequency of uses of given hard reg. */
static int local_reg_freq[FIRST_PSEUDO_REGISTER];
@@ -567,8 +567,8 @@ global_alloc (FILE *file)
/* APPLE LOCAL begin rewrite weight computation */
#ifdef REWRITE_WEIGHT_COMPUTATION
if ( REG_LIVE_LENGTH (i) > 0 )
- local_reg_weight[j] += (double)REG_FREQ (i)
- / (double) REG_LIVE_LENGTH (i);
+ local_reg_weight[j] += (REG_FREQ (i) * 100)
+ / REG_LIVE_LENGTH (i);
#else
local_reg_freq[j] += REG_FREQ (i);
local_reg_live_length[j] += REG_LIVE_LENGTH (i);
@@ -596,7 +596,7 @@ global_alloc (FILE *file)
conflicts = xcalloc (max_allocno * allocno_row_words, sizeof (INT_TYPE));
/* APPLE LOCAL begin 4321079 */
- pseudo_preferences =
+ pseudo_preferences =
xcalloc (max_allocno * allocno_row_words, sizeof (INT_TYPE));
/* APPLE LOCAL end 4321079 */
@@ -622,17 +622,17 @@ global_alloc (FILE *file)
int i, j;
for (i = max_allocno - 1; i >= 0; i--)
{
- EXECUTE_IF_SET_IN_ALLOCNO_SET (pseudo_preferences
+ EXECUTE_IF_SET_IN_ALLOCNO_SET (pseudo_preferences
+ i * allocno_row_words,
j,
{
if (REG_N_SETS (allocno[i].reg) == 1
&& REG_N_SETS (allocno[j].reg) == 1)
{
- conflicts[(i) * allocno_row_words
+ conflicts[(i) * allocno_row_words
+ (unsigned) (j) / INT_BITS]
&= ~((INT_TYPE) 1 << ((unsigned) (j) % INT_BITS));
- conflicts[(j) * allocno_row_words
+ conflicts[(j) * allocno_row_words
+ (unsigned) (i) / INT_BITS]
&= ~((INT_TYPE) 1 << ((unsigned) (i) % INT_BITS));
}
@@ -1032,7 +1032,7 @@ expand_preferences (void)
to cut down on the number of reg-reg copies. Since two
inputs that both die conflict with each other, we shouldn't
tie both. Experimentally, neither picking the first nor the second
- seems to be a winner, so we tie neither.
+ seems to be a winner, so we tie neither.
On ppc, this whole idea seems to be a loser; introducing extra
dependencies for scheduling loses more than eliminating reg-reg
copies gains. We make some attempt to abstract this by looking
@@ -1059,9 +1059,9 @@ expand_preferences (void)
/* APPLE LOCAL begin 4321079 */
for (j = allocno_row_words - 1; j >= 0; j--)
{
- pseudo_preferences[a1 * allocno_row_words + j]
+ pseudo_preferences[a1 * allocno_row_words + j]
|= pseudo_preferences[a2 * allocno_row_words + j];
- pseudo_preferences[a2 * allocno_row_words + j]
+ pseudo_preferences[a2 * allocno_row_words + j]
|= pseudo_preferences[a1 * allocno_row_words + j];
}
/* APPLE LOCAL end 4321079 */
@@ -1416,11 +1416,11 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere
{
/* APPLE LOCAL begin rewrite weight computation */
#ifdef REWRITE_WEIGHT_COMPUTATION
- /* We explicitly evaluate the divide result into a temporary
- variable so as to avoid excess precision problems that occur
- on an i386-unknown-sysv4.2 (unixware) host. */
- double tmp = ((double) allocno[num].freq
- / allocno[num].live_length);
+ /* The multiplier of 100 is used to help get a couple
+ of places of difference to mitigate the problem of
+ having to use integers in the weight calculation. */
+ HOST_WIDE_INT tmp = (allocno[num].freq * 100)
+ / allocno[num].live_length;
#else
/* APPLE LOCAL end rewrite weight computation */
/* We explicitly evaluate the divide results into temporary
@@ -1505,7 +1505,7 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere
int k, l;
/* Mark tied pseudo-regs that have not yet been assigned a reg
and do not conflict as preferring this reg. Mark pseudo-regs
- conflicting with regs tied to this reg and not yet assigned a
+ conflicting with regs tied to this reg and not yet assigned a
reg as not preferring this reg. */
EXECUTE_IF_SET_IN_ALLOCNO_SET (
pseudo_preferences + num * allocno_row_words, k,
@@ -1528,14 +1528,14 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere
{
if (num != k)
EXECUTE_IF_SET_IN_ALLOCNO_SET (
- pseudo_preferences + k * allocno_row_words, l,
+ pseudo_preferences + k * allocno_row_words, l,
{
- if (k != l && !CONFLICTP (k, l)
+ if (k != l && !CONFLICTP (k, l)
&& reg_renumber[allocno[l].reg] < 0)
SET_REGBIT (regs_someone_prefers, l, best_reg);
});
});
- }
+ }
/* APPLE LOCAL end 4321079 */
}
}
@@ -1641,13 +1641,13 @@ mirror_conflicts (void)
q0++;
qq0++;
}
- for (j = allocno_row_words - 1, q1 = q0, qq1 = qq0;
- j >= 0;
+ for (j = allocno_row_words - 1, q1 = q0, qq1 = qq0;
+ j >= 0;
j--, q1 += rwb, qq1 += rwb)
{
unsigned INT_TYPE word;
- for (word = (unsigned INT_TYPE) *p++, q2 = q1;
+ for (word = (unsigned INT_TYPE) *p++, q2 = q1;
word;
word >>= 1, q2 += rw)
{
@@ -1951,7 +1951,7 @@ set_preference (rtx dest, rtx src)
/* APPLE LOCAL begin 4321079 */
/* If both are pseudos record that. We do this only for "copies", as
the current focus is to eliminate vector copies where the two
- sides have different modes, converted by a SUBREG.
+ sides have different modes, converted by a SUBREG.
Expansion to reusing the input as output is possible, but there
seems little advantage; reload handles this OK usually.
@@ -1977,7 +1977,7 @@ set_preference (rtx dest, rtx src)
/* Callback for reload. We are going to assign pseudo R a stack slot;
see if a reg tied to it already has one that we can reuse. */
rtx find_tied_stack_pseudo (int);
-rtx
+rtx
find_tied_stack_pseudo (int r)
{
int i = reg_allocno[r];
@@ -1986,7 +1986,7 @@ find_tied_stack_pseudo (int r)
return 0;
EXECUTE_IF_SET_IN_ALLOCNO_SET(pseudo_preferences + i * allocno_row_words, j,
{
- if (!CONFLICTP(i, j)
+ if (!CONFLICTP(i, j)
&& reg_renumber[allocno[j].reg] < 0
&& reg_equiv_memory_loc[allocno[j].reg] != 0
/* APPLE LOCAL begin 4405429 */
@@ -2458,7 +2458,7 @@ mark_reg_change (rtx reg, rtx setter, void *data)
regno = REGNO (reg);
bitmap_set_bit (bb_info->killed, regno);
-
+
if (GET_CODE (setter) != CLOBBER)
bitmap_set_bit (bb_info->avloc, regno);
else
@@ -2527,7 +2527,7 @@ check_earlyclobber (rtx insn)
if (i < 0)
VARRAY_PUSH_INT (earlyclobber_regclass, (int) class);
}
-
+
amp_p = false;
class = NO_REGS;
break;
@@ -2625,7 +2625,7 @@ set_up_bb_rts_numbers (void)
{
int i;
int *rts_order;
-
+
rts_order = xmalloc (sizeof (int) * n_basic_blocks);
flow_reverse_top_sort_order_compute (rts_order);
for (i = 0; i < n_basic_blocks; i++)
@@ -2684,7 +2684,7 @@ calculate_reg_pav (void)
edge_iterator ei;
struct bb_info *bb_info;
bitmap bb_live_pavin, bb_live_pavout;
-
+
bb = bb_array [i];
bb_info = BB_INFO (bb);
bb_live_pavin = bb_info->live_pavin;
@@ -2758,7 +2758,7 @@ modify_reg_pav (void)
FOR_EACH_BB (bb)
{
bb_info = BB_INFO (bb);
-
+
/* Reload can assign the same hard register to uninitialized
pseudo-register and early clobbered pseudo-register in an
insn if the pseudo-register is used first time in given BB
@@ -2817,7 +2817,7 @@ make_accurate_live_analysis (void)
FOR_EACH_BB (bb)
{
bb_info = BB_INFO (bb);
-
+
bitmap_and_into (bb->global_live_at_start, bb_info->live_pavin);
bitmap_and_into (bb->global_live_at_end, bb_info->live_pavout);
}