[ Home ]
SBCL Internals

The pages on this CLiki-driven site can be edited by anybody at any time. No warranty of any kind can therefore be made; any implied warranties of merchantability or fitness for a particular purpose are expressly disclaimed
[ Home ] [ Recent Changes ] [ About CLiki ] [ Text Formatting ]

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.


This page is linked from: BACKEND-FEATUREP  

CLiki pages can be edited by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively