0.9.2.43:
[sbcl.git] / src / assembly / ppc / support.lisp
1 ;;;; the machine-specific support routines needed by the file assembler
2
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
11
12 (in-package "SB!VM")
13
14 (!def-vm-support-routine generate-call-sequence (name style vop)
15   (ecase style
16     ((:raw :none)
17      (values
18       `((inst bla (make-fixup ',name :assembly-routine)))
19       `()))
20     (:full-call
21      (let ((temp (make-symbol "TEMP"))
22            (nfp-save (make-symbol "NFP-SAVE"))
23            (lra (make-symbol "LRA")))
24        (values
25         `((let ((lra-label (gen-label))
26                 (cur-nfp (current-nfp-tn ,vop)))
27             (when cur-nfp
28               (store-stack-tn ,nfp-save cur-nfp))
29             (inst compute-lra-from-code ,lra code-tn lra-label ,temp)
30             (note-next-instruction ,vop :call-site)
31             (inst ba (make-fixup ',name :assembly-routine))
32             (emit-return-pc lra-label)
33             (note-this-location ,vop :single-value-return)
34             (without-scheduling ()
35                                 (move csp-tn ocfp-tn)
36                                 (inst nop))
37             (inst compute-code-from-lra code-tn code-tn
38                   lra-label ,temp)
39             (when cur-nfp
40               (load-stack-tn cur-nfp ,nfp-save))))
41         `((:temporary (:scs (non-descriptor-reg) :from (:eval 0) :to (:eval 1))
42            ,temp)
43           (:temporary (:sc descriptor-reg :offset lra-offset
44                        :from (:eval 0) :to (:eval 1))
45            ,lra)
46           (:temporary (:scs (control-stack) :offset nfp-save-offset)
47            ,nfp-save)
48           (:save-p :compute-only)))))))
49
50 (!def-vm-support-routine generate-return-sequence (style)
51   (ecase style
52     (:raw
53      `((inst blr)))
54     (:full-call
55      `((lisp-return (make-random-tn :kind :normal
56                                     :sc (sc-or-lose 'descriptor-reg )
57                                     :offset lra-offset)
58                     (make-random-tn :kind :normal
59                                     :sc (sc-or-lose 'interior-reg )
60                                     :offset lip-offset)
61                     :offset 2)))
62     (:none)))
63
64 (defun return-machine-address (scp)
65   (sap-int (context-lr scp)))