Changeset 15080


Ignore:
Timestamp:
Nov 19, 2011, 10:27:28 PM (8 years ago)
Author:
gb
Message:

@+ vinsn macro doesn't invalidate regmap. (Spent several days
trying to avoid regmap invalidation in some cases involving
nested IF/AND, but didn't commit that.)

When loading from the vstack into a non-node target, try to use
a non-conflicting temporary.

When eliding-pushes on the vstack, some cases depend on the order
in which things happen in the sequence. We can't really be sure
of that order unless the sequence is straight-line code.

Fix typos in ARM2-FOUR-UNTARGETED-REG-FORMS.

If a variable's in an FPR, then things like (SYMBOLP VAR) may try
to compare the FPR to NIL. Compare the SP to NIL instead (we're
just trying to clear the Z bit in the status register.)

ARM2-%SINGLE-FLOAT-NEGATE should use ! single-float-negate, not the
double-float variant.

If the result of %NATURAL-LOGAND is known to be small enough and the
result needs to be boxed, boxing is simpler.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/ARM/arm2.lisp

    r15066 r15080  
    7474                    `(progn
    7575                      (arm2-invalidate-regmap)
     76                      (backend-gen-label ,',segvar ,,labelnum-var)))
     77                  (@+ (,labelnum-var)
     78                    `(progn             ;keep regmap
    7679                      (backend-gen-label ,',segvar ,,labelnum-var)))
    7780                  (-> (,label-var)
     
    280283      (if (memory-spec-p ea)
    281284        (ensuring-node-target (target vreg)
    282           (progn
     285          (let* ((reg (unless (node-reg-p vreg)
     286                        (or (arm2-reg-for-ea ea)
     287                            (arm2-try-non-conflicting-reg target 0)))))
     288            (when reg (setq target reg))
    283289            (arm2-stack-to-register seg ea target)
    284290            (if (addrspec-vcell-p ea)
     
    544550        *arm2-gpr-constants-valid-mask* 0))
    545551
     552
    546553(defun arm2-update-regmap (vinsn)
    547554  (if (vinsn-attribute-p vinsn :call)
     
    12611268          (return reg))))))
    12621269
    1263  
     1270(defun arm2-reg-for-ea (ea)
     1271  (when (and (memory-spec-p ea)
     1272             (not (addrspec-vcell-p ea)))
     1273    (let* ((offset (memspec-frame-address-offset ea))
     1274           (mask *arm2-gpr-locations-valid-mask*)
     1275           (info *arm2-gpr-locations*))
     1276      (declare (fixnum mask) (simple-vector info))
     1277      (dotimes (reg 16)
     1278        (when (and (logbitp reg mask)
     1279                   (memq offset (svref info reg)))
     1280          (return reg))))))
    12641281
    12651282(defun arm2-reg-for-form (form hint)
     
    12671284    (cond ((node-reg-p hint)
    12681285           (if var
    1269              (let* ((ea (var-ea var)))
    1270                (when (and (memory-spec-p ea)
    1271                           (not (addrspec-vcell-p ea)))
    1272                  (let* ((offset (memspec-frame-address-offset ea))
    1273                         (mask *arm2-gpr-locations-valid-mask*)
    1274                         (info *arm2-gpr-locations*))
    1275                    (declare (fixnum mask) (simple-vector info))
    1276                    (dotimes (reg 16)
    1277                      (when (and (logbitp reg mask)
    1278                                 (memq offset (svref info reg)))
    1279                        (return reg))))))
     1286             (arm2-reg-for-ea (var-ea var))
    12801287             (multiple-value-bind (value constantp) (acode-constant-p form)
    12811288               (when constantp
     
    30303037                   (cond ((and (not (and pushed-reg-is-set popped-reg-is-set))
    30313038                               (or (null popped-reg-is-reffed)
    3032                                    (vinsn-in-sequence-p pushed-reg-is-set popped-reg-is-reffed pop-vinsn)))
     3039                                   (null pushed-reg-is-set)
     3040                                   ;; If the popped register is
     3041                                   ;; referenced and the pushed
     3042                                   ;; register is set, we want to be
     3043                                   ;; sure that the last reference
     3044                                   ;; happens before the first
     3045                                   ;; assignent.  We can't be sure
     3046                                   ;; that either of these things
     3047                                   ;; actually happened or happen
     3048                                   ;; unconditionally, and can't
     3049                                   ;; be sure of the order in which
     3050                                   ;; they might happen if the sequence
     3051                                   ;; contains jumps or branches.
     3052                                   (vinsn-in-sequence-p pushed-reg-is-set popped-reg-is-reffed pop-vinsn)
     3053                                   (not (vinsn-sequence-has-some-attribute-p push-vinsn pop-vinsn :branch :jump))))
    30333054                          ;; We don't try this if anything's pushed on
    30343055                          ;; or popped from the vstack in the
     
    30663087                                            (- (the fixnum (svref operands opidx))
    30673088                                               arm::node-size))))))))
    3068                                              
    3069                                        
    3070                                      
    30713089                          (unless same-reg
    30723090                            (let* ((copy (! copy-gpr popped-reg pushed-reg)))
    30733091                              (remove-dll-node copy)
    3074                               (if popped-reg-is-reffed
    3075                                 (insert-dll-node-after copy popped-reg-is-reffed)
    3076                                 (if pushed-reg-is-set
     3092                              (if pushed-reg-is-set
    30773093                                  (insert-dll-node-after copy push-vinsn)
    3078                                   (insert-dll-node-before copy push-vinsn)))))
     3094                                  (insert-dll-node-before copy pop-vinsn))))
    30793095                          (elide-vinsn push-vinsn)
    30803096                          (elide-vinsn pop-vinsn))
     
    34093425        (progn
    34103426          (setq cdest (arm2-one-untargeted-reg-form seg cform creg restricted)
    3411                 restricted (arm2-restrict-node-target bdest restricted))
     3427                restricted (arm2-restrict-node-target cdest restricted))
    34123428          (unless adest
    34133429            (when (same-arm-reg-p areg cdest)
     
    34443460      (if bconst
    34453461        (setq bdest (arm2-one-untargeted-reg-form seg bform breg restricted))
    3446         (arm2-elide-pushes seg bpushed (arm2-pop-register seg breg)))
     3462        (arm2-elide-pushes seg bpushed (arm2-pop-register seg (setq bdest breg))))
    34473463      (setq restricted (arm2-restrict-node-target bdest restricted))
    34483464      (unless adest
     
    37673783            (if dest-crf
    37683784              (! set-eq-bit dest-crf)))
    3769           (if (and dest-crf src-gpr)
    3770             ;; "Copying" a GPR to a CR field means comparing it to rnil
    3771             (! compare-to-nil dest src)
     3785          (if dest-crf
     3786            ;; "Copying" a GPR to a CR field means comparing it to nil
     3787            (if src-gpr
     3788              (! compare-to-nil dest src)
     3789              (! compare-to-nil dest arm::sp))
    37723790            (if (and dest-gpr src-gpr)
    37733791              (case dest-mode
     
    66686686                    (backend-copy-label merge-else-branch-label falselabel)
    66696687                    (progn
    6670                       (@ falselabel)
     6688                      (if (and (not need-else) nil)
     6689                        (@+ falselabel)
     6690                        (@ falselabel))
    66716691                      (arm2-predicate-block falselabel)
    66726692                      (when need-else
     
    66956715                  (multiple-value-setq (*arm2-undo-count* *arm2-cstack* *arm2-vstack* *arm2-top-vstack-lcell*)
    66966716                    (arm2-decode-stack entry-stack)))
    6697                 (@ endlabel)
     6717                (if (and (not need-else) (backend-crf-p vreg) nil)
     6718                  (@+ endlabel)
     6719                  (@ endlabel))
    66986720                (arm2-predicate-block endlabel))))))))
    66996721
     
    67786800             (= (hard-regspec-class vreg) hard-reg-class-fpr)
    67796801             (= (get-regspec-mode vreg) hard-reg-class-fpr-mode-single))
    6780       (! double-float-negate vreg r1)
     6802      (! single-float-negate vreg r1)
    67816803      (with-fp-target (r1) (r2 :single-float)
    6782         (! double-float-negate r2 r1)
     6804        (! single-float-negate r2 r1)
    67836805        (ensuring-node-target (target vreg)
    67846806          (arm2-copy-register seg target r2))))
     
    89718993                (arm2-one-targeted-reg-form seg other other-reg)
    89728994                (! logand-immediate other-reg other-reg (logand constant #xffffffff))
    8973                 (<- other-reg))))
     8995                (if (and (typep constant '(unsigned-byte 29))
     8996                         (node-reg-p vreg))
     8997                  (! box-fixnum vreg other-reg)
     8998                  (<- other-reg)))))
    89748999          (^))))))
    89759000
Note: See TracChangeset for help on using the changeset viewer.