(invalidate-memory-destination!) Optimize this -- if both class and
authorChris Hanson <org/chris-hanson/cph>
Fri, 3 Jun 1988 14:56:55 +0000 (14:56 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 3 Jun 1988 14:56:55 +0000 (14:56 +0000)
hash are not given, don't bother to insert the element in the hash
table, because it will have no useful effect.

v7/src/compiler/rtlopt/rcse2.scm

index 710e799f634097a4b84bb2b600ecad2cd57d92ac..5795faeb7e76dec6b4f57dcafeb4fc1ddef8ed0f 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/rtlopt/rcse2.scm,v 4.6 1988/05/09 19:54:06 mhwu Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/rtlopt/rcse2.scm,v 4.7 1988/06/03 14:56:55 cph Exp $
 
 Copyright (c) 1987 Massachusetts Institute of Technology
 
@@ -191,7 +191,12 @@ MIT in each case. |#
 (define (insert-memory-destination! expression element hash)
   (let ((class (element->class element)))
     (mention-registers! expression)
-    (set-element-in-memory?! (hash-table-insert! hash expression class) true)))
+    ;; Optimization: if class and hash are both false, hash-table-insert!
+    ;; makes an element which is not connected to the rest of the table.
+    ;; In that case, there is no need to make an element at all.
+    (if (or class hash)
+       (set-element-in-memory?! (hash-table-insert! hash expression class)
+                                true))))
 
 (define (mention-registers! expression)
   (if (rtl:register? expression)