/[cmucl]/src/compiler/locall.lisp
ViewVC logotype

Diff of /src/compiler/locall.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.32 by ram, Wed Jun 10 13:57:49 1992 UTC revision 1.33 by ram, Tue Jul 21 17:27:05 1992 UTC
# Line 70  Line 70 
70  ;;; If we do merge, we reoptimize the RETURN-RESULT continuation to cause  ;;; If we do merge, we reoptimize the RETURN-RESULT continuation to cause
71  ;;; IR1-OPTIMIZE-RETURN to recompute the tail set type.  ;;; IR1-OPTIMIZE-RETURN to recompute the tail set type.
72  ;;;  ;;;
73  (defun merge-tail-sets (call)  (defun merge-tail-sets (call &optional (new-fun (combination-lambda call)))
74    (declare (type basic-combination call))    (declare (type basic-combination call) (type clambda new-fun))
75    (let ((return (continuation-dest (node-cont call))))    (let ((return (continuation-dest (node-cont call))))
76      (when (return-p return)      (when (return-p return)
77        (let ((call-set (lambda-tail-set (node-home-lambda call)))        (let ((call-set (lambda-tail-set (node-home-lambda call)))
78              (fun-set (lambda-tail-set (combination-lambda call))))              (fun-set (lambda-tail-set new-fun)))
79          (unless (eq call-set fun-set)          (unless (eq call-set fun-set)
80            (let ((funs (tail-set-functions fun-set)))            (let ((funs (tail-set-functions fun-set)))
81              (dolist (fun funs)              (dolist (fun funs)
# Line 90  Line 90 
90  ;;;  ;;;
91  ;;;    Convert a combination into a local call.  We PROPAGATE-TO-ARGS, set the  ;;;    Convert a combination into a local call.  We PROPAGATE-TO-ARGS, set the
92  ;;; combination kind to :Local, add Fun to the Calls of the function that the  ;;; combination kind to :Local, add Fun to the Calls of the function that the
93  ;;; call is in, replace the function in the Ref node with the new function,  ;;; call is in, call MERGE-TAIL-SETS, then replace the function in the Ref node
94  ;;; then MERGE-TAIL-SETS.  ;;; with the new function.
95  ;;;  ;;;
96  ;;;    We change the Ref last, since changing the reference can trigger let  ;;; We change the Ref last, since changing the reference can trigger let
97  ;;; conversion of the new function, but will only do so if the call is local.  ;;; conversion of the new function, but will only do so if the call is local.
98    ;;; Note that the replacement may trigger let conversion or other changes in
99    ;;; IR1.  We must call MERGE-TAIL-SETS with NEW-FUN before the substitution,
100    ;;; since after the substitution (and let conversion), the call may no longer
101    ;;; be recognizable as tail-recursive.
102  ;;;  ;;;
103  (defun convert-call (ref call fun)  (defun convert-call (ref call fun)
104    (declare (type ref ref) (type combination call) (type clambda fun))    (declare (type ref ref) (type combination call) (type clambda fun))
105    (propagate-to-args call fun)    (propagate-to-args call fun)
106    (setf (basic-combination-kind call) :local)    (setf (basic-combination-kind call) :local)
107    (pushnew fun (lambda-calls (node-home-lambda call)))    (pushnew fun (lambda-calls (node-home-lambda call)))
108      (merge-tail-sets call fun)
109    (change-ref-leaf ref fun)    (change-ref-leaf ref fun)
   (merge-tail-sets call)  
110    (undefined-value))    (undefined-value))
111    
112    

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.33

  ViewVC Help
Powered by ViewVC 1.1.5