Function: comp-cond-cstrs-target-mvar

comp-cond-cstrs-target-mvar is a byte-compiled function defined in comp.el.gz.

Signature

(comp-cond-cstrs-target-mvar MVAR EXIT-INSN BB)

Documentation

Given MVAR, search in BB the original mvar MVAR got assigned from.

Keep on searching till EXIT-INSN is encountered.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/comp.el.gz
;; Cheap substitute to a copy propagation pass...
(defun comp-cond-cstrs-target-mvar (mvar exit-insn bb)
  "Given MVAR, search in BB the original mvar MVAR got assigned from.
Keep on searching till EXIT-INSN is encountered."
  (cl-flet ((targetp (x)
              ;; Ret t if x is an mvar and target the correct slot number.
              (and (comp-mvar-p x)
                   (eql (comp-mvar-slot mvar) (comp-mvar-slot x)))))
    (cl-loop
     with res = nil
     for insn in (comp-block-insns bb)
     when (eq insn exit-insn)
     do (cl-return (and (comp-mvar-p res) res))
     do (pcase insn
          (`(,(pred comp-assign-op-p) ,(pred targetp) ,rhs)
           (setf res rhs)))
     finally (cl-assert nil))))