Install special handling for close-coded combinations whose target is
authorChris Hanson <org/chris-hanson/cph>
Thu, 21 May 1987 14:58:20 +0000 (14:58 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 21 May 1987 14:58:20 +0000 (14:58 +0000)
a temporary.  Such combinations must be followed by code to assign the
value register into the temporary.  Also put in error check to
guarantee that this never happens in reduction position.

v7/src/compiler/rtlgen/rgcomb.scm

index 84b165dcbcd7fe418f4335196137c544430caff0..ed26e150ea48885b57e67e003281ce49e1f56cd8 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/rtlgen/rgcomb.scm,v 1.19 1987/05/18 17:50:48 cph Exp $
+$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/rtlgen/rgcomb.scm,v 1.20 1987/05/21 14:58:20 cph Exp $
 
 Copyright (c) 1987 Massachusetts Institute of Technology
 
@@ -51,7 +51,8 @@ MIT in each case. |#
                                        (procedure-optional callee)
                                        (procedure-rest callee)
                                        (combination-operands combination))
-                    (map generate/operand (combination-operands combination)))))
+                    (map generate/operand
+                         (combination-operands combination)))))
            (or (and callee
                     (normal-primitive-constant? callee)
                     (let ((open-coder
@@ -117,21 +118,23 @@ MIT in each case. |#
 (define (combination/normal combination subproblem? operator operands)
   ;; For the time being, all close-coded combinations will return
   ;; their values in the value register.
-  (let ((value (combination-value combination)))
-    (cond ((temporary? value)
-          (let ((type (temporary-type value)))
-            (if type
-                (if (not (eq? 'VALUE type))
-                    (error "Bad temporary type" type))
-                (set-temporary-type! value 'VALUE))))
-         ((not (value-ignore? value))
-          (error "Unknown combination value" value))))
   (generate/normal-statement combination subproblem?
     (lambda (subproblem?)
-      ((if subproblem? combination/subproblem combination/reduction)
-       combination
-       operator
-       operands))))
+      (let ((value (combination-value combination)))
+       (cond ((temporary? value)
+              (if (not subproblem?)
+                  (error "Reduction targeted to temporary!" combination))
+              (scfg*scfg->scfg!
+               (combination/subproblem combination operator operands)
+               (rtl:make-assignment value (rtl:make-fetch register:value))))
+             ((or (value-register? value)
+                  (value-ignore? value))
+              ((if subproblem? combination/subproblem combination/reduction)
+               combination
+               operator
+               operands))
+             (else
+              (error "Unknown combination value" value)))))))
 
 (define (define-open-coder primitive open-coder)
   (let ((kernel