X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fx86%2Fvm.lisp;h=3af49f211876837007bec409c78052b2c4def9b8;hb=da8cb4801a3ab35070f380e22aea3d260f9df8aa;hp=1b080bc28f7fe15c012b2f977a4fd6dd6ece5412;hpb=fb2d70782a537348895f6a04f257d1f1fcc7942d;p=sbcl.git diff --git a/src/compiler/x86/vm.lisp b/src/compiler/x86/vm.lisp index 1b080bc..3af49f2 100644 --- a/src/compiler/x86/vm.lisp +++ b/src/compiler/x86/vm.lisp @@ -404,6 +404,20 @@ (eql value (log 2l0 10l0)) (eql value (log 2l0 2.718281828459045235360287471352662L0))) (sc-number-or-lose 'fp-constant))))) + +;; For an immediate TN, return its value encoded for use as a literal. +;; For any other TN, return the TN. Only works for FIXNUMs, +;; STATIC-SYMBOLs, and CHARACTERS (FLOATs and SAPs are handled +;; elsewhere). +(defun encode-value-if-immediate (tn) + (if (sc-is tn immediate) + (let ((val (tn-value tn))) + (etypecase val + (integer (fixnumize val)) + (symbol (+ nil-value (static-symbol-offset val))) + (character (logior (ash (char-code val) n-widetag-bits) + character-widetag)))) + tn)) ;;;; miscellaneous function call parameters