1ed5d6a1ad05460389ff4753360705be125fe334
[sbcl.git] / src / assembly / hppa / support.lisp
1 (in-package "SB!VM")
2
3
4 (!def-vm-support-routine generate-call-sequence (name style vop)
5   (ecase style
6     (:raw
7      (let ((fixup (gensym "FIXUP-")))
8        (values
9         `((let ((fixup (make-fixup ',name :assembly-routine)))
10             (inst ldil fixup ,fixup)
11             (inst ble fixup lisp-heap-space ,fixup :nullify t))
12           (inst nop))
13         `((:temporary (:scs (any-reg) :from (:eval 0) :to (:eval 1))
14                       ,fixup)))))
15     (:full-call
16      (let ((temp (make-symbol "TEMP"))
17            (nfp-save (make-symbol "NFP-SAVE"))
18            (lra (make-symbol "LRA")))
19        (values
20         `((let ((lra-label (gen-label))
21                 (cur-nfp (current-nfp-tn ,vop)))
22             (when cur-nfp
23               (store-stack-tn ,nfp-save cur-nfp))
24             (inst compute-lra-from-code code-tn lra-label ,temp ,lra)
25             (note-this-location ,vop :call-site)
26             (let ((fixup (make-fixup ',name :assembly-routine)))
27               (inst ldil fixup ,temp)
28               (inst be fixup lisp-heap-space ,temp :nullify t))
29             (emit-return-pc lra-label)
30             (note-this-location ,vop :single-value-return)
31             (move ocfp-tn csp-tn)
32             (inst compute-code-from-lra code-tn lra-label ,temp code-tn)
33             (when cur-nfp
34               (load-stack-tn cur-nfp ,nfp-save))))
35         `((:temporary (:scs (non-descriptor-reg) :from (:eval 0) :to (:eval 1))
36                       ,temp)
37           (:temporary (:sc descriptor-reg :offset lra-offset
38                            :from (:eval 0) :to (:eval 1))
39                       ,lra)
40           (:temporary (:scs (control-stack) :offset nfp-save-offset)
41                       ,nfp-save)
42           (:save-p :compute-only)))))
43     (:none
44      (let ((fixup (gensym "FIXUP-")))
45        (values
46         `((let ((fixup (make-fixup ',name :assembly-routine)))
47             (inst ldil fixup ,fixup)
48             (inst be fixup lisp-heap-space ,fixup :nullify t)))
49         `((:temporary (:scs (any-reg) :from (:eval 0) :to (:eval 1))
50                       ,fixup)))))))
51
52
53 (!def-vm-support-routine generate-return-sequence (style)
54   (ecase style
55     (:raw
56      `((inst bv lip-tn :nullify t)))
57     (:full-call
58      `((lisp-return (make-random-tn :kind :normal
59                                     :sc (sc-or-lose 'descriptor-reg)
60                                     :offset lra-offset)
61                     :offset 1)))
62     (:none)))