aboutsummaryrefslogtreecommitdiff
path: root/gcc/global.c
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1994-07-18 19:02:32 -0700
committerJim Wilson <wilson@gcc.gnu.org>1994-07-18 19:02:32 -0700
commit7a17c5881cd885f908f97bab9b8032f554073071 (patch)
tree23aa2a934548804b727312cac3643340d890b494 /gcc/global.c
parent8c4f5c09f073aa9cf6991212446510634c4fba16 (diff)
downloadgcc-7a17c5881cd885f908f97bab9b8032f554073071.zip
gcc-7a17c5881cd885f908f97bab9b8032f554073071.tar.gz
gcc-7a17c5881cd885f908f97bab9b8032f554073071.tar.bz2
(find_reg): Store divide results in temporary variables.
From-SVN: r7778
Diffstat (limited to 'gcc/global.c')
-rw-r--r--gcc/global.c46
1 files changed, 27 insertions, 19 deletions
diff --git a/gcc/global.c b/gcc/global.c
index 297e930..3f15cbe 100644
--- a/gcc/global.c
+++ b/gcc/global.c
@@ -1096,28 +1096,36 @@ find_reg (allocno, losers, alt_regs_p, accept_call_clobbered, retrying)
if (local_reg_n_refs[regno] != 0
/* Don't use a reg no good for this pseudo. */
&& ! TEST_HARD_REG_BIT (used2, regno)
- && HARD_REGNO_MODE_OK (regno, mode)
- && (((double) local_reg_n_refs[regno]
- / local_reg_live_length[regno])
- < ((double) allocno_n_refs[allocno]
- / allocno_live_length[allocno])))
+ && HARD_REGNO_MODE_OK (regno, mode))
{
- /* Hard reg REGNO was used less in total by local regs
- than it would be used by this one allocno! */
- int k;
- for (k = 0; k < max_regno; k++)
- if (reg_renumber[k] >= 0)
- {
- int r = reg_renumber[k];
- int endregno
- = r + HARD_REGNO_NREGS (r, PSEUDO_REGNO_MODE (k));
+ /* We explicitly evaluate the divide results into temporary
+ variables so as to avoid excess precision problems that occur
+ on a i386-unknown-sysv4.2 (unixware) host. */
+
+ double tmp1 = ((double) local_reg_n_refs[regno]
+ / local_reg_live_length[regno]);
+ double tmp2 = ((double) allocno_n_refs[allocno]
+ / allocno_live_length[allocno]);
+
+ if (tmp1 < tmp2)
+ {
+ /* Hard reg REGNO was used less in total by local regs
+ than it would be used by this one allocno! */
+ int k;
+ for (k = 0; k < max_regno; k++)
+ if (reg_renumber[k] >= 0)
+ {
+ int r = reg_renumber[k];
+ int endregno
+ = r + HARD_REGNO_NREGS (r, PSEUDO_REGNO_MODE (k));
- if (regno >= r && regno < endregno)
- reg_renumber[k] = -1;
- }
+ if (regno >= r && regno < endregno)
+ reg_renumber[k] = -1;
+ }
- best_reg = regno;
- break;
+ best_reg = regno;
+ break;
+ }
}
}
}