1bd5887a4880c3d85d99f7fdb362333b6ee434f7
[sbcl.git] / src / assembly / x86-64 / support.lisp
1 ;;;; This software is part of the SBCL system. See the README file for
2 ;;;; more information.
3 ;;;;
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
9
10 (in-package "SB!VM")
11
12 (defun generate-call-sequence (name style vop)
13   (ecase style
14     (:raw
15      (values
16       `((inst mov temp-reg-tn (make-fixup ',name :assembly-routine))
17         (inst call temp-reg-tn))
18       nil))
19     (:full-call
20      (values
21       `((note-this-location ,vop :call-site)
22         (inst mov temp-reg-tn (make-fixup ',name :assembly-routine))
23         (inst call temp-reg-tn)
24         (note-this-location ,vop :single-value-return)
25         (inst cmov :c rsp-tn rbx-tn))
26       '((:save-p :compute-only))))
27     (:none
28      (values
29       `((inst mov temp-reg-tn (make-fixup ',name :assembly-routine))
30         (inst jmp temp-reg-tn))
31       nil))))
32
33 (defun generate-return-sequence (style)
34   (ecase style
35     (:raw
36      `(inst ret))
37     (:full-call
38      `((inst clc)
39        (inst ret)))
40     (:none)))