expressions setup label)
cleanup
(if error-finish
- (error-finish (rtl:make-fetch register:value))
+ (let ((temporary (rtl:make-pseudo-register)))
+ (scfg*scfg->scfg!
+ (rtl:make-assignment
+ temporary
+ (rtl:make-fetch register:value))
+ (error-finish (rtl:make-fetch temporary))))
(make-null-cfg)))
#|
;; This code is preferable to the above
(generate-primitive generic-op (length expressions)
expressions setup label)
cleanup
- (if predicate?
- (finish (rtl:make-true-test (rtl:make-fetch register:value)))
- (expression-simplify-for-statement
- (rtl:make-fetch register:value)
- finish))))))))
+ (let ((temporary (rtl:make-pseudo-register)))
+ (scfg*scfg->scfg!
+ (rtl:make-assignment temporary (rtl:make-fetch register:value))
+ (if predicate?
+ (finish (rtl:make-true-test (rtl:make-fetch temporary)))
+ (expression-simplify-for-statement
+ (rtl:make-fetch temporary)
+ finish))))))))))
(define (generic->fixnum-op generic-op)
(case generic-op
(generate/continuation-entry/pop-extra continuation)))
operand
continuation)
- (scfg-append!
- (if (and continuation (continuation/effect? continuation))
- (effect-prefix operand)
- ((return-operand/value-generator operand)
- (lambda (expression)
- (rtl:make-assignment register:value expression))))
- (return-operator/pop-frames context operator 0)
- (rtl:make-pop-return)))))
+ (receive (rising-action conclusion)
+ (if (and continuation (continuation/effect? continuation))
+ (values (effect-prefix operand) (make-null-cfg))
+ (let ((temporary (rtl:make-pseudo-register)))
+ (values
+ ((return-operand/value-generator operand)
+ (lambda (expression)
+ (rtl:make-assignment temporary expression)))
+ (rtl:make-assignment register:value
+ (rtl:make-fetch temporary)))))
+ (scfg-append!
+ rising-action
+ (return-operator/pop-frames context operator 0)
+ conclusion
+ (rtl:make-pop-return))))))
(define-integrable (continuation/effect? continuation)
(eq? continuation-type/effect (continuation/type continuation)))
(generate/rgraph
(continuation/entry-node continuation)
(lambda (node)
- (scfg-append!
- (if (continuation/avoid-check? continuation)
- (rtl:make-continuation-entry label)
- (rtl:make-continuation-header label))
- (generate/continuation-entry/pop-extra continuation)
- (enumeration-case continuation-type
- (continuation/type continuation)
- ((PUSH)
- (rtl:make-push (rtl:make-fetch register:value)))
- ((REGISTER)
- (rtl:make-assignment (continuation/register continuation)
- (rtl:make-fetch register:value)))
- ((VALUE PREDICATE)
- (if (continuation/ever-known-operator? continuation)
- (rtl:make-assignment (continuation/register continuation)
- (rtl:make-fetch register:value))
- (make-null-cfg)))
- ((EFFECT)
- (make-null-cfg))
- (else
- (error "Illegal continuation type" continuation)))
- (generate/node node)))))
+ (define (with-value generator)
+ (let* ((temporary (rtl:make-pseudo-register))
+ (prologue
+ (rtl:make-assignment temporary
+ (rtl:make-fetch register:value)))
+ (intermezzo (generator temporary)))
+ (values prologue intermezzo)))
+ (receive (prologue intermezzo)
+ (enumeration-case continuation-type
+ (continuation/type continuation)
+ ((PUSH)
+ (with-value rtl:make-push))
+ ((REGISTER)
+ (with-value
+ (lambda (expression)
+ (rtl:make-assignment
+ (continuation/register continuation)
+ expression))))
+ ((VALUE PREDICATE)
+ (if (continuation/ever-known-operator? continuation)
+ (with-value
+ (lambda (expression)
+ (rtl:make-assignment
+ (continuation/register continuation)
+ expression)))
+ (values (make-null-cfg) (make-null-cfg))))
+ ((EFFECT)
+ (values (make-null-cfg) (make-null-cfg)))
+ (else
+ (error "Illegal continuation type" continuation)))
+ (scfg-append!
+ (if (continuation/avoid-check? continuation)
+ (rtl:make-continuation-entry label)
+ (rtl:make-continuation-header label))
+ prologue
+ (generate/continuation-entry/pop-extra continuation)
+ intermezzo
+ (generate/node node))))))
(lambda (rgraph entry-edge)
(make-rtl-continuation
rgraph