Handle case where REGISTER-LIVE-LENGTH of a register is zero. This
authorChris Hanson <org/chris-hanson/cph>
Mon, 22 Feb 1993 22:38:41 +0000 (22:38 +0000)
committerChris Hanson <org/chris-hanson/cph>
Mon, 22 Feb 1993 22:38:41 +0000 (22:38 +0000)
can happen when a register is assigned but not referenced; ideally it
would be best not to generate code like this but in at least one case
it is hard to avoid.

v7/src/compiler/rtlopt/ralloc.scm

index e60218a8a9e721a407625576b49b2d807a741810..1f042a7f1d58c407ee09d9868076ff9ac1636822 100644 (file)
@@ -1,8 +1,8 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/rtlopt/ralloc.scm,v 1.16 1988/09/07 06:25:33 cph Rel $
+$Id: ralloc.scm,v 1.17 1993/02/22 22:38:41 cph Exp $
 
-Copyright (c) 1988 Massachusetts Institute of Technology
+Copyright (c) 1988-93 Massachusetts Institute of Technology
 
 This material was developed by the Scheme project at the Massachusetts
 Institute of Technology, Department of Electrical Engineering and
@@ -130,8 +130,10 @@ MIT in each case. |#
        next-allocation))))
 
 (define (allocate<? x y)
-  (< (/ (register-n-refs x) (register-live-length x))
-     (/ (register-n-refs y) (register-live-length y))))
+  (and (not (= (register-live-length x) 0))
+       (or (= (register-live-length y) 0)
+          (< (/ (register-n-refs x) (register-live-length x))
+             (/ (register-n-refs y) (register-live-length y))))))
 
 (define (mark-births! live rtl register->renumber)
   (if (rtl:assign? rtl)