Function: comp--limplify-function
comp--limplify-function is a byte-compiled function defined in
comp.el.gz.
Signature
(comp--limplify-function FUNC)
Documentation
Limplify a single function FUNC.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/comp.el.gz
(defun comp--limplify-function (func)
"Limplify a single function FUNC."
(let* ((frame-size (comp-func-frame-size func))
(comp-func func)
(comp-pass (make-comp-limplify
:frame (comp--new-frame frame-size 0))))
(comp--fill-label-h)
;; Prologue
(comp--make-curr-block 'entry (comp--sp))
(comp--emit-annotation (concat "Lisp function: "
(symbol-name (comp-func-name func))))
;; Dynamic functions have parameters bound by the trampoline.
(when (comp-func-l-p func)
(let ((args (comp-func-l-args func)))
(if (comp-args-p args)
(cl-loop for i below (comp-args-max args)
do (cl-incf (comp--sp))
(comp--emit `(set-par-to-local ,(comp--slot) ,i)))
(comp--emit-narg-prologue (comp-args-base-min args)
(comp-nargs-nonrest args)
(comp-nargs-rest args)))))
(comp--emit '(jump bb_0))
;; Body
(comp--bb-maybe-add 0 (comp--sp))
(cl-loop for next-bb = (pop (comp-limplify-pending-blocks comp-pass))
while next-bb
do (comp--limplify-block next-bb))
;; Sanity check against block duplication.
(cl-loop with addr-h = (make-hash-table)
for bb being the hash-value in (comp-func-blocks func)
for addr = (when (comp-block-lap-p bb)
(comp-block-lap-addr bb))
when addr
do (cl-assert (null (gethash addr addr-h)))
(puthash addr t addr-h))
(comp--limplify-finalize-function func)))