Eliminate "unused variable" warning from ARRAY-ROW-MAJOR-INDEX
[sbcl.git] / src / compiler / ppc / debug.lisp
1 ;;;; PPC compiler support for the debugger
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 (define-vop (debug-cur-sp)
15   (:translate sb!di::current-sp)
16   (:policy :fast-safe)
17   (:results (res :scs (sap-reg)))
18   (:result-types system-area-pointer)
19   (:generator 1
20     (move res csp-tn)))
21
22 (define-vop (debug-cur-fp)
23   (:translate sb!di::current-fp)
24   (:policy :fast-safe)
25   (:results (res :scs (sap-reg)))
26   (:result-types system-area-pointer)
27   (:generator 1
28     (move res cfp-tn)))
29
30 (define-vop (read-control-stack)
31   (:translate sb!kernel:stack-ref)
32   (:policy :fast-safe)
33   (:args (sap :scs (sap-reg))
34          (offset :scs (any-reg)))
35   (:arg-types system-area-pointer positive-fixnum)
36   (:results (result :scs (descriptor-reg)))
37   (:result-types *)
38   (:generator 5
39     (inst lwzx result sap offset)))
40
41 (define-vop (write-control-stack)
42   (:translate sb!kernel:%set-stack-ref)
43   (:policy :fast-safe)
44   (:args (sap :scs (sap-reg))
45          (offset :scs (any-reg))
46          (value :scs (descriptor-reg) :target result))
47   (:arg-types system-area-pointer positive-fixnum *)
48   (:results (result :scs (descriptor-reg)))
49   (:result-types *)
50   (:generator 5
51     (inst stwx value sap offset)
52     (move result value)))
53
54 (define-vop (code-from-mumble)
55   (:policy :fast-safe)
56   (:args (thing :scs (descriptor-reg)))
57   (:results (code :scs (descriptor-reg)))
58   (:temporary (:scs (non-descriptor-reg)) temp)
59   (:variant-vars lowtag)
60   (:generator 5
61     (let ((bogus (gen-label))
62           (done (gen-label)))
63       (loadw temp thing 0 lowtag)
64       (inst srwi temp temp n-widetag-bits)
65       (inst cmpwi temp 0)
66       (inst slwi temp temp (1- (integer-length n-word-bytes)))
67       (inst beq bogus)
68       (unless (= lowtag other-pointer-lowtag)
69         (inst addi temp temp (- lowtag other-pointer-lowtag)))
70       (inst sub code thing temp)
71       (emit-label done)
72       (assemble (*elsewhere*)
73         (emit-label bogus)
74         (move code null-tn)
75         (inst b done)))))
76
77 (define-vop (code-from-lra code-from-mumble)
78   (:translate sb!di::lra-code-header)
79   (:variant other-pointer-lowtag))
80
81 (define-vop (code-from-fun code-from-mumble)
82   (:translate sb!di::fun-code-header)
83   (:variant fun-pointer-lowtag))
84
85 (define-vop (%make-lisp-obj)
86   (:policy :fast-safe)
87   (:translate %make-lisp-obj)
88   (:args (value :scs (unsigned-reg) :target result))
89   (:arg-types unsigned-num)
90   (:results (result :scs (descriptor-reg)))
91   (:generator 1
92     (move result value)))
93
94 (define-vop (get-lisp-obj-address)
95   (:policy :fast-safe)
96   (:translate sb!di::get-lisp-obj-address)
97   (:args (thing :scs (descriptor-reg) :target result))
98   (:results (result :scs (unsigned-reg)))
99   (:result-types unsigned-num)
100   (:generator 1
101     (move result thing)))
102
103
104 (define-vop (fun-word-offset)
105   (:policy :fast-safe)
106   (:translate sb!di::fun-word-offset)
107   (:args (fun :scs (descriptor-reg)))
108   (:results (res :scs (unsigned-reg)))
109   (:result-types positive-fixnum)
110   (:generator 5
111     (loadw res fun 0 fun-pointer-lowtag)
112     (inst srwi res res n-widetag-bits)))