From b5fb0995bde42231bdadfe5b8964318b751340e1 Mon Sep 17 00:00:00 2001 From: toy <toy> Date: Mon, 24 Sep 2001 15:59:43 +0000 Subject: [PATCH] In the LOADW/STOREW macros, add an extra parameter for holding a temp register that is used if the offset is too big to fit into the 13-bit offset field of the LD/ST instruction. --- compiler/sparc/macros.lisp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/compiler/sparc/macros.lisp b/compiler/sparc/macros.lisp index 00af5c7ef..58c2eea51 100644 --- a/compiler/sparc/macros.lisp +++ b/compiler/sparc/macros.lisp @@ -5,11 +5,11 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/macros.lisp,v 1.14 2001/05/18 16:22:54 toy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/macros.lisp,v 1.15 2001/09/24 15:59:43 toy Exp $") ;;; ;;; ********************************************************************** ;;; -;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/macros.lisp,v 1.14 2001/05/18 16:22:54 toy Exp $ +;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/sparc/macros.lisp,v 1.15 2001/09/24 15:59:43 toy Exp $ ;;; ;;; This file contains various useful macros for generating SPARC code. ;;; @@ -28,10 +28,34 @@ `(unless (location= ,n-dst ,n-src) (inst move ,n-dst ,n-src)))) +;; (loadw object base &optional (offset 0) (lowtag 0) temp) +;; +;; Load a word at a given address into the register OBJECT. The +;; address of the word is in register BASE, plus an offset given by +;; OFFSET, which is in words. LOWTAG is an adjustment to OFFSET to +;; account for any tag bits used in the BASE descriptor register. +;; +;; In some situations, the offset may be so large that it cannot fit +;; into the offset field of the LD instruction (a 13-bit signed +;; quantity). In this situation, the TEMP non-descriptor register, if +;; supplied, is used to compute the correct offset. If TEMP is not +;; given, the offset is assumed to fit. (TEMP must be a +;; non-descriptor because we store random values into it. If OBJECT +;; were always a non-descriptor, we wouldn't need the TEMP register.) +;; +;; Samething for storew, except we store OBJECT at the given address. (macrolet ((frob (op inst shift) - `(defmacro ,op (object base &optional (offset 0) (lowtag 0)) - `(inst ,',inst ,object ,base (- (ash ,offset ,,shift) ,lowtag))))) + `(defmacro ,op (object base &optional (offset 0) (lowtag 0) temp) + (if temp + (let ((offs (gensym))) + `(let ((,offs (- (ash ,offset ,',shift) ,lowtag))) + (if (typep ,offs '(signed-byte 13)) + (inst ,',inst ,object ,base ,offs) + (progn + (inst li ,temp ,offs) + (inst ,',inst ,object ,base ,temp))))) + `(inst ,',inst ,object ,base (- (ash ,offset ,',shift) ,lowtag)))))) (frob loadw ld word-shift) (frob storew st word-shift)) -- GitLab