1 ;;;; target-only stuff from CMU CL's src/compiler/x86/insts.lisp
3 ;;;; This software is part of the SBCL system. See the README file for
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.
14 (defun print-mem-access (value stream print-size-p dstate)
15 (declare (type list value)
17 (type (member t nil) print-size-p)
18 (type sb!disassem:disassem-state dstate))
20 (princ (sb!disassem:dstate-get-prop dstate 'width) stream)
21 (princ '| PTR | stream))
22 (write-char #\[ stream)
24 (macrolet ((pel ((var val) &body body)
25 ;; Print an element of the address, maybe with
26 ;; a leading separator.
30 (write-char #\+ stream))
33 (pel (base-reg (first value))
34 (print-addr-reg base-reg stream dstate))
35 (pel (index-reg (third value))
36 (print-addr-reg index-reg stream dstate)
37 (let ((index-scale (fourth value)))
38 (when (and index-scale (not (= index-scale 1)))
39 (write-char #\* stream)
40 (princ index-scale stream))))
41 (let ((offset (second value)))
42 (when (and offset (or firstp (not (zerop offset))))
43 (unless (or firstp (minusp offset))
44 (write-char #\+ stream))
46 (sb!disassem:princ16 offset stream)
47 (princ offset stream))))))
48 (write-char #\] stream))