Changeset 6296


Ignore:
Timestamp:
Apr 18, 2007, 9:19:56 AM (15 years ago)
Author:
gb
Message:

Recognize memory addresses of the form (@ (: label) (% rip)) as if the label
was at the function entry point. (It always is, in current usage, but we really
need to know the address of the %rip-relative displacement to handle the general
case.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/x8664-call/ccl/compiler/X86/x86-disassemble.lisp

    r6003 r6296  
    23502350  ;; If the instruction is a MOV or PUSH whose source operand
    23512351  ;; is relative to the FN register, generate a constant reference.
     2352  ;; If the instruction is adding a displacement to RIP, note
     2353  ;; the effective address as a label reference.
    23522354  (let* ((op0 (x86-di-op0 instruction))
    23532355         (op1 (x86-di-op1 instruction))
     
    23592361                             (x86::x86-reg64 13)
    23602362                             (x86::x86-reg32 6))))))
     2363           (is-rip (thing)
     2364             (if (and (typep thing 'x86::x86-register-operand)
     2365                      (x86-ds-mode-64 ds))
     2366               (let* ((entry (x86::x86-register-operand-entry thing)))
     2367                 (eq entry (svref x86::*x8664-register-entries* 102)))))
    23612368           (is-ra0 (thing)
    23622369             (if (typep thing 'x86::x86-register-operand)
     
    23852392                      (or (null scale) (eql 0 scale)))
    23862393                    (let* ((disp (x86::x86-memory-operand-disp thing)))
     2394                      (and disp (early-x86-lap-expression-value disp)))))
     2395             (is-rip-ea (thing)
     2396               (and (typep thing 'x86::x86-memory-operand)
     2397                    (is-rip (x86::x86-memory-operand-base thing))
     2398                    (null (x86::x86-memory-operand-index thing))
     2399                    (let* ((scale (x86::x86-memory-operand-scale thing)))
     2400                      (or (null scale) (eql 0 scale)))
     2401                    (let* ((disp (x86::x86-memory-operand-disp thing)))
    23872402                      (and disp (early-x86-lap-expression-value disp))))))
    23882403        (case flag
     
    23912406          (:lea
    23922407           (let* ((disp ))
    2393              (when (or (and (setq disp (is-fn-ea op0)) (> disp 0))
     2408             (if (or (and (setq disp (is-fn-ea op0)) (> disp 0))
    23942409                       (and (setq disp (is-ra0-ea op0)) (< disp 0) (is-fn op1)))
    23952410               (let* ((label-ea (+ entry-ea (abs disp))))
     
    24002415                            `(- (:^ ,label-ea))
    24012416                            `(:^ ,label-ea))))
    2402                    (push label-ea (x86-ds-pending-labels ds)))))))
     2417                   (push label-ea (x86-ds-pending-labels ds))))
     2418               (if (and (setq disp (is-rip-ea op0)) (< disp 0) (is-fn op1))
     2419                 (progn
     2420                   (setf (x86::x86-memory-operand-disp op0)
     2421                         (parse-x86-lap-expression `(:^ ,entry-ea)))
     2422                   (push entry-ea (x86-ds-pending-labels ds)))))))
    24032423          (:jump
    24042424           (let* ((disp (is-disp-only op0)))
Note: See TracChangeset for help on using the changeset viewer.