Make data keep track of their last use

This commit is contained in:
John Lorentzson 2025-07-01 13:22:24 +02:00
parent c1846e35bd
commit b7c4a37483
2 changed files with 9 additions and 1 deletions

View file

@ -1,7 +1,8 @@
(in-package #:user-side-compiler) (in-package #:user-side-compiler)
(defclass ir-data () (defclass ir-data ()
((%definition :accessor definition :initarg :definition))) ((%definition :accessor definition :initarg :definition)
(%last-use :accessor last-use)))
(defclass ir-result (ir-data) (defclass ir-result (ir-data)
((%user :accessor user :initarg :user :initform nil))) ((%user :accessor user :initarg :user :initform nil)))

View file

@ -168,3 +168,10 @@ though I'm pretty sure it can't anyway.")
(push input arguments)))) (push input arguments))))
(loop :for (new . old) :in replacements (loop :for (new . old) :in replacements
:do (setf (inputs call) (substitute new old (inputs call))))))))) :do (setf (inputs call) (substitute new old (inputs call)))))))))
(defun compute-lifetime-knowledge (start-iblock)
(do-iblocks (iblock start-iblock)
(do-instructions (inst iblock)
(loop :for data :in (inputs inst)
:when (typep data 'ir-data)
:do (setf (last-use data) inst)))))