Changeset 11299


Ignore:
Timestamp:
Nov 5, 2008, 11:27:35 AM (11 years ago)
Author:
gb
Message:

X862-VAR-NOT-SET-BY-FORM-P and X862-SETQED-VAR-NOT-SET-BY-FORM-P: the
mysterious SIDE-EFFECT-FREE operator bit basically means "doesn't
do SETQ or cause SETQ to happen in mysterious ways", e.g., in cases
involving closures. Only insist on that bit if the var is closed over.

In X862-VREF1, pay attention to vreg more for FPRs, too. Handle some
cases (now 64-bit only) where we have a constant fixnum index that
doesn't fit in a 32-bit displacement and we're being unsafe (the
caller doesn't set UNSCALED-IDX in that case, see ticket:375.)

In X862-VSET: at least on x8664, when no need to memoize, can use
"untargeted" registers.

Pushes on/pops from csp: use x862-open-undo rather than trying
to track the exact effects on cstack. (Not clear if we can clear
N words off of cstack, and it's not clear that N was right here,
either.)

X862-ACC-REG-FOR: chose arg_z if reg is a node reg, otherwise just
use it. (It's likely that whatever register is involved here is
just going to be pushed, so we really want to say "whatever's
easiest.")

Handle natural comparison a little differently, especially on ia32.
We can't easily use a general targeting mechanism here to steal
an extra imm reg here, since we may want to branch out of the scope
of and beyond the extent of the mark/unmark.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/X86/x862.lisp

    r11287 r11299  
    13751375;;; Punts a lot ...
    13761376(defun x862-var-not-set-by-form-p (var form)
    1377   (or (not (%ilogbitp $vbitsetq (nx-var-bits var)))
    1378       (x862-setqed-var-not-set-by-form-p var form)))
    1379 
    1380 (defun x862-setqed-var-not-set-by-form-p (var form)
     1377  (let* ((bits (nx-var-bits var)))
     1378    (or (not (%ilogbitp $vbitsetq bits))
     1379        (x862-setqed-var-not-set-by-form-p var form (logbitp $vbitclosed bits)))))
     1380
     1381(defun x862-setqed-var-not-set-by-form-p (var form &optional closed)
    13811382  (setq form (acode-unwrapped-form form))
    13821383  (or (atom form)
     
    13881389          (and (neq var (cadr form))
    13891390               (x862-setqed-var-not-set-by-form-p var (caddr form)))
    1390           (and (%ilogbitp operator-side-effect-free-bit op)
     1391          (and (or (not closed)
     1392                   (logbitp operator-side-effect-free-bit op))
    13911393               (flet ((not-set-in-formlist (formlist)
    13921394                        (dolist (subform formlist t)
    1393                           (unless (x862-setqed-var-not-set-by-form-p var subform) (return)))))
     1395                          (unless (x862-setqed-var-not-set-by-form-p var subform closed) (return)))))
    13941396                 (if
    13951397                   (cond ((%ilogbitp operator-acode-subforms-bit op) (setq subforms (%cdr form)))
     
    17201722             (vreg-class (and (not (eq vreg :push)) (hard-regspec-class vreg)))
    17211723             (vreg-mode
    1722               (if (eql vreg-class hard-reg-class-gpr)
     1724              (if (or (eql vreg-class hard-reg-class-gpr)
     1725                      (eql vreg-class hard-reg-class-fpr))
    17231726                (get-regspec-mode vreg)
    17241727                hard-reg-class-gpr-mode-invalid)))
     
    17321735               (if (and index-known-fixnum (<= index-known-fixnum (arch::target-max-64-bit-constant-index arch)))
    17331736                 (! misc-ref-c-node target src index-known-fixnum)
    1734                  (! misc-ref-node target src unscaled-idx)))))
     1737                 (if unscaled-idx
     1738                   (! misc-ref-node target src unscaled-idx)
     1739                   (with-node-target (src) unscaled-idx
     1740                     (x862-absolute-natural seg unscaled-idx  nil (ash index-known-fixnum *x862-target-fixnum-shift*))
     1741                     (! misc-ref-node target src unscaled-idx)))))))
    17351742          (is-32-bit
    17361743           (if (and index-known-fixnum (<= index-known-fixnum (arch::target-max-32-bit-constant-index arch)))
     
    17651772             (with-imm-target () idx-reg
    17661773               (if index-known-fixnum
    1767                  (x862-absolute-natural seg idx-reg nil (+ (arch::target-misc-data-offset arch) (ash index-known-fixnum 2)))
     1774                 (x862-absolute-natural seg idx-reg nil (ash index-known-fixnum 2))
    17681775                 (! scale-32bit-misc-index idx-reg unscaled-idx))
    17691776               (cond ((eq type-keyword :single-float-vector)
     
    18321839          ;; Down to the dregs.
    18331840          (is-64-bit
     1841           (with-node-target (src) extra
     1842             (unless unscaled-idx (setq unscaled-idx extra)))
    18341843           (case type-keyword
    18351844             (:double-float-vector
     
    26012610                                                  value result-reg)))
    26022611                (:x8664
    2603                  (x862-three-targeted-reg-forms seg
    2604                                                 vector src
    2605                                                 index unscaled-idx
    2606                                                 value result-reg)))))
     2612                 (multiple-value-setq (src unscaled-idx result-reg)
     2613                   (x862-three-untargeted-reg-forms seg
     2614                                                  vector src
     2615                                                  index unscaled-idx
     2616                                                  value result-reg))))))
    26072617        (when safe
    26082618          (let* ((*available-backend-imm-temps* *available-backend-imm-temps*)
     
    31973207           (:x8632
    31983208            (setq vinsn (! temp-push-single-float areg))
    3199             (incf *x862-cstack* *x862-target-dnode-size*))
     3209            (x862-open-undo $undo-x86-c-frame))
    32003210           (:x8664
    32013211            (setq vinsn (! vpush-single-float areg))
    32023212            (x862-new-vstack-lcell :single-float *x862-target-lcell-size* 0 nil)
    3203             (x862-adjust-vstack *x862-target-node-size*)))
     3213            (x862-open-undo $undo-x86-c-frame)))
    32043214          (target-arch-case
    32053215           (:x8632
     
    32073217              (progn
    32083218                (setq vinsn (! temp-push-double-float areg))
    3209                 (incf *x862-cstack* 16))
     3219                (x862-open-undo $undo-x86-c-frame))
    32103220              (progn
    32113221                (setq vinsn (! temp-push-unboxed-word areg))
    3212                 (incf *x862-cstack* *x862-target-dnode-size*))))
     3222                (x862-open-undo $undo-x86-c-frame))))
    32133223           (:x8664
    32143224            (setq vinsn
     
    32163226                    (! temp-push-double-float areg)
    32173227                    (! temp-push-unboxed-word areg)))
    3218             (setq *x862-cstack* (+ *x862-cstack* 16))))))
     3228            (x862-open-undo $undo-x86-c-frame)))))
    32193229      vinsn)))
    32203230
     
    32313241           (:x8632
    32323242            (setq vinsn (! temp-pop-single-float areg))
    3233             (decf *x862-cstack* *x862-target-dnode-size*))
     3243            (x862-close-undo))
    32343244           (:x8664
    32353245            (setq vinsn (! vpop-single-float areg))
     
    32413251              (progn
    32423252                (setq vinsn (! temp-pop-double-float areg))
    3243                 (decf *x862-cstack* 16))
     3253                (x862-close-undo))
    32443254              (progn
    32453255                (setq vinsn (! temp-pop-unboxed-word areg))
    3246                 (decf *x862-cstack* *x862-target-dnode-size*))))
     3256                (x862-close-undo))))
    32473257           (:x8664
    32483258            (setq vinsn
     
    32503260                    (! temp-pop-double-float areg)
    32513261                    (! temp-pop-unboxed-word areg)))
    3252             (setq *x862-cstack* (- *x862-cstack* 16))))))
     3262            (x862-close-undo)))))
    32533263      vinsn)))
    32543264
     3265;;; If reg is a GPR and of mode node, use arg_z, otherwise, just return
     3266;;; reg.
    32553267(defun x862-acc-reg-for (reg)
    32563268  (with-x86-local-vinsn-macros (seg)
    3257     (let* ((class (hard-regspec-class reg))
    3258            (mode (get-regspec-mode reg)))
    3259       (declare (fixnum class mode))
    3260       (cond ((= class hard-reg-class-fpr)
    3261              (make-wired-lreg *x862-fp1* :class class :mode mode))
    3262             ((= class hard-reg-class-gpr)
    3263              (if (= mode hard-reg-class-gpr-mode-node)
    3264                ($ *x862-arg-z*)
    3265                (make-wired-lreg *x862-imm0* :mode mode)))
    3266             (t (compiler-bug "Unknown register class for reg ~s" reg))))))
     3269    (if (and (eql (hard-regspec-class reg) hard-reg-class-gpr)
     3270           (eql (get-regspec-mode reg) hard-reg-class-gpr-mode-node))
     3271      ($ *x862-arg-z*)
     3272      reg)))
    32673273
    32683274;;; The compiler often generates superfluous pushes & pops.  Try to
     
    37143720                (setq cr-bit (x862-reverse-cr-bit cr-bit)))
    37153721            (^ cr-bit true-p))
    3716         (with-imm-target () (ireg :natural)
    3717           (with-additional-imm-reg ()
    3718             (with-imm-target
    3719                 (ireg) (jreg :natural)
    3720                 (x862-two-targeted-reg-forms seg i ireg j jreg)
    3721                 (x862-compare-natural-registers seg vreg xfer ireg jreg cr-bit true-p))))))))
     3722        (target-arch-case
     3723         (:x8664
     3724          (with-imm-target () (ireg :natural)
     3725            (with-imm-target (ireg) (jreg :natural)
     3726              (x862-two-targeted-reg-forms seg i ireg j jreg)
     3727              (x862-compare-natural-registers seg vreg xfer ireg jreg cr-bit true-p))))
     3728         (:x8632
     3729          (with-imm-target () (jreg :natural)
     3730            (x862-one-targeted-reg-form seg i jreg)
     3731            (x862-push-register seg jreg)
     3732            (x862-one-targeted-reg-form seg j jreg)
     3733            (! temp-pop-temp1-as-unboxed-word)
     3734            (x862-close-undo)
     3735            (x862-compare-natural-registers seg vreg xfer ($ x8632::temp1) jreg cr-bit true-p))))))))
    37223736
    37233737
     
    37303744        (setq cr-bit (x862-cr-bit-for-unsigned-comparison cr-bit))
    37313745        (! compare ireg jreg)
     3746        (target-arch-case
     3747         (:x8664)
     3748         (:x8632 (! mark-temp1-as-node-preserving-flags)))
    37323749        (regspec-crf-gpr-case
    37333750         (vreg dest)
Note: See TracChangeset for help on using the changeset viewer.