X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fbackend.lisp;h=04c4e3510c1af48df08629ace4a33229dd4d1998;hb=90ca09b75fbc3b63b2f7d09c67b04b866dd783f6;hp=6c0c529214907da4ecfd807e7297f1ca58551c06;hpb=aa2dc9529460ea0d9c99998dc87283fc1a43e808;p=sbcl.git diff --git a/src/compiler/backend.lisp b/src/compiler/backend.lisp index 6c0c529..04c4e35 100644 --- a/src/compiler/backend.lisp +++ b/src/compiler/backend.lisp @@ -30,10 +30,7 @@ ;;; the byte order of the target machine. :BIG-ENDIAN has the MSB first (e.g. ;;; IBM RT), :LITTLE-ENDIAN has the MSB last (e.g. DEC VAX). -;;; -;;; KLUDGE: In a sort of pun, this is also used as the value of -;;; BACKEND-BYTE-FASL-FILE-IMPLEMENTATION. -- WHN 20000302 -(defvar *backend-byte-order* nil) +(defvar *backend-byte-order*) (declaim (type (member nil :little-endian :big-endian) *backend-byte-order*)) ;;; translation from SC numbers to SC info structures. SC numbers are always @@ -115,10 +112,6 @@ (defvar *backend-parsed-vops* (make-hash-table :test 'eq)) (declaim (type hash-table *backend-parsed-vops*)) -;;; the backend-specific aspects of the info environment -(defvar *backend-info-environment* nil) -(declaim (type list *backend-info-environment*)) - ;;; support for the assembler (defvar *backend-instruction-formats* (make-hash-table :test 'eq)) (defvar *backend-instruction-flavors* (make-hash-table :test 'equal)) @@ -231,3 +224,51 @@ ;;; the VM support routines (defvar *backend-support-routines* (make-vm-support-routines)) (declaim (type vm-support-routines *backend-support-routines*)) + +;;;; This is a prototype interface to support Christophe Rhodes' new +;;;; (sbcl-0.pre7.57) VOP :GUARD clauses for implementations which +;;;; depend on CPU variants, e.g. the differences between I486, +;;;; Pentium, and Pentium Pro, or the differences between different +;;;; SPARC versions. + +;;;; Christophe Rhodes' longer explanation (cut and pasted +;;;; from CLiki SBCL internals site 2001-10-12): +#| +In CMUCL, the :guard argument to VOPs provided a way of disallowing +the use of a particular VOP in compiled code. As an example, from the +SPARC code in CMUCL, + +(DEFINE-VOP? (FAST-V8-TRUNCATE/SIGNED=>SIGNED? FAST-SAFE-ARITH-OP?) + (:TRANSLATE TRUNCATE?) + ... + (:GUARD (OR (BACKEND-FEATUREP :SPARC-V8) + (AND (BACKEND-FEATUREP :SPARC-V9) + (NOT (BACKEND-FEATUREP :SPARC-64))))) + ...) + +and at the IR2 translation stage, the function #'`(LAMBDA () ,GUARD) would be called. + +Until SBCL-0.7pre57, this is translated as + (:GUARD #!+(OR :SPARC-V8 (AND :SPARC-V9 (NOT :SPARC-64))) T + #!-(OR :SPARC-V8 (AND :SPARC-V9 (NOT :SPARC-64))) NIL) +which means that whether this VOP will ever be used is determined at +compiler compile-time depending on the contents of +*SHEBANG-FEATURES*?. + +As of SBCL-0.7pre57, a new special variable, +SB-C:*BACKEND-SUBFEATURES*?, is introduced. As of that version, only +VOPs translating %log1p? query it, and :PENTIUM-STYLE-FYL2XP1 is the +only useful value to be pushed onto that list, for x86. This is not +yet an ideal interface, but it does allow for compile-time +conditionalization. +|# + +;;; The default value of NIL means use only unguarded VOPs. +(defvar *backend-subfeatures* nil) + +;;; possible *BACKEND-SUBFEATURES* values: +;;; +;;; :PENTIUM-STYLE-FYL2XP1 is a useful value for x86 SBCLs to have on +;;; SB-C:*BACKEND-SUBFEATURES*?; it enables the use of the +;;; %flog1p-pentium? VOP rather than the %flog1p? VOP, which is a few +;;; instructions longer.