Add function for replacing IR-TERMINATOR in IBLOCK

This commit is contained in:
John Lorentzson 2025-07-31 13:07:46 +02:00
parent e302493800
commit 15898ab691

View file

@ -24,6 +24,17 @@
(setf (start ib) new)
(setf (next prev-inst) new))))
(defun replace-terminator (old new)
(check-type old ir-terminator)
(check-type new ir-terminator)
(let ((iblock (iblock old))
(before (previous old)))
(setf (destinations old) '()
(next before) new
(end iblock) new
(iblock new) iblock
(previous new) before)))
(defun yank-instruction (instruction)
"Removes INSTRUCTIONS without cleaning up, allowing it to be put back in."
(check-type instruction (and ir-inst (not ir-terminator)))