c5ac7f8700ba7be499521a919b66e85ff97f3a8e
[sbcl.git] / src / compiler / mips / show.lisp
1 ;;;; temporary printing utilities and similar noise
2
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.
11
12 (in-package "SB!VM")
13
14
15 (define-vop (print)
16   (:args (object :scs (descriptor-reg any-reg) :target nl0))
17   (:results (result :scs (descriptor-reg)))
18   (:save-p t)
19   (:temporary (:sc any-reg :offset nl0-offset :from (:argument 0)) nl0)
20   (:temporary (:sc any-reg :offset cfunc-offset) cfunc)
21   (:temporary (:sc control-stack :offset nfp-save-offset) nfp-save)
22   (:vop-var vop)
23   (:generator 100
24     (let ((cur-nfp (current-nfp-tn vop)))
25       (when cur-nfp
26         (store-stack-tn nfp-save cur-nfp))
27       (move nl0 object)
28       (inst li cfunc (make-fixup "debug_print" :foreign))
29       (inst jal (make-fixup "call_into_c" :foreign))
30       (inst addu nsp-tn nsp-tn -16)
31       (inst addu nsp-tn nsp-tn 16)
32       (when cur-nfp
33         (load-stack-tn cur-nfp nfp-save))
34       (move result nl0))))