support.lisp 2.49 KB
Newer Older
wlott's avatar
wlott committed
1 2 3
;;; -*- Package: SPARC -*-
;;;
;;; **********************************************************************
4 5
;;; This code was written as part of the CMU Common Lisp project at
;;; Carnegie Mellon University, and has been placed in the public domain.
wlott's avatar
wlott committed
6
;;;
7
(ext:file-comment
8
  "$Header: src/assembly/sparc/support.lisp $")
wlott's avatar
wlott committed
9
;;;
10
;;; **********************************************************************
wlott's avatar
wlott committed
11 12 13 14 15 16 17 18 19
;;;
(in-package "SPARC")

(def-vm-support-routine generate-call-sequence (name style vop)
  (ecase style
    (:raw
     (let ((temp (make-symbol "TEMP"))
	   (lip (make-symbol "LIP")))
       (values 
20
	`((inst jali ,lip ,temp (make-fixup ',name :assembly-routine))
wlott's avatar
wlott committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
	  (inst nop))
	`((:temporary (:scs (non-descriptor-reg) :from (:eval 0) :to (:eval 1))
		      ,temp)
	  (:temporary (:scs (interior-reg) :from (:eval 0) :to (:eval 1))
		      ,lip)))))
    (:full-call
     (let ((temp (make-symbol "TEMP"))
	   (nfp-save (make-symbol "NFP-SAVE"))
	   (lra (make-symbol "LRA")))
       (values
	`((let ((lra-label (gen-label))
		(cur-nfp (current-nfp-tn ,vop)))
	    (when cur-nfp
	      (store-stack-tn ,nfp-save cur-nfp))
	    (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))
wlott's avatar
wlott committed
38 39
	    (inst nop)
	    (emit-return-pc lra-label)
40
	    (note-this-location ,vop :single-value-return)
41 42 43
	    (without-scheduling ()
	      (move csp-tn ocfp-tn)
	      (inst nop))
wlott's avatar
wlott committed
44 45 46 47 48 49 50 51 52 53
	    (inst compute-code-from-lra code-tn code-tn
		  lra-label ,temp)
	    (when cur-nfp
	      (load-stack-tn cur-nfp ,nfp-save))))
	`((:temporary (:scs (non-descriptor-reg) :from (:eval 0) :to (:eval 1))
		      ,temp)
	  (:temporary (:sc descriptor-reg :offset lra-offset
			   :from (:eval 0) :to (:eval 1))
		      ,lra)
	  (:temporary (:scs (control-stack) :offset nfp-save-offset)
54 55
		      ,nfp-save)
	  (:save-p :compute-only)))))
wlott's avatar
wlott committed
56 57 58
    (:none
     (let ((temp (make-symbol "TEMP")))
       (values 
59
	`((inst ji ,temp (make-fixup ',name :assembly-routine))
wlott's avatar
wlott committed
60 61 62 63 64 65 66
	  (inst nop))
	`((:temporary (:scs (non-descriptor-reg) :from (:eval 0) :to (:eval 1))
		      ,temp)))))))

(def-vm-support-routine generate-return-sequence (style)
  (ecase style
    (:raw
67 68 69 70 71
     `((inst j
	     (make-random-tn :kind :normal
			     :sc (sc-or-lose 'interior-reg *backend*)
			     :offset lip-offset)
	     8)
wlott's avatar
wlott committed
72 73 74 75 76 77 78
       (inst nop)))
    (:full-call
     `((lisp-return (make-random-tn :kind :normal
				    :sc (sc-or-lose 'descriptor-reg *backend*)
				    :offset lra-offset)
		    :offset 2)))
    (:none)))