Function: comp--compute-edges

comp--compute-edges is a byte-compiled function defined in comp.el.gz.

Signature

(comp--compute-edges)

Documentation

Compute the basic block edges for the current function.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/comp.el.gz
(defun comp--compute-edges ()
  "Compute the basic block edges for the current function."
  (cl-loop with blocks = (comp-func-blocks comp-func)
           for bb being each hash-value of blocks
           for last-insn = (car (last (comp-block-insns bb)))
           for (op first second third forth) = last-insn
           do (cl-case op
                (jump
                 (comp--edge-make :src bb :dst (gethash first blocks)))
                (cond-jump
                 (comp--edge-make :src bb :dst (gethash third blocks))
                 (comp--edge-make :src bb :dst (gethash forth blocks)))
                (cond-jump-narg-leq
                 (comp--edge-make :src bb :dst (gethash second blocks))
                 (comp--edge-make :src bb :dst (gethash third blocks)))
                (push-handler
                 (comp--edge-make :src bb :dst (gethash third blocks))
                 (comp--edge-make :src bb :dst (gethash forth blocks)))
                (return)
                (unreachable)
                (otherwise
                 (signal 'native-ice
                         (list "block does not end with a branch"
                               bb
                               (comp-func-name comp-func)))))
           ;; Update edge refs into blocks.
           finally
           (cl-loop
            for edge being the hash-value in (comp-func-edges-h comp-func)
            do
            (push edge
                  (comp-block-out-edges (comp-edge-src edge)))
            (push edge
                  (comp-block-in-edges (comp-edge-dst edge))))
           (comp--log-edges comp-func)))