Function: comp--collect-calls

comp--collect-calls is a byte-compiled function defined in comp.el.gz.

Signature

(comp--collect-calls F)

Documentation

Return a list with all the functions called by F.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/comp.el.gz
;;; pure-func pass specific code.

;; Simple IPA pass to infer function purity of functions not
;; explicitly declared as such.  This is effective only at speed 3 to
;; avoid optimizing-out functions and preventing their redefinition
;; being effective.

(defun comp--collect-calls (f)
  "Return a list with all the functions called by F."
  (cl-loop
   with h = (make-hash-table :test #'eq)
   for b being each hash-value of (comp-func-blocks f)
   do (cl-loop
       for insn in (comp-block-insns b)
       do (pcase insn
            (`(set ,_lval (,(pred comp--call-op-p) ,f . ,_rest))
             (puthash f t h))
            (`(,(pred comp--call-op-p) ,f . ,_rest)
             (puthash f t h))))
   finally return (cl-loop
                   for f being each hash-key of h
                   collect (if (stringp f)
                               (comp-func-name
                                (gethash f
                                         (comp-ctxt-funcs-h comp-ctxt)))
                             f))))