0.6.12.3:
[sbcl.git] / src / assembly / alpha / support.lisp
1 ;;; -*- Package: ALPHA -*-
2 ;;;
3 ;;; **********************************************************************
4 ;;; This code was written as part of the CMU Common Lisp project at
5 ;;; Carnegie Mellon University, and has been placed in the public domain.
6 ;;;
7 ;;;
8 ;;; **********************************************************************
9 ;;;
10 ;;; This file contains the machine specific support routines needed by
11 ;;; the file assembler.
12 ;;;
13 (in-package "SB!VM")
14
15
16 (!def-vm-support-routine generate-call-sequence (name style vop)
17   (ecase style
18     (:raw
19      (values
20       `((inst li (make-fixup ',name :assembly-routine) temp)
21         (inst jsr lip-tn temp))
22       '((:temporary (:sc non-descriptor-reg) temp))
23      nil))
24     (:full-call
25      (let ((temp (make-symbol "TEMP"))
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             ; here
36             (inst li (make-fixup ',name :assembly-routine) temp1)
37             (inst jsr lip-tn temp1 (make-fixup ',name :assembly-routine))
38             (emit-return-pc lra-label)
39             (note-this-location ,vop :single-value-return)
40             (without-scheduling ()
41               (move ocfp-tn csp-tn)
42               (inst nop))
43             (inst compute-code-from-lra code-tn code-tn
44                   lra-label ,temp)
45             (when cur-nfp
46               (maybe-load-stack-nfp-tn cur-nfp ,nfp-save temp1))))
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 (:scs (non-descriptor-reg)) temp1)
55           (:save-p t)))))
56     (:none
57      (values
58       `((inst li (make-fixup ',name :assembly-routine) temp)
59         (inst jsr lip-tn temp (make-fixup ',name :assembly-routine)))
60       '((:temporary (:scs (non-descriptor-reg)) temp))
61       nil))))
62
63
64 (!def-vm-support-routine generate-return-sequence (style)
65   (ecase style
66     (:raw
67      `((inst ret zero-tn lip-tn)))
68     (:full-call
69      `((lisp-return (make-random-tn :kind :normal
70                                     :sc (sc-or-lose
71                                          'descriptor-reg)
72                                     :offset lra-offset)
73                     lip-tn :offset 2)))
74     (:none)))