Function: comp--add-new-block-between
comp--add-new-block-between is a byte-compiled function defined in
comp.el.gz.
Signature
(comp--add-new-block-between BB-SYMBOL BB-A BB-B)
Documentation
Create a new basic-block named BB-SYMBOL and add it between BB-A and BB-B.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/comp.el.gz
(defun comp--add-new-block-between (bb-symbol bb-a bb-b)
"Create a new basic-block named BB-SYMBOL and add it between BB-A and BB-B."
(cl-loop
with new-bb = (make-comp-block-cstr :name bb-symbol
:insns `((jump ,(comp-block-name bb-b))))
with new-edge = (comp--edge-make :src bb-a :dst new-bb)
for ed in (comp-block-in-edges bb-b)
when (eq (comp-edge-src ed) bb-a)
do
;; Connect `ed' to `new-bb' and disconnect it from `bb-a'.
(cl-assert (memq ed (comp-block-out-edges bb-a)))
(setf (comp-edge-src ed) new-bb
(comp-block-out-edges bb-a) (delq ed (comp-block-out-edges bb-a)))
(push ed (comp-block-out-edges new-bb))
;; Connect `bb-a' `new-bb' with `new-edge'.
(push new-edge (comp-block-out-edges bb-a))
(push new-edge (comp-block-in-edges new-bb))
(setf (comp-func-ssa-status comp-func) 'dirty)
;; Add `new-edge' to the current function and return it.
(cl-return (puthash bb-symbol new-bb (comp-func-blocks comp-func)))
finally (cl-assert nil)))