Merge git://sbcl.boinkor.net/sbcl
[sbcl/lichteblau.git] / src / assembly / ppc / support.lisp
blob6b60e61a6a965bc89238ae85e7de97318af27742
1 ;;;; the machine-specific support routines needed by the file assembler
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.
12 (in-package "SB!VM")
14 (!def-vm-support-routine generate-call-sequence (name style vop)
15 (ecase style
16 ((:raw :none)
17 (let ((jump (make-symbol "JUMP")))
18 (values
19 `((inst lr ,jump (make-fixup ',name :assembly-routine))
20 (inst mtlr ,jump)
21 (inst blrl))
22 `((:temporary (:sc any-reg) ,jump)))))
23 (:full-call
24 (let ((temp (make-symbol "TEMP"))
25 (jump (make-symbol "JUMP"))
26 (nfp-save (make-symbol "NFP-SAVE"))
27 (lra (make-symbol "LRA")))
28 (values
29 `((let ((lra-label (gen-label))
30 (cur-nfp (current-nfp-tn ,vop)))
31 (when cur-nfp
32 (store-stack-tn ,nfp-save cur-nfp))
33 (inst compute-lra-from-code ,lra code-tn lra-label ,temp)
34 (note-next-instruction ,vop :call-site)
35 (inst lr ,jump (make-fixup ',name :assembly-routine))
36 (inst mtlr ,jump)
37 (inst blr)
38 (emit-return-pc lra-label)
39 (note-this-location ,vop :single-value-return)
40 (without-scheduling ()
41 (move csp-tn ocfp-tn)
42 (inst nop))
43 (inst compute-code-from-lra code-tn code-tn
44 lra-label ,temp)
45 (when cur-nfp
46 (load-stack-tn cur-nfp ,nfp-save))))
47 `((:temporary (:scs (non-descriptor-reg) :from (:eval 0) :to (:eval 1))
48 ,temp)
49 (:temporary (:sc descriptor-reg :offset lra-offset
50 :from (:eval 0) :to (:eval 1))
51 ,lra)
52 (:temporary (:scs (control-stack) :offset nfp-save-offset)
53 ,nfp-save)
54 (:temporary (:sc any-reg) ,jump)
55 (:save-p :compute-only)))))))
57 (!def-vm-support-routine generate-return-sequence (style)
58 (ecase style
59 (:raw
60 `((inst blr)))
61 (:full-call
62 `((lisp-return (make-random-tn :kind :normal
63 :sc (sc-or-lose 'descriptor-reg )
64 :offset lra-offset)
65 (make-random-tn :kind :normal
66 :sc (sc-or-lose 'interior-reg )
67 :offset lip-offset)
68 :offset 2)))
69 (:none)))
71 (defun return-machine-address (scp)
72 (sap-int (context-lr scp)))