X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fassembly%2Fppc%2Fsupport.lisp;h=18c0a3a6b796d939629e61a8fae96ece24bf9868;hb=5728601f88c400d2992b6b8c70d8971d07de9029;hp=3d736ac70f10358c83db0358142562aefb639e73;hpb=cab2c71bb1bb8a575d9eebdae335e731daa64183;p=sbcl.git diff --git a/src/assembly/ppc/support.lisp b/src/assembly/ppc/support.lisp index 3d736ac..18c0a3a 100644 --- a/src/assembly/ppc/support.lisp +++ b/src/assembly/ppc/support.lisp @@ -1,55 +1,72 @@ +;;;; the machine-specific support routines needed by the file assembler + +;;;; This software is part of the SBCL system. See the README file for +;;;; more information. +;;;; +;;;; This software is derived from the CMU CL system, which was +;;;; written at Carnegie Mellon University and released into the +;;;; public domain. The software is in the public domain and is +;;;; provided with absolutely no warranty. See the COPYING and CREDITS +;;;; files for more information. + (in-package "SB!VM") -(!def-vm-support-routine generate-call-sequence (name style vop) +(defun generate-call-sequence (name style vop) (ecase style - (:raw - (values - `((inst bla (make-fixup ',name :assembly-routine))) - `())) + ((:raw :none) + (let ((jump (make-symbol "JUMP"))) + (values + `((inst lr ,jump (make-fixup ',name :assembly-routine)) + (inst mtlr ,jump) + (inst blrl)) + `((:temporary (:sc any-reg) ,jump))))) (:full-call (let ((temp (make-symbol "TEMP")) - (nfp-save (make-symbol "NFP-SAVE")) - (lra (make-symbol "LRA"))) + (jump (make-symbol "JUMP")) + (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) - (note-next-instruction ,vop :call-site) - (inst ba (make-fixup ',name :assembly-routine)) - (emit-return-pc lra-label) - (note-this-location ,vop :single-value-return) - (without-scheduling () - (move csp-tn ocfp-tn) - (inst nop)) - (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) - ,nfp-save) - (:save-p :compute-only))))) - (:none - (values - `((inst ba (make-fixup ',name :assembly-routine))) - `())))) + `((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) + (note-next-instruction ,vop :call-site) + (inst lr ,jump (make-fixup ',name :assembly-routine)) + (inst mtlr ,jump) + (inst blr) + (emit-return-pc lra-label) + (note-this-location ,vop :single-value-return) + (without-scheduling () + (move csp-tn ocfp-tn) + (inst nop)) + (inst compute-code-from-lra code-tn lra-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) + ,nfp-save) + (:temporary (:sc any-reg) ,jump) + (:save-p :compute-only))))))) -(!def-vm-support-routine generate-return-sequence (style) +(defun generate-return-sequence (style) (ecase style (:raw `((inst blr))) (:full-call `((lisp-return (make-random-tn :kind :normal - :sc (sc-or-lose 'descriptor-reg ) - :offset lra-offset) - (make-random-tn :kind :normal - :sc (sc-or-lose 'interior-reg ) - :offset lip-offset) - :offset 2))) + :sc (sc-or-lose 'descriptor-reg ) + :offset lra-offset) + (make-random-tn :kind :normal + :sc (sc-or-lose 'interior-reg ) + :offset lip-offset) + :offset 2))) (:none))) + +(defun return-machine-address (scp) + (sap-int (context-lr scp)))