Changeset 15917


Ignore:
Timestamp:
Sep 29, 2013, 5:20:11 AM (8 years ago)
Author:
gb
Message:

New vinsn/notes stuff for ARM.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/acode-rewrite/source/compiler/ARM/arm2.lisp

    r15914 r15917  
    127127(defvar *arm2-register-restore-ea* nil)
    128128(defvar *arm2-non-volatile-fpr-count* 0)
    129 (defvar *arm2-compiler-register-save-label* nil)
     129(defvar *arm2-compiler-register-save-note* nil)
    130130
    131131(defparameter *arm2-tail-call-aliases*
     
    389389           (*arm2-optimize-for-space* nil)
    390390           (*arm2-register-restore-count* nil)
    391            (*arm2-compiler-register-save-label* nil)
     391           (*arm2-compiler-register-save-note* nil)
    392392           (*arm2-non-volatile-fpr-count* 0)
    393393           (*arm2-register-restore-ea* nil)
     
    672672
    673673(defun arm2-vinsn-note-label-address (note &optional start-p sym)
    674   (let* ((label (vinsn-note-label note))
    675          (lap-label (if label (vinsn-label-info label))))
     674  (let* ((lap-label (vinsn-note-address note)))
    676675    (if lap-label
    677676      (arm::lap-label-address lap-label)
     
    722721  (declare (fixnum n))
    723722  (when (> n 0)
    724     (setq *arm2-compiler-register-save-label* (arm2-emit-note seg :regsave))
     723    (setq *arm2-compiler-register-save-note* (arm2-emit-note seg :regsave))
    725724    (with-arm-local-vinsn-macros (seg)
    726725      (! save-nvrs n))
     
    10411040      (compiler-bug "arm2-form ? ~s" form)))
    10421041
    1043 (defmacro with-note ((form-var seg-var &rest other-vars) &body body)
     1042(defmacro arm-with-note ((form-var seg-var &rest other-vars) &body body)
    10441043  (let* ((note (gensym "NOTE"))
    10451044         (code-note (gensym "CODE-NOTE"))
    10461045         (source-note (gensym "SOURCE-NOTE"))
    10471046         (start (gensym "START"))
    1048          (end (gensym "END"))
    1049          (with-note-body (gensym "WITH-NOTE-BODY")))
    1050     `(flet ((,with-note-body (,form-var ,seg-var ,@other-vars) ,@body))
     1047         (arm-with-note-body (gensym "ARM-WITH-NOTE-BODY")))
     1048    `(flet ((,arm-with-note-body (,form-var ,seg-var ,@other-vars) ,@body))
    10511049       (let ((,note (acode-note ,form-var)))
    10521050         (if ,note
    1053            (let* ((,code-note (and (code-note-p ,note) ,note))
     1051           (let* ((,code-note (and ,note (code-note-p ,note) ,note))
    10541052                  (,source-note (if ,code-note
    10551053                                  (code-note-source-note ,note)
    10561054                                  ,note))
    10571055                  (,start (and ,source-note
    1058                                (arm2-emit-note ,seg-var :source-location-begin ,source-note))))
     1056                               (enqueue-vinsn-note ,seg-var :source-location-begin ,source-note))))
    10591057             (prog2
    10601058                 (when ,code-note
     
    10641062                       (! lri zero 0)
    10651063                       (! misc-set-c-node ($ zero) ($ arm::temp0) 1))))
    1066                  (,with-note-body ,form-var ,seg-var ,@other-vars)
     1064                 (,arm-with-note-body ,form-var ,seg-var ,@other-vars)
    10671065               (when ,source-note
    1068                  (let ((,end (arm2-emit-note ,seg-var :source-location-end)))
    1069                    (setf (vinsn-note-peer ,start) ,end
    1070                          (vinsn-note-peer ,end) ,start)
    1071                    (push ,start *arm2-emitted-source-notes*)))))
    1072            (,with-note-body ,form-var ,seg-var ,@other-vars))))))
     1066                 (close-vinsn-note ,seg-var ,start))))
     1067           (,arm-with-note-body ,form-var ,seg-var ,@other-vars))))))
    10731068
    10741069(defun arm2-toplevel-form (seg vreg xfer form)
     
    10781073
    10791074(defun arm2-form (seg vreg xfer form)
    1080   (with-note (form seg vreg xfer)
     1075  (arm-with-note (form seg vreg xfer)
    10811076    (if (nx-null form)
    10821077      (arm2-nil seg vreg xfer)
     
    10961091(defun arm2-form-float (seg freg xfer form)
    10971092  (declare (ignore xfer))
    1098   (with-note (form seg freg)
     1093  (arm-with-note (form seg freg)
    10991094    (when (or (nx-null form)(nx-t form))(compiler-bug "arm2-form to freg ~s" form))
    11001095    (when (and (= (get-regspec-mode freg) hard-reg-class-fpr-mode-double)
     
    11661161  (setq *arm2-vstack* new))
    11671162
    1168 
    1169 ;;; Emit a note at the end of the segment.
    1170 (defun arm2-emit-note (seg class &rest info)
    1171   (declare (dynamic-extent info))
    1172   (let* ((note (make-vinsn-note class info)))
    1173     (append-dll-node (vinsn-note-label note) seg)
    1174     note))
    1175 
    1176 ;;; Emit a note immediately before the target vinsn.
    1177 (defun arm-prepend-note (vinsn class &rest info)
    1178   (declare (dynamic-extent info))
    1179   (let* ((note (make-vinsn-note class info)))
    1180     (insert-dll-node-before (vinsn-note-label note) vinsn)
    1181     note))
    1182 
    1183 (defun arm2-close-note (seg note)
    1184   (let* ((end (close-vinsn-note note)))
    1185     (append-dll-node (vinsn-note-label end) seg)
    1186     end))
    11871163
    11881164
     
    39263902(defun arm2-dynamic-extent-form (seg curstack val &aux (form val))
    39273903  (when (acode-p form)
    3928     (with-note (form seg curstack) ; note this rebinds form/seg/curstack so can't setq
     3904    (arm-with-note (form seg curstack) ; note this rebinds form/seg/curstack so can't setq
    39293905      (with-arm-local-vinsn-macros (seg)
    39303906        (let* ((op (acode-operator form))
     
    41364112  (setf (var-ea var) ea)
    41374113  (when (and *arm2-record-symbols* (or (typep ea 'lreg) (typep ea 'fixnum)))
    4138     (let* ((start (arm2-emit-note seg :begin-variable-scope)))
    4139       (push (list var (var-name var) start (close-vinsn-note start))
     4114    (let* ((start (enqueue-vinsn-note seg :begin-variable-scope var)))
     4115      (push (list var (var-name var) start nil)
    41404116            *arm2-recorded-symbols*)))
    41414117  ea)
     
    41464122               (or (logbitp $vbitspecial bits)
    41474123                   (not (logbitp $vbitpunted bits))))
    4148       (let ((endnote (%car (%cdddr (assq var *arm2-recorded-symbols*)))))
    4149         (unless endnote (compiler-bug "arm2-close-var for ~s ?" (var-name var)))
    4150         (setf (vinsn-note-class endnote) :end-variable-scope)
    4151         (append-dll-node (vinsn-note-label endnote) seg)))))
     4124      (let* ((info (%cdr (assq var *arm2-recorded-symbols*))))
     4125        (unless info (compiler-bug "arm2-close-var for ~s ?" (var-name var)))
     4126        (setf (caddr info) (close-vinsn-note seg (cadr info)))))))
    41524127
    41534128(defun arm2-load-ea-p (ea)
     
    51445119  (or (eq cd $backend-return) (arm2-mvpass-p cd)))
    51455120
    5146 (defun arm2-expand-note (header note)
    5147   (let* ((lab (vinsn-note-label note)))
    5148     (case (vinsn-note-class note)
    5149       ((:begin-variable-scope :end-variable-scope
    5150         :source-location-begin :source-location-end)
    5151        (setf (vinsn-label-info lab) (arm::emit-lap-label header lab))))))
     5121
    51525122
    51535123
     
    51595129        (if (or (typep id 'fixnum) (null id))
    51605130          (when (or t (vinsn-label-refs v) (null id))
    5161             (setf (vinsn-label-info v) (arm::emit-lap-label current v)))
    5162           (arm2-expand-note current id)))
     5131            (setf (vinsn-label-info v) (arm::emit-lap-label current v)))))
    51635132      (arm2-expand-vinsn v current sections)))
    51645133  ;;; This doesn't have too much to do with anything else that's
     
    51915160         (predicate (getf (vinsn-annotation vinsn) :predicate))
    51925161         (unique-labels ())
     5162         (notes (vinsn-notes vinsn))
    51935163         (operand-insert-functions arm::*arm-vinsn-insert-functions*))
    51945164    (declare (fixnum nvp))
     
    52915261      (declare (dynamic-extent #'expand-form #'parse-operand-form #'expand-insn-form #'eval-predicate))
    52925262                                        ;(format t "~& vinsn = ~s" vinsn)
     5263      (when notes
     5264        (let* ((lab ()))
     5265          (dolist (note notes)
     5266            (unless (eq :close (vinsn-note-class note))
     5267              (when (eq :source-location-begin
     5268                        (vinsn-note-class note))
     5269                (push note *arm2-emitted-source-notes*))
     5270              (when (null lab)
     5271                (setq lab (arm::make-lap-label note))
     5272                (arm::emit-lap-label current note))
     5273              (setf (vinsn-note-address note) lab)))))
    52935274      (dolist (form (vinsn-template-body template))
    52945275        (expand-form form ))
     5276      (when notes
     5277        (let* ((lab ()))
     5278          (dolist (note notes)
     5279            (when (eq :close (vinsn-note-class note))
     5280              (when (null lab)
     5281                (setq lab (arm::make-lap-label note))
     5282                (arm::emit-lap-label current note))
     5283              (setf (vinsn-note-address note) lab)))))
    52955284      (setf (vinsn-variable-parts vinsn) nil)
    52965285      (when vp
     
    63946383              (do* ((next (dll-node-succ branch) (dll-node-succ next)))
    63956384                   ((eq next lab)
    6396                     (remove-dll-node branch)
     6385                    (elide-vinsn branch)
    63976386                    (remove-dll-node lab)
    63986387                    t)
Note: See TracChangeset for help on using the changeset viewer.