New separate pass for assigning numbers to labels.

This commit is contained in:
Juan Jose Garcia Ripoll 2009-12-27 20:20:38 +01:00
parent 2dd36d0118
commit ddc638fde4
3 changed files with 23 additions and 2 deletions

View file

@ -34,8 +34,8 @@
(when (plusp (tag-ref form))
(let ((label (tag-label form)))
(unless label
(setf (tag-label form) (setf label (next-label))))
(wt-label (tag-label form)))))
(error "No label for tag ~A" form))
(wt-label label))))
((c1form-p form)
(pprint-c1form form)
(let* ((*file* (c1form-file form))

View file

@ -225,3 +225,23 @@ form in its read/set nodes, and add other consistency checks."
(error ";;; Inconsistent form ~S form with arguments~{~&;;; ~A~}"
(c1form-name form) args)))
forms))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; ASSIGN LABELS
;;;
(defun pass-assign-labels (function forms)
(loop with *last-label* = 0
with last = nil
for f in forms
do (cond ((not (tag-p f))
(setf last nil))
(last
(setf (tag-label f) last
(tag-ref f) 0))
(t
(setf last (next-label)
(tag-label f) last)))
finally (setf (fun-last-label function) *last-label*))
forms)

View file

@ -152,6 +152,7 @@
(execute-pass 'pass-delete-no-side-effects)
(execute-pass 'pass-delete-unused-bindings)
(execute-pass 'pass-decide-var-rep-types)
(execute-pass 'pass-assign-labels)
;; Emit entry function
(let ((*compile-to-linking-call* nil))