Function: comp-ssa-rename-insn

comp-ssa-rename-insn is a byte-compiled function defined in comp.el.gz.

Signature

(comp-ssa-rename-insn INSN FRAME)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/comp.el.gz
(defun comp-ssa-rename-insn (insn frame)
  (cl-loop
   for slot-n from (- (comp-func-vframe-size comp-func))
              below (comp-func-frame-size comp-func)
   do
   (cl-flet ((targetp (x)
               ;; Ret t if x is an mvar and target the correct slot number.
               (and (comp-mvar-p x)
                    (eql slot-n (comp-mvar-slot x))))
             (new-lvalue ()
               ;; If is an assignment make a new mvar and put it as l-value.
               (let ((mvar (make-comp-ssa-mvar :slot slot-n)))
                 (setf (comp-vec-aref frame slot-n) mvar
                       (cadr insn) mvar))))
     (pcase insn
       (`(,(pred comp-assign-op-p) ,(pred targetp) . ,_)
        (let ((mvar (comp-vec-aref frame slot-n)))
          (setf (cddr insn) (cl-nsubst-if mvar #'targetp (cddr insn))))
        (new-lvalue))
       (`(fetch-handler . ,_)
        ;; Clobber all no matter what!
        (setf (comp-vec-aref frame slot-n) (make-comp-ssa-mvar :slot slot-n)))
       (`(phi ,n)
        (when (equal n slot-n)
          (new-lvalue)))
       (_
        (let ((mvar (comp-vec-aref frame slot-n)))
          (setcdr insn (cl-nsubst-if mvar #'targetp (cdr insn)))))))))