Changeset 7938


Ignore:
Timestamp:
Dec 26, 2007, 7:45:56 AM (12 years ago)
Author:
gb
Message:

Peephole on the fly: turn

(push r1)
(movq top-of-stack r2)

into

(push r1)
(movq r1 r2)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/compiler/X86/x862.lisp

    r7859 r7938  
    4040(defparameter *x862-operator-supports-u8-target* ())
    4141(defparameter *x862-operator-supports-push* ())
    42 
     42(defparameter *x862-tos-reg* ())
    4343
    4444
     
    6767         (retvreg-var (gensym))
    6868         (label-var (gensym)))
    69     `(macrolet ((! (,template-name-var &rest ,args-var)
     69    `(macrolet ((! (,template-name-var &rest ,args-var)                 
    7070                  (let* ((,template-temp (get-vinsn-template-cell ,template-name-var (backend-p2-vinsn-templates *target-backend*))))
    7171                    (unless ,template-temp
    7272                      (warn "VINSN \"~A\" not defined" ,template-name-var))
    73                     `(%emit-vinsn ,',segvar ',,template-name-var (backend-p2-vinsn-templates *target-backend*) ,@,args-var))))
     73                    `(prog1
     74                      (%emit-vinsn ,',segvar ',,template-name-var (backend-p2-vinsn-templates *target-backend*) ,@,args-var)
     75                      (setq *x862-tos-reg* nil)))))
    7476       (macrolet ((<- (,retvreg-var)
    7577                    `(x862-copy-register ,',segvar ,',vreg-var ,,retvreg-var))
     
    461463                                                            (1+ *x862-target-fixnum-shift*))))
    462464           (*x862-target-dnode-size* (* 2 *x862-target-lcell-size*))
     465           (*x862-tos-reg* nil)
    463466           (*x862-all-lcells* ())
    464467           (*x862-top-vstack-lcell* nil)
     
    12391242(defun x862-stack-to-register (seg memspec reg)
    12401243  (with-x86-local-vinsn-macros (seg)
    1241     (! vframe-load reg (memspec-frame-address-offset memspec) *x862-vstack*)))
     1244    (let* ((offset (memspec-frame-address-offset memspec)))
     1245      (if (and *x862-tos-reg*
     1246               (= offset (- *x862-vstack* *x862-target-node-size*)))
     1247        (x862-copy-register seg reg *x862-tos-reg*)
     1248        (! vframe-load reg offset  *x862-vstack*)))))
    12421249
    12431250(defun x862-lcell-to-register (seg lcell reg)
     
    32903297                (setq cr-bit (x862-reverse-cr-bit cr-bit)))
    32913298              (^ cr-bit true-p))
    3292             (if (and (eq cr-bit x86::x86-e-bits)
     3299            (if (and ;(eq cr-bit x86::x86-e-bits)
    32933300                     (or js32 is32))
    3294               (x862-test-reg-%izerop
     3301              (progn
     3302                (unless (or js32 (eq cr-bit x86::x86-e-bits))
     3303                  (setq cr-bit (x862-reverse-cr-bit cr-bit)))
     3304              (x862-test-reg-%izerop
    32953305               seg
    32963306               vreg
     
    33023312               cr-bit
    33033313               true-p
    3304                (or js32 is32))
     3314               (or js32 is32)))
    33053315              (multiple-value-bind (ireg jreg) (x862-two-untargeted-reg-forms seg i x8664::arg_y j x8664::arg_z)
    33063316                (x862-compare-registers seg vreg xfer ireg jreg cr-bit true-p)))))))))
     
    34953505    (prog1
    34963506      (! vpush-register src)
     3507      (setq *x862-tos-reg* src)
    34973508      (x862-new-vstack-lcell (or why :node) *x862-target-lcell-size* (or attr 0) info)
    34983509      (x862-adjust-vstack *x862-target-node-size*))))
     
    70087019  (with-x86-local-vinsn-macros (seg vreg xfer)
    70097020    (multiple-value-bind (cr-bit true-p) (acode-condition-to-x86-cr-bit cc)
    7010       (! mask-base-char x8664::imm0 (x862-one-untargeted-reg-form seg form x8664::arg_z))
    7011       (x862-test-reg-%izerop seg vreg xfer x8664::imm0 cr-bit true-p
    7012                              (target-arch-case
    7013                              
    7014                               (:x8664 x8664::subtag-character))))))
     7021      (! compare-u8-constant (x862-one-untargeted-reg-form seg form x8664::arg_z)
     7022         (target-arch-case
     7023          (:x8664 x8664::subtag-character)))
     7024      (setq cr-bit (x862-cr-bit-for-unsigned-comparison cr-bit))
     7025      (regspec-crf-gpr-case
     7026       (vreg dest)
     7027       (^ cr-bit true-p)
     7028       (progn
     7029         (ensuring-node-target (target dest)
     7030           (if (not true-p)
     7031             (setq cr-bit (logxor 1 cr-bit)))
     7032           (! cr-bit->boolean target cr-bit))
     7033         (^))))))
     7034
    70157035
    70167036
Note: See TracChangeset for help on using the changeset viewer.