Changeset 15041


Ignore:
Timestamp:
Oct 24, 2011, 11:15:57 AM (8 years ago)
Author:
gb
Message:

Work in progress.

File:
1 edited

Legend:

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

    r15035 r15041  
    14771477          (return reg))))))
    14781478
     1479(defun x862-existing-reg-for-var (var)
     1480  (let* ((ea (var-ea var)))
     1481    (if (and (memory-spec-p ea)
     1482             (not (addrspec-vcell-p ea)))
     1483      (let* ((offset (memspec-frame-address-offset ea))
     1484             (mask *x862-gpr-locations-valid-mask*)
     1485             (info *x862-gpr-locations*))
     1486        (declare (fixnum mask) (simple-vector info))
     1487        (dotimes (reg 16)
     1488          (when (and (logbitp reg mask)
     1489                     (memq offset (svref info reg)))
     1490            (return reg))))
     1491      (if (register-spec-p ea)
     1492        ea))))
    14791493
    14801494(defun x862-reg-for-form (form hint)
     
    14821496    (cond ((node-reg-p hint)
    14831497           (if var
    1484              (let* ((ea (var-ea var)))
    1485                (if (and (memory-spec-p ea)
    1486                           (not (addrspec-vcell-p ea)))
    1487                  (let* ((offset (memspec-frame-address-offset ea))
    1488                         (mask *x862-gpr-locations-valid-mask*)
    1489                         (info *x862-gpr-locations*))
    1490                    (declare (fixnum mask) (simple-vector info))
    1491                    (dotimes (reg 16)
    1492                      (when (and (logbitp reg mask)
    1493                                 (memq offset (svref info reg)))
    1494                        (return reg))))
    1495                  (if (register-spec-p ea)
    1496                    ea)))
     1498             (x862-existing-reg-for-var var)
    14971499             (if (acode-p (setq form (acode-unwrapped-form form)))
    14981500               (let* ((op (acode-operator form)))
     
    33503352                              address-reg))
    33513353
     3354(defun x862-push-reg-for-form (seg form suggested)
     3355  (let* ((reg (if (and (node-reg-p suggested)
     3356                         (nx2-acode-call-p form))     ;probably ...
     3357                (x862-one-targeted-reg-form seg form *x862-arg-z*)
     3358                (x862-one-untargeted-reg-form seg form suggested))))
     3359    (x862-push-register seg reg)))
    33523360
    33533361(defun x862-one-lreg-form (seg form lreg)
     
    35863594        (if atriv
    35873595          (x862-one-targeted-reg-form seg aform areg)
    3588           (setq apushed (x862-push-register
    3589                          seg
    3590                          (x862-one-untargeted-reg-form seg aform areg)))))
     3596          (setq apushed (x862-push-reg-for-form seg aform areg))))
    35913597      (x862-one-targeted-reg-form seg bform breg)
    35923598      (if aconst
     
    36163622              (when (same-x86-reg-p adest breg)
    36173623                (setq breg areg)))
    3618             (setq apushed (x862-push-register
    3619                            seg
    3620                            (x862-one-untargeted-reg-form seg aform areg restricted)
    3621                            t))))
     3624            (setq apushed (x862-push-reg-for-form seg aform areg))))
    36223625        (unless (eql restricted-by-caller 0)
    36233626          (setq *x862-gpr-locations-valid-mask* (logandc2 *x862-gpr-locations-valid-mask* restricted-by-caller)))
     
    36633666      (if atriv
    36643667        (x862-one-targeted-reg-form seg aform areg)
    3665         (setq apushed (x862-push-register
    3666                        seg
    3667                        (x862-one-targeted-reg-form seg aform areg)))))
     3668        (setq apushed (x862-push-reg-for-form seg aform areg))))
    36683669    (if (and bform (not bconst))
    36693670      (if btriv
    36703671        (x862-one-targeted-reg-form seg bform breg)
    3671         (setq bpushed (x862-push-register
    3672                        seg
    3673                        (x862-one-targeted-reg-form seg bform breg)))))
     3672        (setq bpushed (x862-push-reg-for-form seg bform breg))))
    36743673    (x862-one-targeted-reg-form seg cform creg)
    36753674    (unless btriv
     
    37273726      (if atriv
    37283727        (x862-one-targeted-reg-form seg aform areg)
    3729         (setq apushed (x862-push-register seg (x862-one-targeted-reg-form seg aform areg)))))
     3728        (setq apushed (x862-push-reg-for-form seg aform areg))))
    37303729    (if (and bform (not bconst))
    37313730      (if btriv
    37323731        (x862-one-targeted-reg-form seg bform breg)
    3733         (setq bpushed (x862-push-register seg (x862-one-targeted-reg-form seg bform breg)))))
     3732        (setq bpushed (x862-push-reg-for-form seg bform breg))))
    37343733    (if (and cform (not cconst))
    37353734      (if ctriv
    37363735        (x862-one-targeted-reg-form seg cform creg)
    3737         (setq cpushed (x862-push-register seg (x862-one-targeted-reg-form seg cform creg)))))
     3736        (setq cpushed (x862-push-reg-for-form seg cform creg))))
    37383737    (x862-one-targeted-reg-form seg dform dreg)
    37393738    (unless ctriv
     
    37883787            (when (same-x86-reg-p adest creg)
    37893788              (setq creg areg)))
    3790           (setq apushed (x862-push-register
    3791                          seg
    3792                          (x862-one-untargeted-reg-form seg aform areg)))))
     3789          (setq apushed (x862-push-reg-for-form seg aform areg))))
    37933790      (when (and bform (not bconst))
    37943791        (if btriv
     
    38013798            (when (same-x86-reg-p bdest creg)
    38023799              (setq creg breg)))
    3803           (setq bpushed (x862-push-register
    3804                          seg (x862-one-untargeted-reg-form seg bform breg)))))
     3800          (setq bpushed (x862-push-reg-for-form seg bform breg))))
    38053801      (setq cdest (x862-one-untargeted-reg-form seg cform creg restricted)
    38063802            restricted (x862-restrict-node-target cdest restricted))
     
    38783874          (when (same-x86-reg-p dreg adest)
    38793875            (setq dreg areg)))
    3880         (setq apushed (x862-push-register seg (x862-one-untargeted-reg-form seg aform areg)))))
     3876        (setq apushed (x862-push-reg-for-form seg aform areg))))
    38813877    (when (and bform (not bconst))
    38823878      (if btriv
     
    38913887          (when (same-x86-reg-p dreg bdest)
    38923888            (setq dreg breg)))
    3893         (setq bpushed (x862-push-register seg (x862-one-untargeted-reg-form seg bform breg)))))
     3889        (setq bpushed (x862-push-reg-for-form seg  bform breg))))
    38943890    (when (and cform (not cconst))
    38953891      (if ctriv
     
    39053901          (when (same-x86-reg-p cdest dreg)
    39063902            (setq dreg creg)))
    3907         (setq cpushed (x862-push-register seg (x862-one-untargeted-reg-form seg cform creg)))))
     3903        (setq cpushed (x862-push-reg-for-form seg cform creg))))
    39083904    (setq ddest (x862-one-untargeted-reg-form seg dform dreg restricted)
    39093905          restricted (x862-restrict-node-target ddest restricted))
     
    40524048          (x862-compare-u8 seg vreg xfer u8-operand u8 (if (and iu8 (not (eq cr-bit x86::x86-e-bits))) (logxor 1 cr-bit) cr-bit) true-p u8-operator)
    40534049          (if (and boolean (or js32 is32))
    4054             (let* ((ea (x862-lexical-reference-ea (if js32 i j)))
    4055                    (offset (and ea (memory-spec-p ea) (memspec-frame-address-offset ea)))
     4050            (let* ((form (if js32 i j))
     4051                   (var (nx2-lexical-reference-p form))
     4052                   (ea (when var
     4053                         (unless (x862-existing-reg-for-var var) (var-ea var))))
     4054                   (offset (and ea
     4055                                (memory-spec-p ea)
     4056                                (not (addrspec-vcell-p ea))
     4057                                (memspec-frame-address-offset ea)))
    40564058                   (reg (unless offset (x862-one-untargeted-reg-form seg (if js32 i j) *x862-arg-z*)))
    40574059                   (constant (or js32 is32)))
     
    65036505              (setq no-regs (%ilogbitp $fbitnoregs fbits)))
    65046506        (multiple-value-setq (pregs reglocatives)
    6505           (nx2-allocate-global-registers
    6506            *x862-fcells*
    6507            *x862-vcells*
    6508            (afunc-all-vars afunc)
    6509            inherited-vars
     6507          (nx2-afunc-allocate-global-registers
     6508           afunc
    65106509           (unless no-regs
    65116510             (target-arch-case
Note: See TracChangeset for help on using the changeset viewer.