Function: comp--add-call-cstr

comp--add-call-cstr is a byte-compiled function defined in comp.el.gz.

Signature

(comp--add-call-cstr)

Documentation

Add args assumptions for each function of which the type specifier is known.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/comp.el.gz
(defun comp--add-call-cstr ()
  "Add args assumptions for each function of which the type specifier is known."
  (cl-loop
   for bb being each hash-value of (comp-func-blocks comp-func)
   do
   (comp--loop-insn-in-block bb
     (when-let ((match
                 (pcase insn
                   (`(set ,lhs (,(pred comp--call-op-p) ,f . ,args))
                    (when-let ((cstr-f (comp--get-function-cstr f)))
                      (cl-values f cstr-f lhs args)))
                   (`(,(pred comp--call-op-p) ,f . ,args)
                    (when-let ((cstr-f (comp--get-function-cstr f)))
                      (cl-values f cstr-f nil args))))))
       (cl-multiple-value-bind (f cstr-f lhs args) match
         (cl-loop
          with gen = (comp--lambda-list-gen (comp-cstr-f-args cstr-f))
          for arg in args
          for cstr = (funcall gen)
          for target = (comp--cond-cstrs-target-mvar arg insn bb)
          unless (comp-cstr-p cstr)
            do (signal 'native-ice
                       (list "Incoherent type specifier for function" f))
          when (and target
                    ;; No need to add call constraints if this is t
                    ;; (bug#45812 bug#45705 bug#45751).
                    (not (equal comp-cstr-t cstr))
                    (or (null lhs)
                        (not (eql (comp-mvar-slot lhs)
                                  (comp-mvar-slot target)))))
            do (comp--emit-call-cstr target insn-cell cstr)))))))