Silence notes about being specialised EQ templates on x86oids
[sbcl.git] / src / compiler / ppc / vm.lisp
index 0de57d5..720f8b3 100644 (file)
   (defreg a3 27)
   (defreg l0 28)
   (defreg l1 29)
-  (defreg l2 30)
+  (defreg #!-sb-thread l2 #!+sb-thread thread 30)
   (defreg lip 31)
 
   (defregset non-descriptor-regs
       nl0 nl1 nl2 nl3 nl4 nl5 nl6 #+nil nl7 cfunc nargs nfp)
 
   (defregset descriptor-regs
-      fdefn a0 a1 a2 a3  ocfp lra cname lexenv l0 l1 l2 )
+      fdefn a0 a1 a2 a3  ocfp lra cname lexenv l0 l1 #!-sb-thread l2 )
 
 
  (defregset *register-arg-offsets*  a0 a1 a2 a3)
       ((null classes)
        (nreverse forms))))
 
-(def!constant kludge-nondeterministic-catch-block-size 7)
+(def!constant kludge-nondeterministic-catch-block-size 6)
 
 (define-storage-classes
 
   (defregtn null descriptor-reg)
   (defregtn code descriptor-reg)
   (defregtn alloc any-reg)
+  (defregtn lra descriptor-reg)
+  (defregtn lexenv descriptor-reg)
 
   (defregtn nargs any-reg)
   (defregtn bsp any-reg)
 \f
 ;;; If VALUE can be represented as an immediate constant, then return the
 ;;; appropriate SC number, otherwise return NIL.
-(!def-vm-support-routine immediate-constant-sc (value)
+(defun immediate-constant-sc (value)
   (typecase value
     ((integer 0 0)
      (sc-number-or-lose 'zero))
     (null
      (sc-number-or-lose 'null))
     ((or (integer #.sb!xc:most-negative-fixnum #.sb!xc:most-positive-fixnum)
-         system-area-pointer character)
+         character)
      (sc-number-or-lose 'immediate))
     (symbol
      (if (static-symbol-p value)
          (sc-number-or-lose 'immediate)
          nil))))
+
+(defun boxed-immediate-sc-p (sc)
+  (or (eql sc (sc-number-or-lose 'zero))
+      (eql sc (sc-number-or-lose 'null))
+      (eql sc (sc-number-or-lose 'immediate))))
+
+;;; A predicate to see if a character can be used as an inline
+;;; constant (the immediate field in the instruction used is sixteen
+;;; bits wide, which is not the same as any defined subtype of
+;;; CHARACTER).
+(defun inlinable-character-constant-p (char)
+  (and (characterp char)
+       (< (char-code char) #x10000)))
 \f
 ;;;; function call parameters
 
                               :offset n))
           *register-arg-offsets*))
 
+#!+sb-thread
+(defparameter thread-base-tn
+  (make-random-tn :kind :normal :sc (sc-or-lose 'unsigned-reg)
+                  :offset thread-offset))
+
 (export 'single-value-return-byte-offset)
 
 ;;; This is used by the debugger.
 \f
 ;;; This function is called by debug output routines that want a pretty name
 ;;; for a TN's location.  It returns a thing that can be printed with PRINC.
-(!def-vm-support-routine location-print-name (tn)
+(defun location-print-name (tn)
   (declare (type tn tn))
   (let ((sb (sb-name (sc-sb (tn-sc tn))))
         (offset (tn-offset tn)))
       (constant (format nil "Const~D" offset))
       (immediate-constant "Immed"))))
 
+(defun combination-implementation-style (node)
+  (declare (type sb!c::combination node))
+  (flet ((valid-funtype (args result)
+           (sb!c::valid-fun-use node
+                                (sb!c::specifier-type
+                                 `(function ,args ,result)))))
+    (case (sb!c::combination-fun-source-name node)
+      (logtest
+       (cond
+         ((or (valid-funtype '(fixnum fixnum) '*)
+              (valid-funtype '((signed-byte 32) (signed-byte 32)) '*)
+              (valid-funtype '((unsigned-byte 32) (unsigned-byte 32)) '*))
+          (values :maybe nil))
+         (t (values :default nil))))
+      (logbitp
+       (cond
+         ((or (valid-funtype '((constant-arg (integer 0 29)) fixnum) '*)
+              (valid-funtype '((constant-arg (integer 0 31)) (signed-byte 32)) '*)
+              (valid-funtype '((constant-arg (integer 0 31)) (unsigned-byte 32)) '*))
+          (values :transform '(lambda (index integer)
+                               (%logbitp integer index))))
+         (t (values :default nil))))
+      ;; FIXME: can handle MIN and MAX here
+      (sb!kernel:%ldb
+       (flet ((validp (type width)
+                (and (valid-funtype `((constant-arg (integer 1 29))
+                                      (constant-arg (mod ,width))
+                                      ,type)
+                                    'fixnum)
+                     (destructuring-bind (size posn integer)
+                         (sb!c::basic-combination-args node)
+                       (declare (ignore integer))
+                       (<= (+ (sb!c::lvar-value size)
+                              (sb!c::lvar-value posn))
+                           width)))))
+         (if (or (validp 'fixnum 29)
+                 (validp '(signed-byte 32) 32)
+                 (validp '(unsigned-byte 32) 32))
+             (values :transform '(lambda (size posn integer)
+                                  (%%ldb integer size posn)))
+             (values :default nil))))
+      (t (values :default nil)))))
+
+(defun primitive-type-indirect-cell-type (ptype)
+  (declare (ignore ptype))
+  nil)