0.9.2.43:
[sbcl/lichteblau.git] / src / assembly / alpha / support.lisp
blob9e75098f86854af13c3ea36cc80666fb510cee33
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 (values
18 `((inst li (make-fixup ',name :assembly-routine) temp)
19 (inst jsr lip-tn temp))
20 '((:temporary (:sc non-descriptor-reg) temp))
21 nil))
22 (:full-call
23 (let ((temp (make-symbol "TEMP"))
24 (nfp-save (make-symbol "NFP-SAVE"))
25 (lra (make-symbol "LRA")))
26 (values
27 `((let ((lra-label (gen-label))
28 (cur-nfp (current-nfp-tn ,vop)))
29 (when cur-nfp
30 (store-stack-tn ,nfp-save cur-nfp))
31 (inst compute-lra-from-code ,lra code-tn lra-label ,temp)
32 (note-next-instruction ,vop :call-site)
33 ; here
34 (inst li (make-fixup ',name :assembly-routine) temp1)
35 (inst jsr lip-tn temp1 (make-fixup ',name :assembly-routine))
36 (emit-return-pc lra-label)
37 (note-this-location ,vop :single-value-return)
38 (without-scheduling ()
39 (move ocfp-tn csp-tn)
40 (inst nop))
41 (inst compute-code-from-lra code-tn code-tn
42 lra-label ,temp)
43 (when cur-nfp
44 (maybe-load-stack-nfp-tn cur-nfp ,nfp-save temp1))))
45 `((:temporary (:scs (non-descriptor-reg) :from (:eval 0) :to (:eval 1))
46 ,temp)
47 (:temporary (:sc descriptor-reg :offset lra-offset
48 :from (:eval 0) :to (:eval 1))
49 ,lra)
50 (:temporary (:scs (control-stack) :offset nfp-save-offset)
51 ,nfp-save)
52 (:temporary (:scs (non-descriptor-reg)) temp1)
53 (:save-p t)))))))
55 (!def-vm-support-routine generate-return-sequence (style)
56 (ecase style
57 (:raw
58 `((inst ret zero-tn lip-tn)))
59 (:full-call
60 `((lisp-return (make-random-tn :kind :normal
61 :sc (sc-or-lose
62 'descriptor-reg)
63 :offset lra-offset)
64 lip-tn :offset 2)))
65 (:none)))
67 (defun return-machine-address (scp)
68 (context-register scp lip-offset))