Get rid of vm-support-routines indirection.
[sbcl.git] / src / assembly / sparc / 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 (defun generate-call-sequence (name style vop)
15   (ecase style
16     ((:raw :none)
17      (let ((temp (make-symbol "TEMP"))
18            (lip (make-symbol "LIP")))
19        (values
20         `((inst jali ,lip ,temp (make-fixup ',name :assembly-routine))
21           (inst nop))
22         `((:temporary (:scs (non-descriptor-reg) :from (:eval 0) :to (:eval 1))
23                       ,temp)
24           (:temporary (:scs (interior-reg) :from (:eval 0) :to (:eval 1))
25                       ,lip)))))
26     (:full-call
27      (let ((temp (make-symbol "TEMP"))
28            (nfp-save (make-symbol "NFP-SAVE"))
29            (lra (make-symbol "LRA")))
30        (values
31         `((let ((lra-label (gen-label))
32                 (cur-nfp (current-nfp-tn ,vop)))
33             (when cur-nfp
34               (store-stack-tn ,nfp-save cur-nfp))
35             (inst compute-lra-from-code ,lra code-tn lra-label ,temp)
36             (note-next-instruction ,vop :call-site)
37             (inst ji ,temp (make-fixup ',name :assembly-routine))
38             (inst nop)
39             (emit-return-pc lra-label)
40             (note-this-location ,vop :single-value-return)
41             (without-scheduling ()
42               (move csp-tn ocfp-tn)
43               (inst nop))
44             (inst compute-code-from-lra code-tn code-tn
45                   lra-label ,temp)
46             (when cur-nfp
47               (load-stack-tn cur-nfp ,nfp-save))))
48         `((:temporary (:scs (non-descriptor-reg) :from (:eval 0) :to (:eval 1))
49                       ,temp)
50           (:temporary (:sc descriptor-reg :offset lra-offset
51                            :from (:eval 0) :to (:eval 1))
52                       ,lra)
53           (:temporary (:scs (control-stack) :offset nfp-save-offset)
54                       ,nfp-save)
55           (:save-p :compute-only)))))))
56
57 (defun generate-return-sequence (style)
58   (ecase style
59     (:raw
60      `((inst j
61              (make-random-tn :kind :normal
62                              :sc (sc-or-lose 'interior-reg)
63                              :offset lip-offset)
64              8)
65        (inst nop)))
66     (:full-call
67      `((lisp-return (make-random-tn :kind :normal
68                                     :sc (sc-or-lose 'descriptor-reg)
69                                     :offset lra-offset)
70                     :offset 2)))
71     (:none)))
72
73 (defun return-machine-address (scp)
74   (+ (context-register scp lip-offset) 8))