432198c6a836bb53db287694606d9b2d2cb970a8
[sbcl.git] / src / compiler / alpha / print.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 ;;;
11 ;;; This file contains temporary printing utilities and similar noise.
12 ;;;
13 ;;; Written by William Lott.
14 ;;; Converted by Sean Hallgren.
15
16 (in-package "SB!VM")
17
18
19
20 (define-vop (print)
21   (:args (object :scs (descriptor-reg) :target a0))
22   (:results (result :scs (descriptor-reg)))
23   (:save-p t)
24   (:temporary (:sc any-reg :offset cfunc-offset :target result :to (:result 0))
25               cfunc)
26   (:temporary (:sc descriptor-reg :offset nl0-offset :from (:argument 0)) a0)
27   (:temporary (:sc control-stack :offset nfp-save-offset) nfp-save)
28   (:temporary (:scs (non-descriptor-reg)) temp)
29   (:vop-var vop)
30   (:generator 0
31     (let ((cur-nfp (current-nfp-tn vop)))
32       (move object a0)
33       (when cur-nfp
34         (store-stack-tn nfp-save cur-nfp))
35       (inst li (make-fixup "debug_print" :foreign) cfunc)
36       (inst li (make-fixup "call_into_c" :foreign) temp)
37       (inst jsr lip-tn temp (make-fixup "call_into_c" :foreign))
38       (when cur-nfp
39         (maybe-load-stack-nfp-tn cur-nfp nfp-save temp))
40       (move cfunc result))))